9. 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 Improving your C# Skills now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.