コード例 #1
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            CalculateBounds(e);

            foreach (ToolButton tool in tools)
            {
                PaintLibrary.Button(e, tool.Bounds.Location, tool.Bounds.Size, tool.Text, highlightedButton == tool);
            }
        }
コード例 #2
0
        protected override void CalculateBounds(System.Windows.Forms.PaintEventArgs e)
        {
            if (tools.Count == 1)
            {
                PaintLibrary.Button(e, new Point(0, 0), Size, this.Text, highlightedButton == tools[0]);
            }
            else if (tools.Count > 1)
            {
                const int PADDING = 4;

                Size  size     = new Size((Size.Width / tools.Count) - PADDING, Size.Height);
                Point location = new Point(0, 0);

                foreach (ToolButton tool in tools)
                {
                    tool.Bounds = new Rectangle(location, size);
                    location.X += PADDING + size.Width;
                }
            }
        }
コード例 #3
0
 protected override void OnPaint(System.Windows.Forms.PaintEventArgs pe)
 {
     base.OnPaint(pe);
     PaintLibrary.Button(pe, new Point(0, 0), this.Size, this.Text, false);
 }