To draw line across panel controls.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Y2hpdHRvcmlhbg==?=

    To draw line across panel controls.

    I am trying to draw lines between buttons inside two different wrap panel
    ..This has to happen on click of button .The partial code goes below.
    UserControlButt on btn = (UserControlBut ton)sender;
    WrapPanel parentPanel = VisualTreeHelpe r.GetParent(btn ) as WrapPanel;
    Point position = Mouse.GetPositi on(parentPanel) ;
    Point startPosition = new Point();
    Point endPosition = btn.PointToScre en(position);
    startPosition.X = endPosition.X - position.X;
    startPosition.Y = endPosition.Y;
    Line line = DrawLine(endPos ition, startPosition, Brushes.Red);

    The first problem is Mouse.GetPositi on(parentPanel) ; it is not returning
    posistion with respect to wrap panel.
Working...