ToolHandModeRuler.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using PaintDotNet.Annotation.Enum;
  2. using System;
  3. using System.Drawing;
  4. using System.Windows.Forms;
  5. namespace PaintDotNet.Annotation.Label
  6. {
  7. /// <summary>
  8. /// 标注->手动标尺
  9. /// </summary>
  10. public class ToolHandModeRuler : ToolObject
  11. {
  12. public static void OnMouseDown(ISurfaceBox drawArea, MouseEventArgs e)
  13. {
  14. if (e.Button == MouseButtons.Left)
  15. {
  16. Point pointscroll = GetEventPointInArea(drawArea, e.Location);
  17. DrawHandModeRuler handModeRulerDraw = new DrawHandModeRuler(drawArea, pointscroll.X, pointscroll.Y, pointscroll.X + 1, pointscroll.Y);
  18. handModeRulerDraw.ISurfaceBox = drawArea;
  19. AddNewObject(drawArea, handModeRulerDraw);
  20. }
  21. else {
  22. OnMouseNotLeftDown(drawArea, null);
  23. }
  24. }
  25. public static void OnMouseMove(ISurfaceBox drawArea, MouseEventArgs e)
  26. {
  27. if (e.Button == MouseButtons.Left)
  28. {
  29. Point pointscroll = GetEventPointInArea(drawArea, e.Location);
  30. if (e.Button == MouseButtons.Left)
  31. {
  32. if (drawArea.GraphicsList[0] != null)
  33. {
  34. drawArea.GraphicsList[0].MoveHandleTo(pointscroll, 2);
  35. drawArea.Refresh();
  36. drawArea.GraphicsList.Dirty = true;
  37. }
  38. }
  39. }
  40. }
  41. public static void OnMouseUp(ISurfaceBox drawArea, MouseEventArgs e)
  42. {
  43. if (e.Button == MouseButtons.Left)
  44. {
  45. if (!drawArea.ContinuousDrawingLabel())
  46. {
  47. drawArea.ActiveTool = DrawToolType.Pointer;
  48. }
  49. OnMouseUpTwo(drawArea, e);
  50. }
  51. }
  52. public static void OnMouseClick(ISurfaceBox drawArea, MouseEventArgs e)
  53. {
  54. }
  55. /// <summary>
  56. /// 鼠标左键双击
  57. /// </summary>
  58. /// <param name="drawArea"></param>
  59. /// <param name="e"></param>
  60. public static void OnMouseLeftDoubleClick(ISurfaceBox surfacebox, MouseEventArgs e)
  61. {
  62. }
  63. /// <summary>
  64. /// 删除按键
  65. /// </summary>
  66. /// <param name="surfacebox"></param>
  67. /// <param name="e"></param>
  68. public static void OnDelKeyDown(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 OnDel2KeyDown(ISurfaceBox surfacebox, MouseEventArgs e)
  77. {
  78. }
  79. public static void beginWithNewObject()
  80. {
  81. }
  82. }
  83. }