ToolSmudgeCircle.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using PaintDotNet.Annotation.Enum;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4. namespace PaintDotNet.Annotation.Label
  5. {
  6. /// <summary>
  7. /// 污迹处理->圆
  8. /// </summary>
  9. public class ToolSmudgeCircle : ToolObject
  10. {
  11. public static void OnMouseDown(ISurfaceBox drawArea, MouseEventArgs e)
  12. {
  13. if (e.Button == MouseButtons.Left)
  14. {
  15. Point p = GetEventPointInArea(drawArea, e.Location);
  16. DrawSmudgeCircle circle = new DrawSmudgeCircle(drawArea, p.X, p.Y, 1, 1);
  17. circle.ISurfaceBox = drawArea;
  18. AddNewObject(drawArea, circle);
  19. }
  20. }
  21. public static void OnMouseMove(ISurfaceBox drawArea, MouseEventArgs e)
  22. {
  23. Point pointscroll = GetEventPointInArea(drawArea, e.Location);
  24. if (e.Button == MouseButtons.Left)
  25. {
  26. drawArea.GraphicsList[0].MoveHandleTo(pointscroll, 5);
  27. drawArea.Refresh();
  28. drawArea.GraphicsList.Dirty = true;
  29. }
  30. }
  31. public static void OnMouseUp(ISurfaceBox drawArea, MouseEventArgs e)
  32. {
  33. if (e.Button == MouseButtons.Left)
  34. {
  35. if (!drawArea.ContinuousDrawingLabel())
  36. {
  37. drawArea.ActiveTool = DrawToolType.Pointer;
  38. }
  39. }
  40. }
  41. /// <summary>
  42. /// Remove selected object
  43. /// </summary>
  44. /// <param name="drawArea"></param>
  45. /// <param name="e"></param>
  46. public static void OnDel2KeyDown(ISurfaceBox drawArea, MouseEventArgs e)
  47. {
  48. if (drawArea != null && drawArea.GraphicsList != null && drawArea.GraphicsList.Count > 0)
  49. {
  50. for (int i = drawArea.GraphicsList.Count - 1; i >= 0; i--)
  51. {
  52. if (drawArea.GraphicsList[i].drawToolType == DrawToolType.DrawSmudgeCircle)
  53. {
  54. drawArea.GraphicsList.RemoveObj(drawArea.GraphicsList[i]);
  55. }
  56. }
  57. drawArea.Refresh();
  58. }
  59. }
  60. public static void OnMouseClick(ISurfaceBox drawArea, MouseEventArgs e)
  61. {
  62. }
  63. /// <summary>
  64. /// 鼠标左键双击
  65. /// </summary>
  66. /// <param name="drawArea"></param>
  67. /// <param name="e"></param>
  68. public static void OnMouseLeftDoubleClick(ISurfaceBox surfacebox, MouseEventArgs e)
  69. {
  70. }
  71. /// <summary>
  72. /// 删除按键
  73. /// </summary>
  74. /// <param name="surfacebox"></param>
  75. /// <param name="e"></param>
  76. public static void OnDelKeyDown(ISurfaceBox surfacebox, MouseEventArgs e)
  77. {
  78. }
  79. /// <summary>
  80. /// 清空全部时调用该方法,将可能未绘制完的对象清空
  81. /// </summary>
  82. public static void beginWithNewObject()
  83. {
  84. }
  85. }
  86. }