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 ); } }
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 ); } }
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 ); } }