private void start() { int R1X1 = Convert.ToInt32(rect1x1.Text); int R1Y1 = Convert.ToInt32(rect1y1.Text); int R1X2 = Convert.ToInt32(rect1x2.Text); int R1Y2 = Convert.ToInt32(rect1y2.Text); int R2X1 = Convert.ToInt32(rect2x1.Text); int R2Y1 = Convert.ToInt32(rect2y1.Text); int R2X2 = Convert.ToInt32(rect2x2.Text); int R2Y2 = Convert.ToInt32(rect2y2.Text); if (R1X2 < R1X1 || R1Y2 > R1Y1 || R2X2 < R2X1 || R2Y2 > R2Y1) { MessageBox.Show("Некорректный ввод", "Result"); } else { var rect1 = new Rectangle(R1X1, this.Height - R1Y1, R1X2 - R1X1, R1Y1 - R1Y2); var rect2 = new Rectangle(R2X1, this.Height - R2Y1, R2X2 - R2X1, R2Y1 - R2Y2); Picture picture = new Picture(rect1, rect2); picture.Show(); checkIntersection r = new checkIntersection(); if (r.isIntersection(R1X1, R1Y1, R1X2, R1Y2, R2X1, R2Y1, R2X2, R2Y2)) { MessageBox.Show("Прямоугольники пересекаются.", "Result"); } else { MessageBox.Show("Прямоугольники не пересекаются.", "Result"); } } }