Эх сурвалжийг харах

Загрузить файлы ''

21IS15 2 жил өмнө
parent
commit
cb3e31d53b
1 өөрчлөгдсөн 37 нэмэгдсэн , 0 устгасан
  1. 37 0
      Form1(ПР8).cs

+ 37 - 0
Form1(ПР8).cs

@@ -0,0 +1,37 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace WindowsFormsApp39
+{
+    public partial class Form1 : Form
+    {
+        public Form1()
+        {
+            InitializeComponent();
+        }
+
+        private void Form1_Paint(object sender, PaintEventArgs e)
+        {
+            Graphics g = e.Graphics;
+
+            // Размеры формы
+            int formWidth = this.ClientSize.Width;
+            int formHeight = this.ClientSize.Height;
+
+            // Рисуем круг по середине формы
+            int circleSize = Math.Min(formWidth, formHeight) / 2;
+            int circleX = (formWidth - circleSize) / 2;
+            int circleY = (formHeight - circleSize) / 2;
+            Rectangle circleRect = new Rectangle(circleX, circleY, circleSize, circleSize);
+            g.FillEllipse(Brushes.Green, circleRect);
+
+            // Рисуем черные полоски сверху, снизу, слева и справа
+            int stripeHeight = 7;
+            g.FillRectangle(Brushes.Black, 0, 0, formWidth, stripeHeight); // Полоска сверху
+            g.FillRectangle(Brushes.Black, 0, formHeight - stripeHeight, formWidth, stripeHeight); // Полоска снизу
+            g.FillRectangle(Brushes.Black, 0, 0, stripeHeight, formHeight); // Полоска слева
+            g.FillRectangle(Brushes.Black, formWidth - stripeHeight, 0, stripeHeight, formHeight); // Полоска справа
+        }
+    }
+}