namespace WinForms { public partial class FormTest : Form { public FormTest() { InitializeComponent(); comboBoxControl.AddItems(new List { "Значение 1", "Значение 2", "Значение 3", "Значение 4", "Значение 5" }); textBoxControl.Pattern = @"^[a-z0-9._%+-]+\@([a-z0-9-]+\.)+[a-z]{2,4}$"; textBoxControl.SetTooltipText("example@gmail.com"); listBoxControl.SetParams("Имя: {FirstName}, фамилия: {LastName}. {Gender} ({Age}) лет.", '{', '}'); listBoxControl.AddItems(new List { new() { FirstName = "Кирилл", LastName = "Петров", Age = 23, Gender = "муж" }, new() { FirstName = "Мария", LastName = "Иванова", Age = 18, Gender = "жен" }, new() { FirstName = "Ева", LastName = "Панфилова", Age = 40, Gender = "жен" } }); } private void ButtonClear_Click(object sender, EventArgs e) { comboBoxControl.Clear(); } private void ButtonGetComboBox_Click(object sender, EventArgs e) { MessageBox.Show(comboBoxControl.SelectedValue, "Полученное значение"); } private void ButtonSetComboBox_Click(object sender, EventArgs e) { comboBoxControl.SelectedValue = "Значение 3"; } private void ButtonGetTextBox_Click(object sender, EventArgs e) { MessageBox.Show(textBoxControl.Value, "Полученное значение"); } private void ButtonSetTextBox_Click(object sender, EventArgs e) { textBoxControl.Value = "forum98761@gmail.com"; } private void ButtonSetWrongTextBox_Click(object sender, EventArgs e) { textBoxControl.Value = "smth"; } private void ButtonGetObject_Click(object sender, EventArgs e) { Person? selectedPerson = listBoxControl.GetObject(); if (selectedPerson == null) MessageBox.Show("Обьект пустой"); MessageBox.Show($"Имя: {selectedPerson?.FirstName}, Фамилия: {selectedPerson?.LastName}, " + $"Возраст: {selectedPerson?.Age}, Пол: {selectedPerson?.Gender}"); } private void ButtonGetIndex_Click(object sender, EventArgs e) { MessageBox.Show(listBoxControl.SelectedIndex.ToString(), "Полученное значение"); } private void ButtonSetIndex_Click(object sender, EventArgs e) { listBoxControl.SelectedIndex = 0; } } }