using System; using System.Drawing; using System.Windows.Forms; namespace Zoo { public class FormEdit : Form { TextBox txtName; TextBox txtPhone; TextBox txtEmail; TextBox txtComment; Button btnSave; Button btnCancel; public FormEdit() { InitializeComponent(); } private void InitializeComponent() { Text = "Редактирование записи"; StartPosition = FormStartPosition.CenterParent; Size = new Size(420, 370); FormBorderStyle = FormBorderStyle.FixedSingle; MaximizeBox = false; BackColor = Color.WhiteSmoke; Font = new Font("Segoe UI", 10); Label lblTitle = new Label(); lblTitle.Text = "Данные пользователя"; lblTitle.Font = new Font("Segoe UI", 15, FontStyle.Bold); lblTitle.AutoSize = true; lblTitle.Location = new Point(90, 20); Label lblName = new Label(); lblName.Text = "ФИО"; lblName.Location = new Point(30, 70); lblName.AutoSize = true; txtName = new TextBox(); txtName.Location = new Point(130, 66); txtName.Size = new Size(230, 30); Label lblPhone = new Label(); lblPhone.Text = "Телефон"; lblPhone.Location = new Point(30, 115); lblPhone.AutoSize = true; txtPhone = new TextBox(); txtPhone.Location = new Point(130, 111); txtPhone.Size = new Size(230, 30); Label lblEmail = new Label(); lblEmail.Text = "Email"; lblEmail.Location = new Point(30, 160); lblEmail.AutoSize = true; txtEmail = new TextBox(); txtEmail.Location = new Point(130, 156); txtEmail.Size = new Size(230, 30); Label lblComment = new Label(); lblComment.Text = "Комментарий"; lblComment.Location = new Point(30, 205); lblComment.AutoSize = true; txtComment = new TextBox(); txtComment.Location = new Point(130, 201); txtComment.Size = new Size(230, 60); txtComment.Multiline = true; btnSave = new Button(); btnSave.Text = "Сохранить"; btnSave.Location = new Point(60, 285); btnSave.Size = new Size(120, 40); btnSave.BackColor = Color.DodgerBlue; btnSave.ForeColor = Color.White; btnSave.FlatStyle = FlatStyle.Flat; btnSave.Click += BtnSave_Click; btnCancel = new Button(); btnCancel.Text = "Отмена"; btnCancel.Location = new Point(220, 285); btnCancel.Size = new Size(120, 40); btnCancel.BackColor = Color.Gray; btnCancel.ForeColor = Color.White; btnCancel.FlatStyle = FlatStyle.Flat; btnCancel.Click += (s, e) => Close(); Controls.Add(lblTitle); Controls.Add(lblName); Controls.Add(txtName); Controls.Add(lblPhone); Controls.Add(txtPhone); Controls.Add(lblEmail); Controls.Add(txtEmail); Controls.Add(lblComment); Controls.Add(txtComment); Controls.Add(btnSave); Controls.Add(btnCancel); } private void BtnSave_Click(object sender, EventArgs e) { MessageBox.Show( "Данные успешно сохранены!", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } } }