一、创建接口 ,确定接下来流程创建的过程中我们需要使用的哪些方法及变量,同时为后续提供其他人员开发自定义节点图形做好基础。
1、基础接口定义:IBase.cs
internal interface IBase { Control Owner { get; set; } string Id { get; set; } string Name { get; set; } int X { get; set; } int Y { get; set; } int Width { get; set; } int Height { get; set; } int Left { get; } int Top { get; } int Right { get; } int Bottom { get; } bool Drag { get; } bool Capture { get; } bool Selected { get; set; } bool Hovering { get; } bool ReadOnly { get; } Color BorderColor { get; set; } Point Loaction { get; } Size Size { get; } RectangleF ClientRectangleF { get; } Rectangle ClientRectangle { get; } Color BackColor { get; set; } string Text { get; set; } Font Font { get; set; } }
2、事件接口定义:IEvent.cs
internal interface IEvent { void onm ouseDown(MouseEventArgs e); void onm ouseEnter(EventArgs e); void onm ouseLeave(EventArgs e); void onm ouseHover(EventArgs e); void onm ouseMove(MouseEventArgs e); void onm ouseUp(MouseEventArgs e); void onm ouseWheel(MouseEventArgs e); void OnMove(EventArgs e); void OnPaint(PaintEventArgs e); void OnPaddingChanged(EventArgs e); void onm ouseDoubleClick(MouseEventArgs e); }
3、拓展一部分事件接口定义:IEventCustom.cs
internal interface IEventCustom { event EventHandler PointChange; bool HasPointChange(); void OnPointChange(EventArgs e); }
4、流程控制接口定义:IMaster.cs
internal interface IMaster { /// <summary> /// 是否允许拖动 /// </summary> [Description("是否允许拖动")] bool Drag { get; } /// <summary> /// 节点图形集合 /// </summary> [Description("节点图形集合")] List<IShape> Shapes { get; } /// <summary> /// 连线图形 /// </summary> [Description("连线图形")] ShapeLinks ShapeLink { get; } /// <summary> /// Master的拥有者 /// </summary> [Description("Master的拥有者")] Control Owner { get; set; } /// <summary> /// 缩放因子 /// </summary> [Description("缩放因子")] float ScaleFactor { get; set; } /// <summary> /// 平移转换 /// </summary> [Description("缩放因子")] PointF DefaultTranslate { get; } /// <summary> /// 平移转换偏量 /// </summary> [Description("平移转换偏量")] PointF TranslateOffset { get; } /// <summary> /// 鼠标偏移量 /// </summary> [Description("鼠标偏移量")] PointF MouseOffset { get; } /// <summary> /// 坐标转换 /// </summary> /// <param name="pointF">需要被转换的坐标</param> /// <returns></returns> PointF Pto(PointF pointF); /// <summary> /// 坐标转换 /// </summary> /// <param name="pointF">需要被转换的坐标</param> /// <returns></returns> PointF PointTo(PointF pointF); /// <summary> /// 坐标转换 /// </summary> /// <param name="pointF">需要被转换的坐标</param> /// <returns></returns> PointF Pform(PointF pointF); /// <summary> /// 坐标转换 /// </summary> /// <param name="pointF">需要被转换的坐标</param> /// <returns></returns> PointF PointFrom(PointF pointF); /// <summary> /// 节点连线数据集合 /// </summary> [Description("连线数据集合")] List<Link> Links { get; } /// <summary> /// 节点连线坐标数据集合 /// </summary> [Description("节点连线坐标数据集合")] List<LinkPoint> LinkPoints { get; } /// <summary> /// 鼠标悬停的图形 /// </summary> [Description("鼠标悬停的图形")] Tuple<ShapeModule, MouseEventArgs> MouseHoverShape { get; } void DrawGrid(Graphics graphics, Rectangle area, int majorStep, int minorStep); void SetNotSelectedShapeAll(IShape shape = null); }
5、节点图形绘制接口定义:IShape.cs 继承 IBase
internal interface IShape:IBase { string FromShapId { get; set; } ShapeType ShapeType { get; set; } Region ClientRegion { get; set; } PointF[] ClientRegionPointFs { get; set; } RectangleF ClientRegionRect { get; set; } Point MouseOffset { get; } Point[] MouseOffsets { get; } int BorderWidth { get; } float ScaleFactor { get;set; } Image Image { get; set; } PointF TranslateOffset { get; } RectangleF RectScale { get; } Point Centre { get; } PointF Pto(PointF pointF); PointF PointTo(PointF pointF); PointF Pform(PointF pointF); PointF PointFrom(PointF pointF); /// <summary> /// 当前实例的浅表副本 复杂属性(引用类型....)不适用 /// </summary> /// <returns></returns> //IShape Clone(); }
标签:set,流程图,PointF,get,int,void,Csharp,Description,Winform From: https://www.cnblogs.com/CaiJimi/p/18343134