Esempio n. 1
0
        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            Graphics graphics = pictureBox1.CreateGraphics();

            switch (Mode)
            {
            case Mode.DrawPoint:

                Shape_Point point = new ShapesLibrary.Point(MouseX1, MouseY1, colors);
                // point.Draw(pictureBox1.CreateGraphics());
                AddShape(point);
                graphics.DrawEllipse(new Pen(colors), MouseX1, MouseY1, 2, 2);
                break;

            case Mode.DrawLine:
                //pictureBox1.Refresh();
                MouseX2 = e.X;
                MouseY2 = e.Y;

                graphics.DrawLine(new Pen(colors), MouseX1, MouseY1, MouseX2, MouseY2);
                Shape_Point Line = new ShapesLibrary.Line(MouseX1, MouseY1, MouseX2, MouseY2, colors);
                // point.Draw(pictureBox1.CreateGraphics());
                AddShape(Line);
                break;

            case Mode.DrawEllips:
                MouseX2 = e.X;
                MouseY2 = e.Y;
                graphics.DrawEllipse(new Pen(colors), MouseX1, MouseY1, (MouseX2 - MouseX1), (MouseY2 - MouseY1));
                Shape_Point Ellips = new ShapesLibrary.Ellips(MouseX1, MouseY1, (MouseX2 - MouseX1), (MouseY2 - MouseY1), colors);
                AddShape(Ellips);
                break;
            }
        }
Esempio n. 2
0
        private void pictureBox_MouseDown(object sender, MouseEventArgs e)
        {
            switch (Mode)
            {
            case Mode.DrawPoint:
                Shape point = new ShapesLibrary.Point(e.X, e.Y, new Pen(buttonColor.BackColor, 3));
                AddShape(point);
                break;

            case Mode.DrawLine:
                MouseX = e.X;
                MouseY = e.Y;
                break;

            case Mode.DrawCircle:
                MouseX = e.X;
                MouseY = e.Y;
                break;
            }
        }