/// <summary> /// 当鼠标移动的时候 /// </summary> /// <param name="e">鼠标信息</param> protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); #region 择框的拉取 ///查看是否具备刷新框选的资格 if (MyPanel.IsToSelect && ToolHelp.DisPoint(MyPanel.MouseStartPoint, e.GetPosition(MyPanel)) > MoveDistance) { MyPanel.MouseEndPoint = e.GetPosition(MyPanel); CaultRectangle(MyPanel.InveateRec); } #endregion #region 画贝塞尔曲线 else if (isDrawBezier && !isOverAribute && MyBezierLine != null) { MyBezierLine.SetBezierLine(e.GetPosition(MyPanel), FirstXa.GetOrXPositonStyle()); } #endregion #region 自身移动 ///如果焦点在本控件并且准备好移动自身 if (HasChildControled() && IsStartMove) { ///获取新的点 EndDragPoint = e.GetPosition(MyPanel); if (ToolHelp.DisPoint(StartDragPoint, EndDragPoint) >= MoveDistance) { HorMove(StartDragPoint.X - EndDragPoint.X); VecMove(StartDragPoint.Y - EndDragPoint.Y); IsMove = true; StartDragPoint.X = EndDragPoint.X; StartDragPoint.Y = EndDragPoint.Y; } } #endregion }
/// <summary> /// 初始化基本信息 /// </summary> protected override void InitBaseInfo() { base.InitBaseInfo(); ///创建函数入口代码块 FunctionEnterBox = CreateXCodeBox("方法入口", CenterPoint, CodeBox.XAType.XFunctionEnter); FunctionEnterBox.OpenButton = 2; FunctionEnterBox.AddXExcXAribute(); FunctionEnterBox.XAributeChangeMessage = () => { XAributeChangeMessage(this); };///属性消息变更通知 ///创建函数出口代码块 CodeBox functionExc = CreateXCodeBox("方法出口", new Point(CenterPoint.X + 250, CenterPoint.Y), CodeBox.XAType.XFunctionExc); functionExc.OpenButton = 1; functionExc.AddXEnterXAribute(); functionExc.XAributeChangeMessage = () => { XAributeChangeMessage(this); };///属性消息变更通知 ///保存函数出口代码块的地址 FunctionExcBox = functionExc; ///添加初始连线 XAribute FirstXa = FunctionEnterBox.GetRightExc()[0]; XAribute SecondXa = functionExc.GetLeftEnter(); BezierLine MyBezierLine = new BezierLine(CreateBezierID(), FirstXa.BorderColor, FirstXa.GetWorldPosition(), FirstXa.SelectPositionStyle); AddBezierLine(MyBezierLine); FirstXa.AddBezierLine(MyBezierLine); MyBezierLine.StartPoint.LinkAribute = FirstXa; SecondXa.AddBezierLine(MyBezierLine); MyBezierLine.EndPoint.LinkAribute = SecondXa; MyBezierLine.SetBezierLine(SecondXa.GetWorldPosition(), SecondXa.SelectPositionStyle); }