예제 #1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            const int image_size = 32; //square image

            if (_selectedColors == null)
            {
                CreateColor();
            }

            Graphics g = e.Graphics;

            if (_selected)
            {
                DrawUtil.DrawRoundRect(g, 0, 0, this.Width - 1, this.Height - 1, _selectedColors);
            }
            else if (_hilight)
            {
                DrawUtil.DrawRoundRect(g, 0, 0, this.Width - 1, this.Height - 1, _hilightColors);
            }
            g.DrawImage(_image, (this.Width - image_size) / 2, 0);
            SizeF sz = g.MeasureString(_caption, this.Font);

            g.DrawString(_caption, this.Font, _textBrush, (int)(this.Width - sz.Width) / 2, image_size);
        }