FlowDisposal.cs
上传用户:yhzmled
上传日期:2014-08-04
资源大小:35k
文件大小:7k
源码类别:

xml/soap/webservice

开发平台:

C#

  1. /*
  2.  *author: l_dragon  email:l_dragon2000@163.com
  3.  * last update:2003/04/03
  4.  * */
  5. using System;
  6. using System.Collections;
  7. using System.ComponentModel;
  8. using System.Drawing;
  9. using System.Data;
  10. using System.Windows.Forms;
  11. namespace gdiFlow
  12. {
  13. /// <summary>
  14. /// FlowDisposal 的摘要说明。
  15. /// </summary>
  16. public class FlowDisposal
  17. {
  18. public Double dblDisposalId=0;//处理过程ID, DISPOSAL_ID
  19. public Double dblFlowId;//流程ID,FLOW_ID
  20. public String strDisposalHint;//处理过程提示,DISPOSAL_HINT
  21.     public String strDisposalName;//处理过程名称,DISPOSAL_NAME  
  22. public Double dblTransactStatusId;//经办状态,TRANSACT_STATUS_ID   
  23. public int intGroupLimit;//组限制,GROUP_LIMIT  
  24. public Double dblCurStatusId;//当前环节ID,CUR_STATUS_ID
  25.     public Double dblPreStatusId;//上环节ID, PRE_STATUS_ID
  26.     public int intCurX;//X坐标,CUR_X 
  27. public int intCurY;//Y坐标,CUR_Y
  28. public int x1,y1,x2,y2;//画线的两个处理对象的坐标
  29. public bool blDisplay=true;//是否显示,为false不显示
  30. public System.Windows.Forms.Label lbDispName;//lable标签,默认为为处理的名称
  31. private int intMouseDownX;
  32. private int intMouseDownY;//鼠标在lable上按下的坐标
  33. public int intlblw=50;//lable的宽度
  34. public int intlblh=25;//lbale的高度
  35. private System.Windows.Forms.ContextMenu menuDisp;
  36. private System.Windows.Forms.MenuItem menuDel;
  37. private System.Windows.Forms.MenuItem menuSet;//lable标签对应的操作菜单
  38. public int intFormW;//画板的宽度,传递进来后防止lable出界
  39. public int intFormH;//画板的高度,传递进来后防止lable出界
  40. public bool blCanMove=false;//lable是否可以移动
  41. public System.Collections.ArrayList aryDisp=new ArrayList();//FlowMap的aryDisposal,用来在lable选择删除时,删除相应的Disposal对象
  42. public System.Collections.ArrayList aryStatusObjs=new ArrayList();///FlowMap的aryDisposal,用来设置处理的经办状态;
  43. public FlowStatus transactStatus;//经办状态对象;
  44. public FlowDisposal(FlowStatus objFrom, FlowStatus objTo)
  45. { int x1=objFrom._x+Convert.ToInt32(objFrom._w/2);
  46.             int y1=objFrom._y+Convert.ToInt32(objFrom._h/2);
  47. int x2=objTo._x+Convert.ToInt32(objTo._w/2);
  48. int y2=objTo._y+Convert.ToInt32(objTo._h/2); this.x1=x1; this.y1=y1; this.x2=x2; this.y2=y2; int intCenterX=Convert.ToInt32((x1+x2)/2); int intCenterY=Convert.ToInt32((y1+y2)/2); this.intCurX=intCenterX; this.intCurY=intCenterY; this.dblPreStatusId=objFrom.dblStatusId; this.dblCurStatusId=objTo.dblStatusId; this.setLabelProp(); } public FlowDisposal()//从xml生成空Disposal对象
  49. { }
  50. public void setLabelProp()//设置label的属性
  51. {
  52. this.lbDispName=new System.Windows.Forms.Label(); this.lbDispName.Location = new System.Drawing.Point(this.intCurX-Convert.ToInt32(this.intlblw/2) , this.intCurY-Convert.ToInt32(this.intlblh/2) ); this.lbDispName.Size = new System.Drawing.Size(this.intlblw, this.intlblh); this.lbDispName.Font=new System.Drawing.Font("宋体", 9F); this.lbDispName.Text=strDisposalName; this.lbDispName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lbDispName.MouseDown += new System.Windows.Forms.MouseEventHandler(lbl_MouseDown);
  53. this.lbDispName.MouseMove+=new System.Windows.Forms.MouseEventHandler(lbl_MouseMove);
  54. this.lbDispName.MouseUp+=new System.Windows.Forms.MouseEventHandler(lbl_MouseUp);
  55. //设置标签的右键菜单
  56. this.menuDisp=new System.Windows.Forms.ContextMenu();
  57. this.menuDel=new  System.Windows.Forms.MenuItem() ;
  58. this.menuSet=new  System.Windows.Forms.MenuItem();
  59. this.menuDel.Text="删除";
  60. this.menuDel.Click += new System.EventHandler(this.menuDel_Click);
  61. this.menuSet.Text="属性";
  62. this.menuSet.Click += new System.EventHandler(this.menuSet_Click);
  63. this.menuDisp.MenuItems.Add(menuDel);
  64. this.menuDisp.MenuItems.Add("-");  
  65. this.menuDisp.MenuItems.Add(menuSet); this.lbDispName.ContextMenu=this.menuDisp;
  66. }
  67. public  void getFormwh(int intW,int intH)//得到FlowMap Form的高度和宽度
  68. { this.intFormW=intW; this.intFormH=intH;  }
  69. private void lbl_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
  70. {
  71.  this.intMouseDownX=this.intCurX-e.X;
  72.  this.intMouseDownY=this.intCurY-e.Y; 
  73.  this.blCanMove=true;
  74. }
  75. private void lbl_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
  76. {
  77. if(this.blCanMove)
  78. {
  79. this.intCurX=this.intMouseDownX+e.X;
  80. this.intCurY=this.intMouseDownY+e.Y; 
  81. //this.lbDispName.Location=new Point(this.intCurX-Convert.ToInt32(this.intlblw/2) , this.intCurY-Convert.ToInt32(this.intlblh/2) );
  82. // this.lbDispName.Refresh();
  83. }
  84. }
  85. private void lbl_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
  86. {
  87. this.intCurX=this.intMouseDownX+e.X;
  88. this.intCurY=this.intMouseDownY+e.Y; 
  89. this.lbDispName.Location=new Point(this.intCurX-Convert.ToInt32(this.intlblw/2) , this.intCurY-Convert.ToInt32(this.intlblh/2) );
  90. checkPosition(lbDispName,this.intFormW,this.intFormH); 
  91. this.intCurX=lbDispName.Left+Convert.ToInt32(this.intlblw/2);
  92. this.intCurY=lbDispName.Top+Convert.ToInt32(this.intlblh/2);
  93. this.blCanMove=false;
  94. }
  95. //让lable始终在画板内,intFormW为画板的宽度,intFormH为画板的高度
  96. public  void checkPosition(System.Windows.Forms.Label  objLable,int intFormW,int intFormH)
  97. {
  98. int w = intFormW;
  99. int h = intFormH;
  100. int new_x = objLable.Left;
  101. int new_y = objLable.Top;
  102. int lblW=objLable.Width;;
  103. int lblH=objLable.Height;
  104. if((objLable.Left+lblW)>w)
  105. {
  106. new_x = (int)w-lblW;
  107. }
  108. if(objLable.Left< 0)
  109. {
  110. new_x = 0;
  111. }
  112. if((objLable.Top+lblH)>h)
  113. {
  114. new_y = (int)h-lblH;
  115. }
  116. if(objLable.Top < 0)
  117. {
  118. new_y = 0;
  119. }
  120. objLable.Left=new_x;
  121. objLable.Top=new_y;
  122. }
  123. private void menuDel_Click(object sender, System.EventArgs e)//删除一个处理对象
  124. {
  125. /* if(this.aryDisp.Count==0) return;
  126. foreach(Object item in this.aryDisp) 
  127. {
  128. FlowDisposal tempDisp=(FlowDisposal)item;
  129. if(tempDisp.Equals(this))
  130. {
  131. tempDisp.clearProperty(); 
  132.     return;
  133. }
  134. }
  135. */
  136.    this.clearProperty();
  137. }
  138. private void menuSet_Click(object sender, System.EventArgs e)//设置处理对象的属性
  139. {
  140.   frmDispSet frmSet=new frmDispSet();
  141.   frmSet.setThisDisposal(this);
  142.   frmSet.setAryStatus(this.aryStatusObjs); 
  143.   frmSet.setAryDisposal(this.aryDisp);
  144.   frmSet.MaximizeBox=false;
  145.   frmSet.MinimizeBox=false;
  146.   frmSet.ShowDialog(); 
  147. }
  148. /**
  149.  * 清除处理对象的所有属性
  150.  * 删除处理对象时,并不真正删除该对象,但是要清除其属性
  151.  * 
  152.  * */
  153. public void clearProperty() 
  154.  this.blDisplay=false;//是否显示,为false不显示
  155.     this.lbDispName.Visible=false;
  156.  strDisposalHint="";//处理过程提示,DISPOSAL_HINT
  157.      strDisposalName="";//处理过程名称,DISPOSAL_NAME  
  158.  dblTransactStatusId=0;//经办状态,TRANSACT_STATUS_ID   
  159.  intGroupLimit=0;//组限制,GROUP_LIMIT  
  160.  dblCurStatusId=-1;//当前环节ID,CUR_STATUS_ID
  161.      dblPreStatusId=-1;//上环节ID, PRE_STATUS_ID
  162.      intCurX=-1;//X坐标,CUR_X 
  163.  intCurY=-1;//Y坐标,CUR_Y
  164.  blCanMove=false;//lable是否可以移动
  165.      //aryDisp=null;
  166.   
  167. }
  168. }
  169. }