ToolStitchingRectangle.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. using PaintDotNet.Annotation.Label;
  10. namespace PaintDotNet.Annotation.ImageCollect
  11. {
  12. public class ToolStitchingRectangle : ToolObject
  13. {
  14. private static Cursor cursor = new Cursor(PdnResources.GetResourceStream("Cursors.AnnotationRectangle.cur"));
  15. public static void CreateRectangle(ISurfaceBox drawArea, int x, int y, int width, int height)
  16. {
  17. Point pointscroll = GetEventPointInArea(drawArea, new Point(x,y));
  18. DrawStitchingRectangle rectangle = new DrawStitchingRectangle(drawArea, (int)pointscroll.X, (int)pointscroll.Y, width, height);
  19. rectangle.ISurfaceBox = drawArea;
  20. AddNewObject(drawArea, rectangle);
  21. drawArea.ActiveTool = DrawToolType.Pointer;
  22. rectangle.Selected = true;
  23. }
  24. public static void OnMouseDown(ISurfaceBox drawArea, MouseEventArgs e)
  25. {
  26. if (e.Button == MouseButtons.Left)
  27. {
  28. Point pointscroll = GetEventPointInArea(drawArea, e.Location);
  29. DrawStitchingRectangle rectangle = new DrawStitchingRectangle(drawArea, pointscroll.X, pointscroll.Y, 1, 1);
  30. rectangle.ISurfaceBox = drawArea;
  31. AddNewObject(drawArea, rectangle);
  32. }
  33. }
  34. public static void OnMouseMove(ISurfaceBox drawArea, MouseEventArgs e)
  35. {
  36. Point pointscroll = GetEventPointInArea(drawArea, e.Location);
  37. //drawArea.Cursor = Cursor;
  38. if (e.Button == MouseButtons.Left)
  39. {
  40. drawArea.GraphicsList[0].MoveHandleTo(pointscroll, 5);
  41. drawArea.Refresh();
  42. drawArea.GraphicsList.Dirty = true;
  43. }
  44. }
  45. public static void OnMouseUp(ISurfaceBox drawArea, MouseEventArgs e)
  46. {
  47. if (e.Button == MouseButtons.Left)
  48. {
  49. if (!drawArea.ContinuousDrawingLabel())
  50. {
  51. drawArea.ActiveTool = DrawToolType.Pointer;
  52. }
  53. OnMouseUpTwo(drawArea, e);
  54. }
  55. }
  56. public static void OnMouseClick(ISurfaceBox surfacebox, 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. Console.WriteLine("鼠标左键双击");
  67. }
  68. /// <summary>
  69. /// 删除按键
  70. /// </summary>
  71. /// <param name="surfacebox"></param>
  72. /// <param name="e"></param>
  73. public static void OnDelKeyDown(ISurfaceBox surfacebox, MouseEventArgs e)
  74. {
  75. }
  76. /// <summary>
  77. /// 删除划痕处理&污迹处理选择区域的痕迹
  78. /// </summary>
  79. /// <param name="surfacebox"></param>
  80. /// <param name="e"></param>
  81. public static void OnDel2KeyDown(ISurfaceBox surfacebox, MouseEventArgs e)
  82. {
  83. }
  84. public static void beginWithNewObject()
  85. {
  86. }
  87. }
  88. }