ToolRectangle.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using Resources;
  2. using SmartCoalApplication.Annotation.Enum;
  3. using System.Drawing;
  4. using System.Windows.Forms;
  5. namespace SmartCoalApplication.Annotation.Label
  6. {
  7. /// <summary>
  8. /// 标注->多边形->矩形
  9. /// </summary>
  10. public class ToolRectangle : ToolObject
  11. {
  12. private static Cursor cursor = new Cursor(PdnResources.GetResourceStream("Cursors.AnnotationRectangle.cur"));
  13. public static void OnMouseDown(ISurfaceBox drawArea, MouseEventArgs e)
  14. {
  15. if (e.Button == MouseButtons.Left)
  16. {
  17. Point pointscroll = GetEventPointInArea(drawArea, e.Location);
  18. DrawRectangle rectangle = new DrawRectangle(drawArea, pointscroll.X, pointscroll.Y, 1, 1);
  19. rectangle.ISurfaceBox = drawArea;
  20. AddNewObject(drawArea, rectangle);
  21. }
  22. else {
  23. OnMouseNotLeftDown(drawArea, null);
  24. }
  25. }
  26. public static void OnMouseMove(ISurfaceBox drawArea, MouseEventArgs e)
  27. {
  28. Point pointscroll = GetEventPointInArea(drawArea, e.Location);
  29. //drawArea.Cursor = Cursor;
  30. if (e.Button == MouseButtons.Left)
  31. {
  32. drawArea.GraphicsList[0].MoveHandleTo(pointscroll, 5);
  33. drawArea.Refresh();
  34. drawArea.GraphicsList.Dirty = true;
  35. }
  36. }
  37. public static void OnMouseUp(ISurfaceBox drawArea, MouseEventArgs e)
  38. {
  39. if (e.Button == MouseButtons.Left)
  40. {
  41. //if (!drawArea.ContinuousDrawingLabel())
  42. //{
  43. // drawArea.ActiveTool = DrawToolType.Pointer;
  44. //}
  45. OnMouseUpTwo(drawArea, e);
  46. }
  47. }
  48. public static void OnMouseClick(ISurfaceBox surfacebox, MouseEventArgs e)
  49. {
  50. }
  51. /// <summary>
  52. /// 鼠标左键双击
  53. /// </summary>
  54. /// <param name="drawArea"></param>
  55. /// <param name="e"></param>
  56. public static void OnMouseLeftDoubleClick(ISurfaceBox surfacebox, MouseEventArgs e)
  57. {
  58. }
  59. /// <summary>
  60. /// 删除按键
  61. /// </summary>
  62. /// <param name="surfacebox"></param>
  63. /// <param name="e"></param>
  64. public static void OnDelKeyDown(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 OnDel2KeyDown(ISurfaceBox surfacebox, MouseEventArgs e)
  73. {
  74. }
  75. public static void beginWithNewObject()
  76. {
  77. }
  78. }
  79. }