28. Arrowheads

This problem is relatively straightforward, but I'm going to describe the solution in some detail because it demonstrates some techniques that will be useful for later problems. This problem has two parts: allowing the user to draw a segment and drawing the segment as an arrow.

The first problem is relatively simple, at least as long as you've seen this sort of thing before. The Arrowhead example solution uses the following code to let the user select the segment:

// The segment's endpoint. If they are the same, there's no segment.private Point StartPoint, EndPoint;// True while dragging.private bool Drawing = false;// Start drawing.private void arrowPictureBox_MouseDown(object sender, MouseEventArgs e){    Drawing = true; StartPoint ...

Get The Modern C# Challenge now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.