Inheritance: NonClientPaintEventArgs
示例#1
0
        internal protected virtual void OnPaint(VisualStudioButtonPaintEventArgs e)
        {
            var ev = Paint;

            if (ev != null)
            {
                ev(this, e);
            }
        }
            void chromeButton_Paint(object sender, VisualStudioButtonPaintEventArgs e)
            {
                var chromeButton = (VisualStudioButton)sender;
                var button = (TitleBarButton)chromeButton.Tag;

                if (chromeButton.Enabled && !chromeButton.IsOver && !chromeButton.IsDown && button.BackColor.HasValue)
                {
                    using (var brush = new SolidBrush(button.BackColor.Value))
                    {
                        e.Graphics.FillRectangle(brush, e.Bounds);
                    }
                }
                else
                {
                    e.PaintBackground();
                }

                if (button.Image != null)
                {
                    Bitmap image;

                    if (!chromeButton.Enabled)
                        image = button.DisabledImage;
                    else if (chromeButton.IsOver)
                        image = button.OverImage;
                    else if (chromeButton.IsDown)
                        image = button.DownImage;
                    else
                        image = button.EnabledImage;

                    e.Graphics.DrawImageUnscaled(
                        image,
                        e.Bounds.Left + ButtonImageOffset.X,
                        e.Bounds.Top + ButtonImageOffset.Y
                    );
                }
            }
 protected internal virtual void OnPaint(VisualStudioButtonPaintEventArgs e)
 {
     var ev = Paint;
     if (ev != null)
         ev(this, e);
 }