C#实现流程图设计器

2019-12-30 11:10:40王冬梅
  • PointF p1 = new PointF(x, 0);  PointF p2 = new PointF(x, Height); 
  • g.DrawLine(p, p1, p2);  } 
  •   for (int y = 0; y <= panel1.Height; y = y + 20) 
  • {  PointF p1 = new PointF(0, y); 
  • PointF p2 = new PointF(Width, y);  g.DrawLine(p, p1, p2); 
  •   } 
  •   } 

    下面给出在panel1上进行鼠标单击的处理程序:

     

    1. private void panel1_MouseClick(object sender, MouseEventArgs e)  { 
    2. int X = e.X;  int Y = e.Y; 
    3. if (this.__gObjType== "")  { 
    4. return;  } 
    5. if (this.__gObjType != "Line")  { 
    6. AddObjectFromMouseLocation(X, Y, 0, 0, this.__gObjType);  } 
    7. else  { 
    8. //line  if (__lineMouseClickedCount == 1) 
    9. {  __lineX2 = e.X; 
    10. __lineY2 = e.Y;  AddObjectFromMouseLocation(__lineX1, __lineY1, __lineX2, __lineY2, this.__gObjType); 
    11.   //连接线方向判断 
    12. __lineMouseClickedCount = 0;  __lineX1 = 0; 
    13. __lineY1 = 0;  __lineX2 = 0; 
    14. __lineY2 = 0;  } 
    15. else if (__lineMouseClickedCount == 0)  {