How can I draw an arrow from one form to the other?

  • Thread starter Thread starter avivgood
  • Start date Start date
A

avivgood

Guest
I have two form: SelectedNode and SelectedNode2 I want arrow to go from SelectedNode2 to SelectedNode. I have tried:

Draw(SelectedNode.DesktopLocation.X, SelectedNode.DesktopLocation.Y, SelectedNode2.DesktopLocation.X, SelectedNode2.DesktopLocation.Y);

private void Draw( float X1, float Y1, float X2, float Y2)
{
Pen pen = new Pen(Color.FromArgb(255, 0, 0, 255), 8);
pen.StartCap = LineCap.ArrowAnchor;
pen.EndCap = LineCap.RoundAnchor;
CreateGraphics().DrawLine(pen, X1, Y1, X2, Y2);
}

But this is not working. (this is from the official c# docs)

what should I do?

edit: the arrow is being drawn, bun when the form moves the arrow doesn't move with it.

Continue reading...
 
Back
Top