* Simple test app for FileDialog
svn path=/trunk/winforms/; revision=45029
This commit is contained in:
Родитель
3986b13e68
Коммит
7c1a66245d
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче