private void PictureBox1_MouseDown(object sender, MouseEventArgs e) { flag = true; ClickPos = pictureBox1.PointToClient(new Point(Control.MousePosition.X, Control.MousePosition.Y)); if (curveFlag1 == true && curveFlag2 == true && drawMode == DrawMode.curve) //곡선 { if (curveSaveData.Count >= 1) { Point po = pictureBox1.PointToClient(new Point(Control.MousePosition.X, Control.MousePosition.Y)); int count = curveSaveData.Count - 1; Point[] p = { curveSaveData[count].startPoint, po, curveSaveData[count].endPoint, }; CurveData cd = new CurveData(); //cd.startPoint = curveSaveData[count].startPoint; // cd.endPoint = curveSaveData[count].endPoint; cd.point = p; curveSaveData.RemoveAt(count); curveSaveData.Add(cd); DrawAll(); curveFlag1 = false; curveFlag2 = false; } } }
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); } }