74 lines
2.3 KiB
C#
74 lines
2.3 KiB
C#
namespace Forms
|
|
{
|
|
public partial class Form : System.Windows.Forms.Form
|
|
{
|
|
public Form()
|
|
{
|
|
InitializeComponent();
|
|
FillBox();
|
|
FillTextBox();
|
|
FillList();
|
|
}
|
|
|
|
private void FillBox()
|
|
{
|
|
controlComboBox.ComboBoxItems.Add("Çíà÷åíèå 1");
|
|
controlComboBox.ComboBoxItems.Add("Çíà÷åíèå 2");
|
|
controlComboBox.ComboBoxItems.Add("Çíà÷åíèå 3");
|
|
controlComboBox.ComboBoxItems.Add("Çíà÷åíèå 4");
|
|
controlComboBox.SelectedItem = "dafafadsf";
|
|
}
|
|
private void FillTextBox()
|
|
{
|
|
controlTextBox.NumPattern = @"^\+7\d{10}$";
|
|
controlTextBox.text = "+79063908075";
|
|
}
|
|
private void FillList()
|
|
{
|
|
controlListBox.SetTemplateString("Ïðèâåò [Name] dsfdsfds [Surname]", "[", "]");
|
|
controlListBox.FillProp<Person>(new Person("Ñàøêasdasà", "Èçîòîâ"), 0, "Name");
|
|
controlListBox.FillProp<Person>(new Person("Ñàøêà", "Èçîòîâ"), 4, "Surname");
|
|
}
|
|
|
|
private void controlComboBox_ComboBoxChanged(object sender, EventArgs e)
|
|
{
|
|
var elem = controlComboBox.SelectedItem;
|
|
MessageBox.Show($"Âûáðàííî: {elem}");
|
|
}
|
|
|
|
private void controlTextBox_CheckBoxChanged(object sender, EventArgs e)
|
|
{
|
|
if (controlTextBox.text == null)
|
|
{
|
|
MessageBox.Show($"CheckBox checked");
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show($"CheckBox not checked");
|
|
}
|
|
}
|
|
|
|
private void buttonGetObj_Click(object sender, EventArgs e)
|
|
{
|
|
var obj = controlListBox.GetSelectedObject<Person>();
|
|
MessageBox.Show($"{obj.Name} {obj.Surname}");
|
|
}
|
|
|
|
private void buttonClear_Click(object sender, EventArgs e)
|
|
{
|
|
//controlDataGrid.ClearData();
|
|
}
|
|
|
|
private void buttonEnter_Click(object sender, EventArgs e)
|
|
{
|
|
var val = controlTextBox.text;
|
|
MessageBox.Show($"Ââåäåíî {val}");
|
|
}
|
|
|
|
private void buttonAdd_Click(object sender, EventArgs e)
|
|
{
|
|
//controlDataGrid.SetData<Person>(new Person(1, "asdasdas", "asdasd1asd"), 2, 3);
|
|
}
|
|
}
|
|
}
|