| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
-
- using System.Drawing;
- namespace Dongke.IBOSS.Basics.FlowSetting
- {
- /// <summary>
- /// 线段
- /// </summary>
- public class FlowLine : FlowItem
- {
- #region 成员变量
- /// <summary>
- /// 起点坐标
- /// </summary>
- private Point _pointBegin = Point.Empty;
- /// <summary>
- /// 终点坐标
- /// </summary>
- private Point _pointEnd = Point.Empty;
- /// <summary>
- /// 线的颜色
- /// </summary>
- private Color _lineColor = Consts.LINE_COLOR_DEFAULT;
- /// <summary>
- /// 线宽
- /// </summary>
- private int _lineWidth = Consts.LINE_WIDTH_DEFAULT;
- /// <summary>
- /// 起始节点连接点
- /// </summary>
- private AnchorKind _anchorBegin = AnchorKind.None;
- /// <summary>
- /// 终止节点连接点
- /// </summary>
- private AnchorKind _anchorEnd = AnchorKind.None;
- /// <summary>
- /// 起始节点(不保存xml)
- /// </summary>
- private FlowNode _nodeBegin = null;
- /// <summary>
- /// 终止节点(不保存xml)
- /// </summary>
- private FlowNode _nodeEnd = null;
- /// <summary>
- /// 加载流程时使用,临时保存NodeCode,把line链接到node时利用。
- /// </summary>
- internal string NodeCodeBegin = null;
- /// <summary>
- /// 加载流程时使用,临时保存NodeCode,把line链接到node时利用。
- /// </summary>
- internal string NodeCodeEnd = null;
- #endregion 成员变量
- #region 构造函数
- /// <summary>
- /// 新线段
- /// </summary>
- /// <param name="manager">流程项目管理</param>
- internal FlowLine(ItemManager manager)
- : base(manager)
- {
- this.ShowName = false;
- this.Name = "连线" + this.ItemID;
- }
- /// <summary>
- /// 导入的线段
- /// </summary>
- /// <param name="manager">流程项目管理</param>
- /// <param name="itemID">项目ID</param>
- /// <param name="onlyCode">唯一编码</param>
- internal FlowLine(ItemManager manager, int itemID, string onlyCode)
- : base(manager, itemID, onlyCode)
- {
- this.ShowName = false;
- this.Name = "连线" + this.ItemID;
- }
- #endregion 构造函数
- #region 属性
- /// <summary>
- /// 起点坐标
- /// </summary>
- public Point PointBegin
- {
- get
- {
- return this._pointBegin;
- }
- set
- {
- this._pointBegin = value;
- }
- }
- /// <summary>
- /// 终点坐标
- /// </summary>
- public Point PointEnd
- {
- get
- {
- return this._pointEnd;
- }
- set
- {
- this._pointEnd = value;
- }
- }
- /// <summary>
- /// 线的颜色
- /// </summary>
- public Color LineColor
- {
- get
- {
- return this._lineColor;
- }
- set
- {
- this._lineColor = value;
- }
- }
- /// <summary>
- /// 线宽
- /// </summary>
- public int LineWidth
- {
- get
- {
- return this._lineWidth;
- }
- set
- {
- this._lineWidth = value < 1 ? 1 : value;
- }
- }
- /// <summary>
- /// 起始节点
- /// </summary>
- public FlowNode NodeBegin
- {
- get
- {
- return this._nodeBegin;
- }
- internal set
- {
- this._nodeBegin = value;
- }
- }
- /// <summary>
- /// 终止节点
- /// </summary>
- public FlowNode NodeEnd
- {
- get
- {
- return this._nodeEnd;
- }
- internal set
- {
- this._nodeEnd = value;
- }
- }
- /// <summary>
- /// 起始节点连接点
- /// </summary>
- public AnchorKind AnchorBegin
- {
- get
- {
- return this._anchorBegin;
- }
- internal set
- {
- this._anchorBegin = value;
- }
- }
- /// <summary>
- /// 终止节点连接点
- /// </summary>
- public AnchorKind AnchorEnd
- {
- get
- {
- return this._anchorEnd;
- }
- internal set
- {
- this._anchorEnd = value;
- }
- }
- #endregion 属性
- #region 公有方法
- /// <summary>
- /// 获取选择状态样式范围
- /// </summary>
- /// <returns>选择状态样式范围</returns>
- public override Rectangle[] GetSelectedStyle()
- {
- int styleSize = Consts.SELECTEDSTYLE_WIDTH;
- int styleSizeHalf = Consts.SELECTEDSTYLE_WIDTH_HALF;
- Rectangle[] rects = new Rectangle[2];
- rects[0] = new Rectangle(this.PointBegin.X - styleSizeHalf, this.PointBegin.Y - styleSizeHalf, styleSize, styleSize);
- rects[1] = new Rectangle(this.PointEnd.X - styleSizeHalf, this.PointEnd.Y - styleSizeHalf, styleSize, styleSize);
- return rects;
- }
- #endregion 公有方法
- }
- }
|