83 lines
1.8 KiB
C#
83 lines
1.8 KiB
C#
|
using CustomComponents.Objects;
|
|||
|
|
|||
|
namespace LibraryView
|
|||
|
{
|
|||
|
public partial class FormLibrary : Form
|
|||
|
{
|
|||
|
Person person1 = new Person("Иван", "Иванов");
|
|||
|
Person person2 = new Person("Максим", "Петров");
|
|||
|
public FormLibrary()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
dateTextBox1.Pattern = @"^(\d{2}.\d{2}.\d{4})$";
|
|||
|
listBoxObjects1.SetLayoutInfo("Имя *Name* Фамилия *Surname*", "*", "*");
|
|||
|
dropDownList.AddingToList("info1");
|
|||
|
dropDownList.AddingToList("info2");
|
|||
|
dropDownList.AddingToList("info3");
|
|||
|
}
|
|||
|
|
|||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
dropDownList.AddingToList("info11");
|
|||
|
dropDownList.AddingToList("info12");
|
|||
|
dropDownList.AddingToList("info13");
|
|||
|
}
|
|||
|
|
|||
|
private void Event_Test()
|
|||
|
{
|
|||
|
MessageBox.Show("Изменено");
|
|||
|
}
|
|||
|
|
|||
|
private void buttonShowElement_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
labelShow.Text = dropDownList.Selected;
|
|||
|
}
|
|||
|
|
|||
|
private void buttonClear_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
dropDownList.Clear();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private void buttonSetExample_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (textBoxExample.Text == String.Empty)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
dateTextBox1.setExample(textBoxExample.Text);
|
|||
|
}
|
|||
|
|
|||
|
private void buttonShowTextBox_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (dateTextBox1.TextBoxValue != null)
|
|||
|
{
|
|||
|
labelShowTB.Text = "true";
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
MessageBox.Show(ex.Message);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void buttonAddObjects_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
listBoxObjects1.AddInListBox<Person>(person1);
|
|||
|
listBoxObjects1.AddInListBox<Person>(person2);
|
|||
|
}
|
|||
|
|
|||
|
private void buttonShowItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
string str = listBoxObjects1.GetObjectFromStr<Person>()
|
|||
|
.Name + " " + listBoxObjects1.GetObjectFromStr<Person>()
|
|||
|
.Surname;
|
|||
|
labelShowInput.Text = str;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|