* Simple test app for FileDialog

svn path=/trunk/winforms/; revision=45029
This commit is contained in:
Peter Dennis Bartok 2005-05-26 03:49:41 +00:00
Родитель 3986b13e68
Коммит 7c1a66245d
2 изменённых файлов: 61 добавлений и 0 удалений

10
filedialog/Makefile Normal file
Просмотреть файл

@ -0,0 +1,10 @@
all: mono
mono: swf-filedialog.cs
mcs swf-filedialog.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
dotnet: swf-filedialog.cs
csc swf-filedialog.cs /r:System.Windows.Forms.dll /r:System.Drawing.dll
clean:
rm swf-filedialog.exe -r -f

Просмотреть файл

@ -0,0 +1,51 @@
//
// Testapp by Alexander Olk
//
using System;
using System.Drawing;
using System.Windows.Forms;
namespace testwin
{
public class MainForm : Form
{
private Button button;
public MainForm()
{
button = new Button();
SuspendLayout();
button.Location = new System.Drawing.Point(40, 32);
button.Text = "FileDialog";
button.Click += new System.EventHandler(OnClick);
AutoScaleBaseSize = new Size(5, 13);
ClientSize = new System.Drawing.Size(292, 266);
Controls.Add(button);
Text = "FileDialogTest";
ResumeLayout(false);
}
[STAThread]
public static void Main(string[] args)
{
Application.Run(new MainForm());
}
void OnClick(object sender, System.EventArgs e)
{
OpenFileDialog myFileDialog = new OpenFileDialog();
myFileDialog.Filter = "All Files (*.*)|*.*";
myFileDialog.Multiselect = false;
myFileDialog.RestoreDirectory = false;
myFileDialog.ShowDialog();
if (myFileDialog.FileName.Trim() != string.Empty)
{
this.button.Text = myFileDialog.FileName.Trim();
}
myFileDialog.Dispose();
myFileDialog = null;
}
}
}