private void paintSet(Color color, PaintEventArgs e, Intersect.Set set) { if (set.IsPoint) { Point point = new Point((int)((Intersect.Set.Point)set).Item1, (int)((Intersect.Set.Point)set).Item2); e.Graphics.DrawEllipse(new Pen(color), new Rectangle((int)((Intersect.Set.Point)set).Item1, (int)((Intersect.Set.Point)set).Item2, 10, 10)); } if (set.IsLine) { Point point1 = new Point(0, (int)((Intersect.Set.Line)set).Item2); Point point2 = new Point(size, (int)((Intersect.Set.Line)set).Item1 * size + (int)((Intersect.Set.Line)set).Item2); e.Graphics.DrawLine(new Pen(color), point1, point2); } if (set.IsVerticalLine) { Point point1 = new Point((int)((Intersect.Set.VerticalLine)set).Item, 0); Point point2 = new Point((int)((Intersect.Set.VerticalLine)set).Item, size); e.Graphics.DrawLine(new Pen(color), point1, point2); } if (set.IsLineSegment) { Point point1 = new Point((int)((Intersect.Set.LineSegment)set).Item1.Item1, (int)((Intersect.Set.LineSegment)set).Item1.Item2); Point point2 = new Point((int)((Intersect.Set.LineSegment)set).Item2.Item1, (int)((Intersect.Set.LineSegment)set).Item2.Item2); e.Graphics.DrawLine(new Pen(color), point1, point2); } }
private void button3_Click(object sender, EventArgs e) { set1 = getSet(); set2 = getSet(); label1.Text = (Intersect.intersect(set1, set2) == Intersect.Set.NoPoint) ? "no" : "yes"; this.Invalidate(); }