PIbd-31_MasenkinMS_COP_22/Components/WinForms/FormVisualComponents.cs

135 lines
4.3 KiB
C#
Raw Normal View History

2024-09-05 18:48:14 +04:00
namespace WinForms
{
2024-09-05 18:58:41 +04:00
/// <summary>
2024-09-06 04:27:34 +04:00
/// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-09-05 18:58:41 +04:00
/// </summary>
2024-09-06 04:27:34 +04:00
public partial class FormVisualComponents : Form
2024-09-05 18:48:14 +04:00
{
2024-09-05 18:58:41 +04:00
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
2024-09-06 04:27:34 +04:00
public FormVisualComponents()
2024-09-05 18:48:14 +04:00
{
InitializeComponent();
2024-09-05 18:58:41 +04:00
customComboBox.AddItem("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1");
customComboBox.AddItem("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2");
customComboBox.AddItem("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3");
customTextBox.DatePattern = @"^(\d{2}.\d{2}.\d{4})$";
customListBox.SetLayoutInfo("<22><><EFBFBD> *Name* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *Surname*", "*", "*");
}
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> customComboBox
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonAddItems_Click(object sender, EventArgs e)
{
customComboBox.AddItem("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3");
customComboBox.AddItem("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4");
customComboBox.AddItem("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5");
}
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> customComboBox
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonClearItems_Click(object sender, EventArgs e)
{
customComboBox.Clear();
}
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> customComboBox
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonGetItem_Click(object sender, EventArgs e)
{
labelItem.Text = customComboBox.SelectedItem.ToString();
}
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> customTextBox
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonValidate_Click(object sender, EventArgs e)
{
try
{
if (customTextBox.TextBoxValue != null)
{
checkBoxValidate.Text = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
checkBoxValidate.Checked = true;
checkBoxValidate.BackColor = Color.LightGreen;
}
}
catch (Exception ex)
{
checkBoxValidate.Text = "<22><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
checkBoxValidate.Checked = false;
checkBoxValidate.BackColor = Color.Red;
MessageBox.Show(ex.Message);
}
}
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> customTextBox
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonSetDateExample_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxDateExample.Text))
{
return;
}
if (customTextBox.SetDateExample(textBoxDateExample.Text))
{
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", "<22><><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> customListBox
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonAddObjects_Click(object sender, EventArgs e)
{
customListBox.AddObject<Person>(new Person("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD>"));
customListBox.AddObject<Person>(new Person("<22><><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
customListBox.AddObject<Person>(new Person("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
}
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> customListBox
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonGetObject_Click(object sender, EventArgs e)
{
2024-09-06 04:27:34 +04:00
Employee person = customListBox.GetObject<Employee>();
2024-09-05 18:58:41 +04:00
if (person == null)
{
labelObjectInfo.Text = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
return;
}
string objectInfo = person.Name + " " + person.Surname;
labelObjectInfo.Text = objectInfo;
2024-09-05 18:48:14 +04:00
}
}
}