Author: jordi
Date: 2006-05-20 12:08:46 -0400 (Sat, 20 May 2006)
New Revision: 60890

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintDialog.cs
Log:
2006-05-20  Jordi Mas i Hernandez <[EMAIL PROTECTED]>

        * PrintDialog.cs: Implements printer details



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-05-20 15:58:22 UTC (rev 60889)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-05-20 16:08:46 UTC (rev 60890)
@@ -1,3 +1,7 @@
+2006-05-20  Jordi Mas i Hernandez <[EMAIL PROTECTED]>
+
+       * PrintDialog.cs: Implements printer details
+
 2006-05-19  Alexander Olk  <[EMAIL PROTECTED]>
 
        * FileDialog.cs: Added focus handling for PopupButtonPanel.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintDialog.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintDialog.cs   
2006-05-20 15:58:22 UTC (rev 60889)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PrintDialog.cs   
2006-05-20 16:08:46 UTC (rev 60890)
@@ -66,6 +66,10 @@
                private CheckBox chkbox_print;
                private NumericUpDown updown_copies;
                private CheckBox chkbox_collate;
+               private Label label_status;
+               private Label label_type;
+               private Label label_where;
+               private Label label_comment;
 
                public PrintDialog ()
                {
@@ -222,7 +226,7 @@
                                txtFrom.Text = 
current_settings.FromPage.ToString ();
                                txtTo.Text = current_settings.ToPage.ToString 
();
                        }
-                       
+
                        updown_copies.Value = current_settings.Copies;
                        chkbox_collate.Enabled = (updown_copies.Value > 0) ? 
true : false;
 
@@ -230,6 +234,8 @@
                                ShowHelpButton ();
                        }
 
+                       SetPrinterDetails ();
+
                        return true;
                }
 
@@ -246,7 +252,7 @@
                                from = Int32.Parse (txtFrom.Text);
                                to = Int32.Parse (txtTo.Text);
                        }
-       
+
                        catch {
                                MessageBox.Show ("From/To values should be 
numeric", "Print",
                                                MessageBoxButtons.OK, 
MessageBoxIcon.Warning);
@@ -289,7 +295,7 @@
                                        }
                                }
                        }
-                       
+
                        current_settings.Copies = (short) updown_copies.Value;
                        current_settings.FromPage = from;
                        current_settings.ToPage = to;
@@ -310,7 +316,7 @@
                        if (help_button == null) {
                                help_button = new Button ();
 
-                               help_button.Anchor = 
((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right)));
+                               help_button.Anchor = 
((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left)));
                                help_button.FlatStyle = FlatStyle.System;
                                help_button.Location = new Point (20, 270);
                                help_button.Text = "&Help";
@@ -319,8 +325,8 @@
                        }
 
                        help_button.Visible = show_help;
-               }               
-               
+               }
+
                private void OnUpDownValueChanged (object sender, 
System.EventArgs e)
                {
                        chkbox_collate.Enabled = (updown_copies.Value > 0) ? 
true : false;
@@ -354,19 +360,57 @@
                        Label label = new Label ();
                        label.AutoSize = true;
                        label.Text = "&Name:";
-                       label.Location = new Point (20, 43);
+                       label.Location = new Point (20, 33);
                        form.Controls.Add (label);
 
                        label = new Label ();
-                       label.Text = "&Status:";
+                       label.Text = "Status:";
                        label.AutoSize = true;
-                       label.Location = new Point (20, 70);
+                       label.Location = new Point (20, 60);
                        form.Controls.Add (label);
 
+                       label_status = new Label ();
+                       label_status.AutoSize = true;
+                       label_status.Location = new Point (80, 60);
+                       form.Controls.Add (label_status);
+
+                       label = new Label ();
+                       label.Text = "Type:";
+                       label.AutoSize = true;
+                       label.Location = new Point (20, 80);
+                       form.Controls.Add (label);
+
+                       label_type = new Label ();
+                       label_type.AutoSize = true;
+                       label_type.Location = new Point (80, 80);
+                       form.Controls.Add (label_type);
+
+                       label = new Label ();
+                       label.Text = "Where:";
+                       label.AutoSize = true;
+                       label.Location = new Point (20, 100);
+                       form.Controls.Add (label);
+
+                       label_where = new Label ();
+                       label_where.AutoSize = true;
+                       label_where.Location = new Point (80, 100);
+                       form.Controls.Add (label_where);
+                       label = new Label ();
+
+                       label.Text = "Comment:";
+                       label.AutoSize = true;
+                       label.Location = new Point (20, 120);
+                       form.Controls.Add (label);
+
+                       label_comment = new Label ();
+                       label_comment.AutoSize = true;
+                       label_comment.Location = new Point (80, 120);
+                       form.Controls.Add (label_where);
+
                        GroupBox group_box_prn = new GroupBox ();
                        group_box_prn.Location = new Point (10, 8);
                        group_box_prn.Text = "Printer";
-                       group_box_prn.Size = new Size (400, 140);
+                       group_box_prn.Size = new Size (400, 145);
 
                        GroupBox group_box_range = new GroupBox ();
                        group_box_range.Location = new Point (10, 155);
@@ -428,7 +472,7 @@
                        form.Controls.Add (updown_copies);
                        updown_copies.ValueChanged += new System.EventHandler 
(OnUpDownValueChanged);
                        updown_copies.Size = new System.Drawing.Size (40, 20);
-                       
+
                        chkbox_collate = new CheckBox ();
                        chkbox_collate.Location = new Point (320, 210);
                        chkbox_collate.Text = "C&ollate";
@@ -446,8 +490,9 @@
                        // Printer combo
                        printer_combo = new ComboBox ();
                        printer_combo.DropDownStyle = 
ComboBoxStyle.DropDownList;
-                       printer_combo.Location = new Point (80, 42);
+                       printer_combo.Location = new Point (80, 32);
                        printer_combo.Width = 220;
+                       printer_combo.SelectedIndexChanged += new EventHandler 
(OnPrinterSelectedIndexChanged);
 
                        default_printer_settings = new PrinterSettings ();
                        for (int i = 0; i < installed_printers.Count; i++) {
@@ -465,6 +510,46 @@
                        form.Controls.Add (group_box_prn);
                        form.Controls.Add (group_box_range);
                        form.ResumeLayout (false);
-               }               
+               }
+
+               private void OnPrinterSelectedIndexChanged (object sender,  
System.EventArgs e)
+               {                       
+                       SetPrinterDetails ();
+               }
+
+               private void SetPrinterDetails ()
+               {
+                       try
+                       {
+                               string printer, port = string.Empty, type = 
string.Empty;
+                               string status = string.Empty, comment = 
string.Empty;
+                               Type sysprn = Type.GetType 
("System.Drawing.Printing.SysPrn, System.Drawing");
+                               MethodInfo dlg_info = sysprn.GetMethod 
("GetPrintDialogInfo", BindingFlags.Static | BindingFlags.NonPublic);
+
+                               printer = (string) printer_combo.SelectedItem;
+
+                               if (printer != null) {
+                                       object[] args  = new object [5];
+                                       args[0] = printer;
+                                       args[1] = port;
+                                       args[2] = type;
+                                       args[3] = status;
+                                       args[4] = comment;
+                                       dlg_info.Invoke (null, args);
+                                       port = (string) args[1];
+                                       type = (string) args[2];
+                                       status = (string) args[3];
+                                       comment = (string) args[4];
+                               }
+
+                               label_status.Text = status;
+                               label_type.Text = type;
+                               label_where.Text = port;
+                               label_comment.Text = comment;
+
+                       }
+                       catch  {
+                       }
+               }
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to