Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void pictureBox1_Paint(object sender, PaintEventArgs e)
- {
- if (paint)
- {
- if (rect != null)
- {
- e.Graphics.DrawRectangle(Pens.Blue, GetRectangleFirstDigit());
- }
- if (rect2 != null)
- {
- e.Graphics.DrawRectangle(Pens.Blue, GetRectangleOtherDigits());
- e.Graphics.DrawRectangle(Pens.Blue, GetRectangleOtherDigits());
- e.Graphics.DrawRectangle(Pens.Blue, GetRectangleOtherDigits());
- e.Graphics.DrawRectangle(Pens.Blue, GetRectangleOtherDigits());
- e.Graphics.DrawRectangle(Pens.Blue, GetRectangleOtherDigits());
- e.Graphics.DrawRectangle(Pens.Blue, GetRectangleOtherDigits());
- e.Graphics.DrawRectangle(Pens.Blue, GetRectangleOtherDigits());
- }
- }
- }
- private Rectangle GetRectangleFirstDigit()
- {
- rect = new Rectangle();
- rect.X = Math.Min(StartLocation.X, EndLcation.X);
- x = rect.X;
- rect.Y = Math.Min(StartLocation.Y, EndLcation.Y);
- y = rect.Y;
- rect.Width = Math.Abs(StartLocation.X - EndLcation.X);
- w = rect.Width;
- rect.Height = Math.Abs(StartLocation.Y - EndLcation.Y);
- h = rect.Height;
- //MessageBox.Show("Coordinate rettangolo: \n\n X : " + x + "\n Y : " + y + "\n W : " + w + "\n H : " + h);
- rectangles.Add(rect);
- return rect;
- }
- private Rectangle GetRectangleOtherDigits()
- {
- rect2 = new Rectangle();
- x -= w;
- rect2.X = x;
- rect2.Y = y;
- rect2.Width = w;
- rect2.Height = h;
- rectangles.Add(rect2);
- return rect2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement