Пример #1
0
 /// <summary>
 /// 鼠标移动事件
 /// </summary>
 /// <param name="e"></param>
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     if (e.LeftButton != MouseButtonState.Pressed)
     {
         this.dragStartPoint = null;
     }
     if (this.dragStartPoint.HasValue)
     {
         //创建连接装饰器
         MyCanvas canvas = GetDesignerCanvas(this);
         if (canvas != null)
         {
             AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(canvas);
             if (adornerLayer != null)
             {
                 ConnectorAdorner adorner = new ConnectorAdorner(canvas, this);
                 if (adorner != null)
                 {
                     adornerLayer.Add(adorner);
                     e.Handled = true;
                 }
             }
         }
     }
 }
Пример #2
0
 /// <summary>
 /// 鼠标移动事件
 /// </summary>
 /// <param name="e"></param>
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     if (e.LeftButton != MouseButtonState.Pressed)
         this.dragStartPoint = null;
     if (this.dragStartPoint.HasValue)
     {
         //创建连接装饰器
         MyCanvas canvas = GetDesignerCanvas(this);
         if (canvas != null)
         {
             AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(canvas);
             if (adornerLayer != null)
             {
                 ConnectorAdorner adorner = new ConnectorAdorner(canvas, this);
                 if (adorner != null)
                 {
                     adornerLayer.Add(adorner);
                     e.Handled = true;
                 }
             }
         }
     }
 }