Добавление кнопки

This commit is contained in:
Slivin
2026-01-28 16:02:24 +03:00
parent bc123becf7
commit bf4f1cd6b4
2 changed files with 18 additions and 0 deletions
+13
View File
@@ -29,6 +29,7 @@
private void InitializeComponent() private void InitializeComponent()
{ {
label1 = new Label(); label1 = new Label();
button1 = new Button();
SuspendLayout(); SuspendLayout();
// //
// label1 // label1
@@ -40,11 +41,22 @@
label1.TabIndex = 0; label1.TabIndex = 0;
label1.Text = "SLIVIN"; label1.Text = "SLIVIN";
// //
// button1
//
button1.Location = new Point(311, 239);
button1.Name = "button1";
button1.Size = new Size(75, 23);
button1.TabIndex = 1;
button1.Text = "нажать";
button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click;
//
// Form1 // Form1
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(784, 561); ClientSize = new Size(784, 561);
Controls.Add(button1);
Controls.Add(label1); Controls.Add(label1);
Name = "Form1"; Name = "Form1";
Text = "Form1"; Text = "Form1";
@@ -55,5 +67,6 @@
#endregion #endregion
private Label label1; private Label label1;
private Button button1;
} }
} }
+5
View File
@@ -6,5 +6,10 @@ namespace Slivin_PR03_GIT
{ {
InitializeComponent(); InitializeComponent();
} }
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(DateTime.Now.ToString());
}
} }
} }