Esempio n. 1
0
        private void Form1_MouseDown(object sender, EventArgs e)
        {
            TFigure figure;
            // g is a variable, determining where to draw.
            Graphics g; // Create graphical object.

            g = this.CreateGraphics();
            Point point1 = new Point();
            Point point2 = new Point();

            point1.X = 10;
            point1.Y = 10;
            // Width and height.
            point2.X = 100;
            point2.Y = 200;

            // Color of figures.
            Pen myPen1 = new Pen(Color.BlueViolet);
            Pen myPen2 = new Pen(Color.Indigo);
            Pen myPen3 = new Pen(Color.CadetBlue);
            Pen myPen4 = new Pen(Color.DarkSalmon);

            figure = new TLine();
            figure.Draw(point1, point2, myPen1, g);
            figure = new TRectangle();
            figure.Draw(point1, point2, myPen2, g);
            figure = new TEllipse();
            figure.Draw(point1, point2, myPen3, g);
            figure = new TTriangle();
            figure.Draw(point1, point2, myPen4, g);
        }
Esempio n. 2
0
        private void Form1_MouseDown(object sender, EventArgs e)
        {
            TFigure figure;
            // g is a variable, determining where to draw.
            Graphics g; // Create graphical object.
            g = this.CreateGraphics();
            Point point1 = new Point();
            Point point2 = new Point();
            point1.X = 10;
            point1.Y = 10;
            // Width and height.
            point2.X = 100;
            point2.Y = 200;

            // Color of figures.
            Pen myPen1 = new Pen(Color.BlueViolet);
            Pen myPen2 = new Pen(Color.Indigo);
            Pen myPen3 = new Pen(Color.CadetBlue);
            Pen myPen4 = new Pen(Color.DarkSalmon);

            figure = new TLine();
            figure.Draw(point1, point2, myPen1, g);
            figure = new TRectangle();
            figure.Draw(point1, point2, myPen2, g);
            figure = new TEllipse();
            figure.Draw(point1, point2, myPen3, g);
            figure = new TTriangle();
            figure.Draw(point1, point2, myPen4, g);
        }