Esempio n. 1
0
        void button_Paint(object sender, VisualStudioButtonPaintEventArgs e)
        {
            var button = (VisualStudioButton)sender;

            e.PaintBackground();

            using (var image = GetImage(button, e))
            {
                e.Graphics.DrawImageUnscaled(
                    image,
                    e.Bounds.Left + ButtonImageOffset.X,
                    e.Bounds.Top + ButtonImageOffset.Y
                    );
            }
        }
Esempio n. 2
0
        void button_Paint(object sender, VisualStudioButtonPaintEventArgs e)
        {
            var button = (VisualStudioButton)sender;

            e.PaintBackground();

            using (var image = GetImage(button, e))
            {
                e.Graphics.DrawImageUnscaled(
                    image,
                    e.Bounds.Left + ButtonImageOffset.X,
                    e.Bounds.Top + ButtonImageOffset.Y
                );
            }
        }
Esempio n. 3
0
            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
                        );
                }
            }
Esempio n. 4
0
        private Bitmap GetImage(VisualStudioButton button, VisualStudioButtonPaintEventArgs e)
        {
            var image = button.Enabled ? Resources.active : Resources.inactive;

            return(ImageUtil.GetImage(image, e.ForeColor));
        }
Esempio n. 5
0
 private Bitmap GetImage(VisualStudioButton button, VisualStudioButtonPaintEventArgs e)
 {
     var image = button.Enabled ? Resources.active : Resources.inactive;
     return ImageUtil.GetImage(image, e.ForeColor);
 }