0
I know how to draw lines in a program, but I wish the user could "move that line" that he did (like a vector) to somewhere on the screen. It turns out I didn’t find anything about it at Microsoft, and maybe it doesn’t even exist.
private Point pt1;
private Point pt2;
private void TelaInicial_MouseDown(object sender, MouseEventArgs e)
{
pt1 = e.Location;
}
private void TelaInicial_MouseUp(object sender, MouseEventArgs e)
{
pt2 = e.Location;
// Desenha uma linha com ponta de flecha
Pen myPen = new Pen(Color.White, 7);
myPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
Graphics g = this.CreateGraphics();
g.DrawLine(myPen, pt1, pt2);
g.Dispose();
myPen.Dispose();
}
If what was said above is impossible to accomplish using drawing tools, could anyone suggest some other way? Thank you for your attention.