예제 #1
0
        public override Size2i GetNaturalSize()
        {
            System.Drawing.Size s = System.Windows.Forms.TextRenderer.MeasureText(Caption, button.Font);

            //special case:empty caption
            if (s.Height == 0)
            {
                s.Height = System.Windows.Forms.TextRenderer.MeasureText("W", button.Font).Height;
            }

            if (button.Image != null)
            {
                s.Height = Math.Max(s.Height, button.Image.Height);
                s.Width += button.Image.Width;
            }


            s.Width  += System.Windows.Forms.SystemInformation.Border3DSize.Height * 2;
            s.Height += System.Windows.Forms.SystemInformation.Border3DSize.Width * 2;

            s.Width  += 12;
            s.Height += 6;

            return(WinFormsDriver.ConvertSize(s));
        }
예제 #2
0
        public WinFormsImageLabel(Widget shellobject, Image img) : base(shellobject)
        {
            label     = new System.Windows.Forms.Label();
            label.Tag = shellobject; //map-back from native control to guppy object

            label.Image = WinFormsDriver.ImageToWinFormsImage(img);
        }
예제 #3
0
        public override Size2i GetNaturalSize()
        {
            Size2i res = WinFormsDriver.ConvertSize(checkbox.PreferredSize);

            return(res);

            //return WinFormsDriver.ConvertSize(checkbox.PreferredSize); // GetPreferredSize(Size.Empty);
        }
예제 #4
0
 public override Size2i GetNaturalSize()
 {
     if (vertical)
     {
         return(WinFormsDriver.ConvertSize(new System.Drawing.Size(septhickness, 16)));
     }
     else
     {
         return(WinFormsDriver.ConvertSize(new System.Drawing.Size(16, septhickness)));
     }
 }
예제 #5
0
        /*
         * void textbox_TextChanged(object sender, System.EventArgs e)
         * {
         * new EventData(ShellObject, EventID.Changed, true).Send();
         * }*/


        public override Size2i GetNaturalSize()
        {
            if (textbox.Multiline)
            {
                return(new Size2i(50, 50));
            }
            else
            {
                System.Drawing.Size s = textbox.PreferredSize;
                s.Width = GuppyGUI.Guppy.DefaultEditWidth;
                return(WinFormsDriver.ConvertSize(s));
            }
        }
예제 #6
0
        public WinFormsMenuItem(Widget shellobject, string caption, Image image, MenuFlags flags)
            : base(shellobject)
        {
            if ((flags & MenuFlags.Separator) != 0)
            {
                item     = new System.Windows.Forms.ToolStripSeparator();
                item.Tag = shellobject; //map-back from native control to guppy object

                return;                 //no events for separator
            }
            else
            {
                System.Windows.Forms.ToolStripMenuItem mi = new System.Windows.Forms.ToolStripMenuItem();
                mi.Tag = shellobject; //map-back from native control to guppy object

                item            = mi;
                mi.Image        = WinFormsDriver.ImageToWinFormsImage(image);
                mi.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;

                //parse shortkey text
                if (caption == null)
                {
                    caption = "";
                }
                string[] capts = caption.Split('\t');
                if (capts.Length > 0)
                {
                    mi.Text = capts[0];
                }
                if (capts.Length > 1)
                {
                    mi.ShortcutKeyDisplayString = capts[1];
                }

                if ((flags & MenuFlags.Checkable) != 0)
                {
                    mi.CheckOnClick = true;
                    mi.CheckState   = (((flags & MenuFlags.Checked) != 0) ? System.Windows.Forms.CheckState.Checked : System.Windows.Forms.CheckState.Unchecked);
                }
            }

            item.Click += delegate { ((MenuItem)ShellObject).OnClicked(); };
        }
예제 #7
0
 public override Size2i GetNaturalSize()
 {
     return(WinFormsDriver.ConvertSize(radiobtn.PreferredSize)); // GetPreferredSize(Size.Empty);
 }
예제 #8
0
 public override Size2i GetNaturalSize()
 {
     return(WinFormsDriver.ConvertSize(label.PreferredSize)); // label.GetPreferredSize(Size.Empty);
 }