FileDialog.cs 1000 B

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