FlowDisposal.cs
资源名称:gdiFlow.rar [点击查看]
上传用户:yhzmled
上传日期:2014-08-04
资源大小:35k
文件大小:7k
源码类别:
xml/soap/webservice
开发平台:
C#
- /*
- *author: l_dragon email:l_dragon2000@163.com
- * last update:2003/04/03
- * */
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Windows.Forms;
- namespace gdiFlow
- {
- /// <summary>
- /// FlowDisposal 的摘要说明。
- /// </summary>
- public class FlowDisposal
- {
- public Double dblDisposalId=0;//处理过程ID, DISPOSAL_ID
- public Double dblFlowId;//流程ID,FLOW_ID
- public String strDisposalHint;//处理过程提示,DISPOSAL_HINT
- public String strDisposalName;//处理过程名称,DISPOSAL_NAME
- public Double dblTransactStatusId;//经办状态,TRANSACT_STATUS_ID
- public int intGroupLimit;//组限制,GROUP_LIMIT
- public Double dblCurStatusId;//当前环节ID,CUR_STATUS_ID
- public Double dblPreStatusId;//上环节ID, PRE_STATUS_ID
- public int intCurX;//X坐标,CUR_X
- public int intCurY;//Y坐标,CUR_Y
- public int x1,y1,x2,y2;//画线的两个处理对象的坐标
- public bool blDisplay=true;//是否显示,为false不显示
- public System.Windows.Forms.Label lbDispName;//lable标签,默认为为处理的名称
- private int intMouseDownX;
- private int intMouseDownY;//鼠标在lable上按下的坐标
- public int intlblw=50;//lable的宽度
- public int intlblh=25;//lbale的高度
- private System.Windows.Forms.ContextMenu menuDisp;
- private System.Windows.Forms.MenuItem menuDel;
- private System.Windows.Forms.MenuItem menuSet;//lable标签对应的操作菜单
- public int intFormW;//画板的宽度,传递进来后防止lable出界
- public int intFormH;//画板的高度,传递进来后防止lable出界
- public bool blCanMove=false;//lable是否可以移动
- public System.Collections.ArrayList aryDisp=new ArrayList();//FlowMap的aryDisposal,用来在lable选择删除时,删除相应的Disposal对象
- public System.Collections.ArrayList aryStatusObjs=new ArrayList();///FlowMap的aryDisposal,用来设置处理的经办状态;
- public FlowStatus transactStatus;//经办状态对象;
- public FlowDisposal(FlowStatus objFrom, FlowStatus objTo)
- { int x1=objFrom._x+Convert.ToInt32(objFrom._w/2);
- int y1=objFrom._y+Convert.ToInt32(objFrom._h/2);
- int x2=objTo._x+Convert.ToInt32(objTo._w/2);
- 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对象
- { }
- public void setLabelProp()//设置label的属性
- {
- 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);
- this.lbDispName.MouseMove+=new System.Windows.Forms.MouseEventHandler(lbl_MouseMove);
- this.lbDispName.MouseUp+=new System.Windows.Forms.MouseEventHandler(lbl_MouseUp);
- //设置标签的右键菜单
- this.menuDisp=new System.Windows.Forms.ContextMenu();
- this.menuDel=new System.Windows.Forms.MenuItem() ;
- this.menuSet=new System.Windows.Forms.MenuItem();
- this.menuDel.Text="删除";
- this.menuDel.Click += new System.EventHandler(this.menuDel_Click);
- this.menuSet.Text="属性";
- this.menuSet.Click += new System.EventHandler(this.menuSet_Click);
- this.menuDisp.MenuItems.Add(menuDel);
- this.menuDisp.MenuItems.Add("-");
- this.menuDisp.MenuItems.Add(menuSet); this.lbDispName.ContextMenu=this.menuDisp;
- }
- public void getFormwh(int intW,int intH)//得到FlowMap Form的高度和宽度
- { this.intFormW=intW; this.intFormH=intH; }
- private void lbl_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- this.intMouseDownX=this.intCurX-e.X;
- this.intMouseDownY=this.intCurY-e.Y;
- this.blCanMove=true;
- }
- private void lbl_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- if(this.blCanMove)
- {
- this.intCurX=this.intMouseDownX+e.X;
- this.intCurY=this.intMouseDownY+e.Y;
- //this.lbDispName.Location=new Point(this.intCurX-Convert.ToInt32(this.intlblw/2) , this.intCurY-Convert.ToInt32(this.intlblh/2) );
- // this.lbDispName.Refresh();
- }
- }
- private void lbl_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- this.intCurX=this.intMouseDownX+e.X;
- this.intCurY=this.intMouseDownY+e.Y;
- this.lbDispName.Location=new Point(this.intCurX-Convert.ToInt32(this.intlblw/2) , this.intCurY-Convert.ToInt32(this.intlblh/2) );
- checkPosition(lbDispName,this.intFormW,this.intFormH);
- this.intCurX=lbDispName.Left+Convert.ToInt32(this.intlblw/2);
- this.intCurY=lbDispName.Top+Convert.ToInt32(this.intlblh/2);
- this.blCanMove=false;
- }
- //让lable始终在画板内,intFormW为画板的宽度,intFormH为画板的高度
- public void checkPosition(System.Windows.Forms.Label objLable,int intFormW,int intFormH)
- {
- int w = intFormW;
- int h = intFormH;
- int new_x = objLable.Left;
- int new_y = objLable.Top;
- int lblW=objLable.Width;;
- int lblH=objLable.Height;
- if((objLable.Left+lblW)>w)
- {
- new_x = (int)w-lblW;
- }
- if(objLable.Left< 0)
- {
- new_x = 0;
- }
- if((objLable.Top+lblH)>h)
- {
- new_y = (int)h-lblH;
- }
- if(objLable.Top < 0)
- {
- new_y = 0;
- }
- objLable.Left=new_x;
- objLable.Top=new_y;
- }
- private void menuDel_Click(object sender, System.EventArgs e)//删除一个处理对象
- {
- /* if(this.aryDisp.Count==0) return;
- foreach(Object item in this.aryDisp)
- {
- FlowDisposal tempDisp=(FlowDisposal)item;
- if(tempDisp.Equals(this))
- {
- tempDisp.clearProperty();
- return;
- }
- }
- */
- this.clearProperty();
- }
- private void menuSet_Click(object sender, System.EventArgs e)//设置处理对象的属性
- {
- frmDispSet frmSet=new frmDispSet();
- frmSet.setThisDisposal(this);
- frmSet.setAryStatus(this.aryStatusObjs);
- frmSet.setAryDisposal(this.aryDisp);
- frmSet.MaximizeBox=false;
- frmSet.MinimizeBox=false;
- frmSet.ShowDialog();
- }
- /**
- * 清除处理对象的所有属性
- * 删除处理对象时,并不真正删除该对象,但是要清除其属性
- *
- * */
- public void clearProperty()
- {
- this.blDisplay=false;//是否显示,为false不显示
- this.lbDispName.Visible=false;
- strDisposalHint="";//处理过程提示,DISPOSAL_HINT
- strDisposalName="";//处理过程名称,DISPOSAL_NAME
- dblTransactStatusId=0;//经办状态,TRANSACT_STATUS_ID
- intGroupLimit=0;//组限制,GROUP_LIMIT
- dblCurStatusId=-1;//当前环节ID,CUR_STATUS_ID
- dblPreStatusId=-1;//上环节ID, PRE_STATUS_ID
- intCurX=-1;//X坐标,CUR_X
- intCurY=-1;//Y坐标,CUR_Y
- blCanMove=false;//lable是否可以移动
- //aryDisp=null;
- }
- }
- }