public Drawer (PictureBox p) { picture = p; b = new Bitmap(picture.Width, picture.Height); pen = new Pen(Color.Blue); raser = new Pen(Color.White, 5); used = new bool[picture.Width+1, picture.Height+1]; g = Graphics.FromImage(b); picture.Image = b; shape = Shape.Pencil; picture.Paint += Picture_Paint; OpenImage(""); }
private void pictureBox_MouseClick(object sender, MouseEventArgs e) { if (drawing) { shape.AddPoint(e.Location); } else { shape = (Shape)Activator.CreateInstance(shapes[ShapePicker.SelectedItem.ToString()]); shapeList.AddShape(shape); shape.AddPoint(e.Location); shape.AddPoint(e.Location); drawing = true; } }