FileDialog.cs 911 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // System.Windows.Forms.FileDialog
  3. //
  4. // Author:
  5. // Joel Basson ([email protected])
  6. //
  7. //
  8. using System.Drawing;
  9. namespace System.Windows.Forms {
  10. /// <summary>
  11. /// Represents a Windows File Dialog.
  12. ///
  13. /// </summary>
  14. public class FileDialog: Control{
  15. String name1;
  16. Gtk.FileSelection file1 = new Gtk.FileSelection("");
  17. public FileDialog () : base () {
  18. }
  19. public void ShowDialog () {
  20. //Gtk.FileSelection file1 = new Gtk.FileSelection("");
  21. file1.OkButton.Clicked += new EventHandler (file_selection_ok);
  22. file1.CancelButton.Clicked += new EventHandler (file_selection_cancel);
  23. file1.Show();
  24. }
  25. public string OpenFile {
  26. get {
  27. return name1;
  28. }
  29. }
  30. internal void file_selection_cancel (object o, EventArgs args){
  31. file1.Hide();
  32. }
  33. internal void file_selection_ok (object o, EventArgs args){
  34. name1 = file1.Filename;
  35. file1.Hide();
  36. }
  37. }
  38. }