ToolLocationCross.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Forms;
  8. using PaintDotNet.Annotation.Enum;
  9. namespace PaintDotNet.Annotation.ImageCollect
  10. {
  11. public class ToolLocationCross : ToolObject
  12. {
  13. private static Cursor cursor = new Cursor(PdnResources.GetResourceStream("Cursors.AnnotationRectangle.cur"));
  14. public static void CreateLocationCross(ISurfaceBox drawArea, int x, int y, int width, int height, int z)
  15. {
  16. Point pointscroll = GetEventPointInArea(drawArea, new Point(x, y));
  17. DrawLocationCross rectangle = new DrawLocationCross(drawArea, (int)pointscroll.X, (int)pointscroll.Y, width, height, z);
  18. rectangle.ISurfaceBox = drawArea;
  19. AddNewObject(drawArea, rectangle);
  20. drawArea.ActiveTool = DrawToolType.Pointer;
  21. rectangle.Selected = true;
  22. }
  23. public static void OnMouseDown(ISurfaceBox drawArea, MouseEventArgs e)
  24. {
  25. if (e.Button == MouseButtons.Left)
  26. {
  27. float width = drawArea.GetDocumentSize().Width;
  28. float height = drawArea.GetDocumentSize().Height;
  29. Point pointscroll = GetEventPointInArea(drawArea, e.Location);
  30. DrawLocationCross rectangle = new DrawLocationCross(drawArea, pointscroll.X, pointscroll.Y, (int)width, (int)height, 0);
  31. rectangle.ISurfaceBox = drawArea;
  32. AddNewObject(drawArea, rectangle);
  33. }
  34. }
  35. public static void OnMouseMove(ISurfaceBox drawArea, MouseEventArgs e)
  36. {
  37. Point pointscroll = GetEventPointInArea(drawArea, e.Location);
  38. //drawArea.Cursor = Cursor;
  39. if (e.Button == MouseButtons.Left)
  40. {
  41. drawArea.GraphicsList[0].MoveHandleTo(pointscroll, 5);
  42. drawArea.Refresh();
  43. drawArea.GraphicsList.Dirty = true;
  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. OnMouseUpTwo(drawArea, e);
  55. }
  56. }
  57. public static void OnMouseClick(ISurfaceBox surfacebox, MouseEventArgs e)
  58. {
  59. }
  60. /// <summary>
  61. /// 鼠标左键双击
  62. /// </summary>
  63. /// <param name="drawArea"></param>
  64. /// <param name="e"></param>
  65. public static void OnMouseLeftDoubleClick(ISurfaceBox surfacebox, MouseEventArgs e)
  66. {
  67. ToolPointer.OnMouseLeftDoubleClick(surfacebox, e);
  68. }
  69. /// <summary>
  70. /// 删除按键
  71. /// </summary>
  72. /// <param name="surfacebox"></param>
  73. /// <param name="e"></param>
  74. public static void OnDelKeyDown(ISurfaceBox surfacebox, MouseEventArgs e)
  75. {
  76. }
  77. /// <summary>
  78. /// 删除划痕处理&污迹处理选择区域的痕迹
  79. /// </summary>
  80. /// <param name="surfacebox"></param>
  81. /// <param name="e"></param>
  82. public static void OnDel2KeyDown(ISurfaceBox surfacebox, MouseEventArgs e)
  83. {
  84. }
  85. public static void beginWithNewObject()
  86. {
  87. }
  88. }
  89. }