PIbd-31_Rodionov.I.A._COP_28/COP/WinForms/FormTest.cs

69 lines
2.6 KiB
C#
Raw Normal View History

2024-09-05 19:32:10 +04:00
namespace WinForms
{
2024-09-05 23:36:10 +04:00
public partial class FormTest : Form
2024-09-05 19:32:10 +04:00
{
2024-09-05 23:36:10 +04:00
public FormTest()
2024-09-05 19:32:10 +04:00
{
InitializeComponent();
2024-09-21 11:26:26 +04:00
comboBoxControl.AddItems(new List<string> { "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5" });
textBoxControl.Pattern = @"^[a-z0-9._%+-]+\@([a-z0-9-]+\.)+[a-z]{2,4}$";
textBoxControl.SetTooltipText("example@gmail.com");
listBoxControl.SetParams("<22><><EFBFBD>: {FirstName}, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: {LastName}. {Gender} ({Age}) <20><><EFBFBD>.", '{', '}');
listBoxControl.AddItems(new List<Person> { new() { FirstName = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", LastName = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", Age = 23, Gender = "<22><><EFBFBD>" },
new() { FirstName = "<22><><EFBFBD><EFBFBD><EFBFBD>", LastName = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", Age = 18, Gender = "<22><><EFBFBD>" },
new() { FirstName = "<22><><EFBFBD>", LastName = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", Age = 40, Gender = "<22><><EFBFBD>" } });
}
private void ButtonClear_Click(object sender, EventArgs e)
{
comboBoxControl.Clear();
}
private void ButtonGetComboBox_Click(object sender, EventArgs e)
{
MessageBox.Show(comboBoxControl.SelectedValue, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
private void ButtonSetComboBox_Click(object sender, EventArgs e)
{
comboBoxControl.SelectedValue = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3";
}
private void ButtonGetTextBox_Click(object sender, EventArgs e)
{
MessageBox.Show(textBoxControl.Value, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
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<Person>();
if (selectedPerson == null)
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
MessageBox.Show($"<22><><EFBFBD>: {selectedPerson?.FirstName}, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: {selectedPerson?.LastName}, " +
$"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: {selectedPerson?.Age}, <20><><EFBFBD>: {selectedPerson?.Gender}");
}
private void ButtonGetIndex_Click(object sender, EventArgs e)
{
MessageBox.Show(listBoxControl.SelectedIndex.ToString(), "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
private void ButtonSetIndex_Click(object sender, EventArgs e)
{
listBoxControl.SelectedIndex = 0;
2024-09-05 19:32:10 +04:00
}
}
}