Esempio n. 1
0
        public fmMain()
        {
            InitializeComponent();

            Image image = Image.FromFile(Application.StartupPath +@"\bmp_init.bmp");
            int width = image.Width;
            int height = image.Height;
            Bitmap bmp = new Bitmap(Image.FromFile("bmp_init.bmp"), width, height);
            pbPolygon.Image = bmp;

            ImgEditor = new ImageEditor(pbPolygon,this);
            ImgEditor.EditingOff();
            ImgEditor.mouseSensitivity = trackBar1.Maximum - trackBar1.Value;
        }
Esempio n. 2
0
        public override void KeyPress(KeyPressEventArgs e, ImageEditor imgEd)
        {
            if (e.KeyChar == (char)Keys.Space)
            {
                if (imgEd.CurPolygon.VertexCount >= 3)
                {
                    Graphics g = imgEd.GetGraphics();
                    g.DrawLine(new Pen(Brushes.Black, 2), new Point(imgEd.CurPolygon.GetVertex(0).X,
                        imgEd.CurPolygon.GetVertex(0).Y), new Point(imgEd.CurPolygon.GetVertex(imgEd.CurPolygon.VertexCount - 1).X,
                            imgEd.CurPolygon.GetVertex(imgEd.CurPolygon.VertexCount - 1).Y));
                    imgEd.ReDraw();

                    MessageBox.Show("Внешний контур создан");
                    imgEd.EditingOff();
                    imgEd.fm.SetbtInnerContour(true);

                }
                else MessageBox.Show("Контур не может содержать менее 3 точек!");
            }
        }