Example #1
0
        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);
            }
        }
Example #2
0
        private void PointAdd_Click(object sender, EventArgs e)
        {
            int X = 0;
            int Y = 0;

            int.TryParse(MyPointX.Text, out X);
            int.TryParse(MyPointY.Text, out Y);

            myGraph.Point Point = new myGraph.Point(X, Y);

            if (rectangle_?.IsInside(Point) ?? false)
            {
                points_.Add(Point);
                pen_.Color = Color.Red;
                using (Graphics Graph = PictB.CreateGraphics())
                {
                    Graph.DrawRectangle(pen_, Point.X, Point.Y, 1, 1);
                }
                Message.Text = "All right";
            }
            else
            {
                Message.Text = "Point is not in Rectangle!";
            }
        }