void GraphCanvas_MouseUp(object sender, MouseEventArgs e) { if (e.Button != System.Windows.Forms.MouseButtons.Right) return; _lineToShowName = null; Invalidate(new Rectangle(new Point(Location.X + Width - 100, Location.Y + 5), new Size(100, 30))); }
private void GraphCanvas_MouseDown(object sender, MouseEventArgs e) { if (e.Button != System.Windows.Forms.MouseButtons.Right) return; Point translatedPoint = new Point(e.Location.X - GraphMargin, Height - e.Location.Y - GraphMargin); GraphPoint transformedPoint = TransformPointBack(translatedPoint); foreach (GraphLine line in Lines) if (line.ContainsPoint(transformedPoint)) { _lineToShowName = line; Invalidate(new Rectangle(new Point(Location.X + Width - 100, Location.Y + 5), new Size(100, 30))); return; } }