ColorRectangleControl.cs 782 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Drawing;
  2. using System.Windows.Forms;
  3. namespace PaintDotNet
  4. {
  5. internal class ColorRectangleControl : UserControl
  6. {
  7. private Color rectangleColor;
  8. public Color RectangleColor
  9. {
  10. get
  11. {
  12. return rectangleColor;
  13. }
  14. set
  15. {
  16. rectangleColor = value;
  17. Invalidate(true);
  18. }
  19. }
  20. public ColorRectangleControl()
  21. {
  22. this.ResizeRedraw = true;
  23. this.DoubleBuffered = true;
  24. }
  25. protected override void OnPaint(PaintEventArgs e)
  26. {
  27. Utility.DrawColorRectangle(e.Graphics, this.ClientRectangle, rectangleColor, true);
  28. base.OnPaint(e);
  29. }
  30. }
  31. }