Permalink
Browse files

* Simple test app for FileDialog

svn path=/trunk/winforms/; revision=45029
  • Loading branch information...
1 parent 3986b13 commit 7c1a66245d67584f55f73cf1f116090766d8cafe Peter Dennis Bartok committed May 26, 2005
Showing with 61 additions and 0 deletions.
  1. +10 −0 filedialog/Makefile
  2. +51 −0 filedialog/swf-filedialog.cs
View
@@ -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;
+ }
+ }
+}

0 comments on commit 7c1a662

Please sign in to comment.