ToolOpticalDensityLine.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using PaintDotNet.Annotation.Enum;
  2. using PaintDotNet.Annotation.Other;
  3. using System.Drawing;
  4. using System.Resources;
  5. using System.Windows.Forms;
  6. namespace PaintDotNet.Annotation.Label
  7. {
  8. /// <summary>
  9. /// 光密度测量直线
  10. /// </summary>
  11. public class ToolOpticalDensityLine : ToolObject
  12. {
  13. private static OpticalDensityLine line;
  14. public ToolOpticalDensityLine(ISurfaceBox surface)
  15. {
  16. Cursor = new Cursor(PdnResources.GetResourceStream("Cursors.AnnotationLine.cur"));
  17. }
  18. public static void OnMouseDown(ISurfaceBox drawArea, MouseEventArgs e)
  19. {
  20. if (e.Button == MouseButtons.Left)
  21. {
  22. Point pointscroll = GetEventPointInArea(drawArea, e.Location);
  23. line = new OpticalDensityLine(drawArea, pointscroll.X, pointscroll.Y, pointscroll.X + 1, pointscroll.Y + 1);
  24. line.ISurfaceBox = drawArea;
  25. AddNewObject(drawArea, line);
  26. }
  27. else
  28. {
  29. line = null;
  30. drawArea.ActiveTool = DrawToolType.Pointer;
  31. }
  32. }
  33. public static void OnMouseMove(ISurfaceBox drawArea, MouseEventArgs e)
  34. {
  35. if (e.Button == MouseButtons.Left)
  36. {
  37. Point pointscroll = GetEventPointInArea(drawArea, e.Location);
  38. if (drawArea.GraphicsList[0] != null)
  39. {
  40. drawArea.GraphicsList[0].MoveHandleTo(pointscroll, 2);
  41. drawArea.Refresh();
  42. drawArea.GraphicsList.Dirty = true;
  43. }
  44. }
  45. }
  46. public static void OnMouseUp(ISurfaceBox drawArea, MouseEventArgs e)
  47. {
  48. if (e.Button == MouseButtons.Left)
  49. {
  50. if (!drawArea.ContinuousDrawingLabel())
  51. {
  52. drawArea.ActiveTool = DrawToolType.Pointer;
  53. }
  54. }
  55. }
  56. public static void OnMouseClick(ISurfaceBox drawArea, MouseEventArgs e)
  57. {
  58. }
  59. /// <summary>
  60. /// 鼠标左键双击
  61. /// </summary>
  62. /// <param name="drawArea"></param>
  63. /// <param name="e"></param>
  64. public static void OnMouseLeftDoubleClick(ISurfaceBox surfacebox, MouseEventArgs e)
  65. {
  66. }
  67. /// <summary>
  68. /// 删除按键
  69. /// </summary>
  70. /// <param name="surfacebox"></param>
  71. /// <param name="e"></param>
  72. public static void OnDelKeyDown(ISurfaceBox surfacebox, MouseEventArgs e)
  73. {
  74. }
  75. /// <summary>
  76. /// 删除划痕处理&污迹处理选择区域的痕迹
  77. /// </summary>
  78. /// <param name="surfacebox"></param>
  79. /// <param name="e"></param>
  80. public static void OnDel2KeyDown(ISurfaceBox surfacebox, MouseEventArgs e)
  81. {
  82. }
  83. /// <summary>
  84. /// 清空全部时调用该方法,将可能未绘制完的对象清空
  85. /// </summary>
  86. public static void beginWithNewObject()
  87. {
  88. }
  89. }
  90. }