ColorRectangleControl.cs 1007 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using SmartCoalApplication.Core;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace SmartCoalApplication.PluginAssemblys
  12. {
  13. internal class ColorRectangleControl : UserControl
  14. {
  15. private Color rectangleColor;
  16. public Color RectangleColor
  17. {
  18. get
  19. {
  20. return rectangleColor;
  21. }
  22. set
  23. {
  24. rectangleColor = value;
  25. Invalidate(true);
  26. }
  27. }
  28. public ColorRectangleControl()
  29. {
  30. this.ResizeRedraw = true;
  31. this.DoubleBuffered = true;
  32. }
  33. protected override void OnPaint(PaintEventArgs e)
  34. {
  35. Utility.DrawColorRectangle(e.Graphics, this.ClientRectangle, rectangleColor, true);
  36. base.OnPaint(e);
  37. }
  38. }
  39. }