Esempio n. 1
0
 public override void Drawing(Graphics g)
 {
     g.DrawCurve(new Pen(Color.Aquamarine), point);
 }
        private void Panel1_MouseMove(object sender, MouseEventArgs e)
        {
            switch (shape)
            {
            // free draw with eraser on right click hold
            case 0:
                if (e.Button == MouseButtons.Left)
                {
                    //if holding mouse down
                    if (start)
                    {
                        if (x > 0 && y > 0)
                        {
                            gp.DrawLine(p, x, y, e.X, e.Y);
                        }

                        x = e.X;     //sets x = mouse x coordinate
                        y = e.Y;     //sets y = mouse y coordinate
                    }
                }

                // eraser
                else if (e.Button == MouseButtons.Right)
                {
                    if (start)
                    {
                        if (x > 0 && y > 0)
                        {
                            p.Color = Color.White;
                            p.Width = 20.0f;
                            gp.DrawLine(p, x, y, e.X, e.Y);
                        }

                        x = e.X;
                        y = e.Y;
                    }
                }
                break;

            case 1:
                //Line or Curve?

                if (e.Button == MouseButtons.Left)
                {
                    //if holding mouse down
                    if (start == true)
                    {
                        gp.DrawLine(p, p1, p2);
                    }
                }

                else if (e.Button == MouseButtons.Right)
                {
                    PointF[] temp = new PointF[2];
                    temp[0] = p1;
                    temp[1] = p2;
                    /* Still need to update */
                    if (start == true)
                    {
                        gp.DrawCurve(p, temp);
                    }
                }
                break;

            case 2:
                //Rectangle
                // could potentially use for scaling w/ mouse

                break;

            case 3:
                //Oval
                //save for scaling
                break;

            default:
                shape = 0;
                break;
            }
        }