private void RectAdd_Click(object sender, EventArgs e) { ClearAll(); int X = 0; int Y = 0; int Height = 0; int Width = 0; int.TryParse(RectPointX.Text, out X); int.TryParse(RectPointY.Text, out Y); int.TryParse(RectHeight.Text, out Height); int.TryParse(RectWidth.Text, out Width); myGraph.Point TLPoint = new myGraph.Point(X, Y); pen_.Color = Color.Blue; rectangle_ = new myGraph.Rectangle(TLPoint, Height, Width); using (Graphics Graph = PictB.CreateGraphics()) { Graph.DrawRectangle(pen_, rectangle_.Point.X, rectangle_.Point.Y, rectangle_.Width, rectangle_.Height); } }
private void ClearAll() { using (Graphics Graph = PictB.CreateGraphics()) { Graph.Clear(Color.LightGray); points_.Clear(); rectangle_ = null; } }