private void button1_Click(object sender, EventArgs e) { name = textBox1.Text; if (checkBox1.Checked) { basement = true; } if (checkBox2.Checked) { loft = true; } int max = (int)((float)textBox1.Width / textBox1.Font.Size); var lines = TEMP.WrapText(textBox1.Text, max); name = ""; for (int i = 0; i < lines.Count(); i++) { if (i != lines.Count() - 1) { name += lines[i] + Environment.NewLine; } else { name += lines[i]; } } if (name.Length <= 1) { MessageBox.Show("Пожалуйста введите имя здания"); } else { count = (int)numericUpDown1.Value; dialogResult = DialogResult.Yes; Close(); } }