示例#1
0
 private void nextForeach(Graphics g, Rectangle rectangle11)
 {
     foreach (Rectangle rectangle22 in RectanglesList)
     {
         if (RectenglChek.RectenglCheked(XY2, rectangle22))
         {
             Drowing.LineDrow(g, rectangle11, rectangle22, LineList);
         }
     }
 }
示例#2
0
        private void pictureBox1_MouseUp(object sender, MouseEventArgs e) //событие отпускание лкм
        {
            XY2 = new XYkoord {
                X = e.X, Y = e.Y
            };
            Graphics g = Graphics.FromImage(bmp);

            pictureBox1.Image = bmp;
            if (radioButton1.Checked) //рисуем линию
            {
                foreach (Rectangle rectangle11 in RectanglesList)
                {
                    if (RectenglChek.RectenglCheked(XY1, rectangle11))
                    {
                        nextForeach(g, rectangle11);
                    }
                }
            }
            if (radioButton2.Checked) //рисуем прямоугольники
            {
                Rectangle rectangle = new Rectangle();
                Drowing.RectangleDrow(g, XY1, XY2, rectangle);
            }
            if (radioButton4.Checked) //рисуем прямоугольники синий
            {
                BlueRectangle rec = new BlueRectangle();
                Drowing.RectangleDrow(g, XY1, XY2, rec);
            }
            if (radioButton3.Checked)
            {
                Rectangle rec = new Rectangle();
                rec = null;
                foreach (Rectangle rectangle in RectanglesList)
                {
                    if (RectenglChek.RectenglCheked(XY1, rectangle))
                    {
                        rec = rectangle;
                    }
                }
                if (rec != null)
                {
                    RectanglesList.Remove(rec);
                    rec.koord1.X = XY1.X - (XY1.X - XY2.X);
                    rec.koord1.Y = XY1.Y - (XY1.Y - XY2.Y);
                    rec.koord2.X = rec.koord1.X + rec.width;
                    rec.koord2.Y = rec.koord1.Y + rec.heigh;
                    Drowing.RectangleDrow(g, rec.koord1, rec.koord2, rec);
                    foreach (Line line in LineList)
                    {
                        if (line.rectangle1 == rec)
                        {
                            line.rectangle1 = RectanglesList.Last();
                        }
                        if (line.rectangle2 == rec)
                        {
                            line.rectangle2 = RectanglesList.Last();
                        }
                    }
                    UpdatePictur.Update(LineList, RectanglesList, g);
                    pictureBox1.Image = bmp;
                }
            }
        }