Example #1
0
            public static System.Windows.Forms.DialogResult ShowNumberBox(string title, string message, ref double number, double minimum, double maximum)
            {
                string defaultText = String.Empty;

                if (number != RhinoMath.UnsetValue)
                {
                    defaultText = number.ToString();
                }
                StringBoxForm dlg = new StringBoxForm(title, message, defaultText);

                dlg.SetAsNumberInput(minimum, maximum);
                System.Windows.Forms.DialogResult rc = dlg.ShowDialog(RhinoApp.MainWindow());
                if (rc == System.Windows.Forms.DialogResult.OK)
                {
                    string text = dlg.GetText();
                    double.TryParse(text, out number);
                }
                return(rc);
            }
Example #2
0
            public static System.Drawing.Rectangle[] StringBoxRects()
            {
                StringBoxForm dlg = new StringBoxForm("title", "message", "default_text");

                dlg.Show();
                dlg.Location = new System.Drawing.Point(0, 0);
                List <System.Drawing.Rectangle> rc = new List <System.Drawing.Rectangle>();

                rc.Add(dlg.Bounds);
                rc.Add(dlg.DisplayRectangle);
                rc.Add(dlg.ClientRectangle);
                for (int i = 0; i < dlg.Controls.Count; i++)
                {
                    System.Windows.Forms.Control ctrl = dlg.Controls[i];
                    rc.Add(ctrl.Bounds);
                    rc.Add(ctrl.DisplayRectangle);
                    rc.Add(ctrl.ClientRectangle);
                }
                dlg.Close();
                return(rc.ToArray());
            }
Example #3
0
 public static System.Windows.Forms.DialogResult ShowEditBox(string title, string message, string defaultText, bool multiline, out string text)
 {
     text = String.Empty;
     System.Windows.Forms.DialogResult rc;
     if (multiline)
     {
         EditBoxForm dlg = new EditBoxForm(title, message, defaultText);
         rc = dlg.ShowDialog(RhinoApp.MainWindow());
         if (rc == System.Windows.Forms.DialogResult.OK)
         {
             text = dlg.GetText();
         }
     }
     else
     {
         StringBoxForm dlg = new StringBoxForm(title, message, defaultText);
         rc = dlg.ShowDialog(RhinoApp.MainWindow());
         if (rc == System.Windows.Forms.DialogResult.OK)
         {
             text = dlg.GetText();
         }
     }
     return(rc);
 }
Example #4
0
 public static System.Windows.Forms.DialogResult ShowNumberBox(string title, string message, ref double number, double minimum, double maximum)
 {
   string default_text = String.Empty;
   if (number != RhinoMath.UnsetValue)
     default_text = number.ToString();
   StringBoxForm dlg = new StringBoxForm(title, message, default_text);
   dlg.SetAsNumberInput(minimum, maximum);
   System.Windows.Forms.DialogResult rc = dlg.ShowDialog(RhinoApp.MainWindow());
   if (rc == System.Windows.Forms.DialogResult.OK)
   {
     string text = dlg.GetText();
     double.TryParse(text, out number);
   }
   return rc;
 }
Example #5
0
 public static System.Drawing.Rectangle[] StringBoxRects()
 {
   StringBoxForm dlg = new StringBoxForm("title", "message", "default_text");
   dlg.Show();
   dlg.Location = new System.Drawing.Point(0, 0);
   List<System.Drawing.Rectangle> rc = new List<System.Drawing.Rectangle>();
   rc.Add(dlg.Bounds);
   rc.Add(dlg.DisplayRectangle);
   rc.Add(dlg.ClientRectangle);
   for (int i = 0; i < dlg.Controls.Count; i++)
   {
     System.Windows.Forms.Control ctrl = dlg.Controls[i];
     rc.Add(ctrl.Bounds);
     rc.Add(ctrl.DisplayRectangle);
     rc.Add(ctrl.ClientRectangle);
   }
   dlg.Close();
   return rc.ToArray();
 }
Example #6
0
 public static System.Windows.Forms.DialogResult ShowEditBox(string title, string message, string defaultText, bool multiline, out string text)
 {
   text = String.Empty;
   System.Windows.Forms.DialogResult rc;
   if (multiline)
   {
     EditBoxForm dlg = new EditBoxForm(title, message, defaultText);
     rc = dlg.ShowDialog(RhinoApp.MainWindow());
     if (rc == System.Windows.Forms.DialogResult.OK)
       text = dlg.GetText();
   }
   else
   {
     StringBoxForm dlg = new StringBoxForm(title, message, defaultText);
     rc = dlg.ShowDialog(RhinoApp.MainWindow());
     if (rc == System.Windows.Forms.DialogResult.OK)
       text = dlg.GetText();
   }
   return rc;
 }