Ejemplo n.º 1
0
        private void PictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            flag = false;

            switch (drawMode)
            {
            case DrawMode.penMode:
            case DrawMode.eraserMode:
                DrawingData dd = new DrawingData();
                dd.pen        = p;
                dd.startPoint = CurPos;
                drawingSaveData.Add(dd);
                break;

            case DrawMode.line:
                DrawingData sd = new DrawingData();
                sd.startPoint = ClickPos;
                sd.endPoint   = pictureBox1.PointToClient(new Point(Control.MousePosition.X, Control.MousePosition.Y));
                lineSaveData.Add(sd);
                break;

            case DrawMode.curve:
                CurveData cd = new CurveData();
                cd.startPoint = ClickPos;
                cd.endPoint   = pictureBox1.PointToClient(new Point(Control.MousePosition.X, Control.MousePosition.Y));
                curveSaveData.Add(cd);
                curveFlag1 = true;
                break;

            case DrawMode.rect:
                recSaveData.Add(rec);
                break;

            case DrawMode.circle:
                circleSaveSData.Add(rec);
                break;

            case DrawMode.cloudMark:
                CloudMark cm = new CloudMark();
                cm.message = text;
                cm.rec     = rec;
                cloudMarkSaveData.Add(cm);
                break;

            case DrawMode.heart:
                Heart heart = new Heart();
                heart.message = text;
                heart.rec     = rec;
                heartSaveData.Add(heart);
                break;
            }

            if (drawMode == DrawMode.rect)
            {
                Graphics g = Graphics.FromImage(picBmp);
                g.DrawRectangle(p, rec);
            }
        }
Ejemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            g = Graphics.FromImage(picBmp);
            pictureBox1.Image = picBmp;

            lineSaveData      = new List <DrawingData>();
            recSaveData       = new List <Rectangle>();
            circleSaveSData   = new List <Rectangle>();
            curveSaveData     = new List <CurveData>();
            drawingSaveData   = new List <DrawingData>();
            cloudMarkSaveData = new List <CloudMark>();
            heartSaveData     = new List <Heart>();
            cloudMark         = new CloudMark();
        }