コード例 #1
0
ファイル: Drawer.cs プロジェクト: Temirbay/Projects
        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("");
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Lyffik/OOP_Laba2
 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;
     }
 }