98 lines
3.2 KiB
C#
98 lines
3.2 KiB
C#
using COPWinForms;
|
|
using System.Collections.Generic;
|
|
using System.Windows.Forms;
|
|
|
|
namespace WinFormsTest
|
|
{
|
|
public partial class FormTestApp : Form
|
|
{
|
|
List<string> list = new List<string>();
|
|
List<Student> students = new List<Student>();
|
|
public FormTestApp()
|
|
{
|
|
list = new List<string>();
|
|
list.AddRange(new string[] { "Çíà÷åíèå 1", "Çíà÷åíèå 2", "Çíà÷åíèå 3", "Çíà÷åíèå 4", "Çíà÷åíèå 5" });
|
|
|
|
Student student1 = new Student("Ðîãàøîâà Å.À.", "ÏÈáä-32", "rogashovae@mail.ru");
|
|
Student student2 = new Student("Ïåòðîâ Ï.Â.", "Ýóáä-11", "petrov@gmail.com");
|
|
Student student3 = new Student("Íîñêîâà À.À.", "ÏÌáä-41", "noskovaaa@gmail.com");
|
|
Student student4 = new Student("Íîñêîâ À.À.", "ÏCáä-41", "noskovaa@gmail.com");
|
|
|
|
students.Add(student1);
|
|
students.Add(student2);
|
|
students.Add(student3);
|
|
students.Add(student4);
|
|
InitializeComponent();
|
|
|
|
componenttBox1.Pattern = @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$";
|
|
componentlBox1.SetLayoutInfo("ÔÈÎ: *FIO* Ãðóïïà: *Group* Email: *Email*", "*", "*");
|
|
componentlBox1.AddInListBox(students);
|
|
componentcBox1.AddingToList(new List<string>() { "ïðèâåò", "ÿ", "êîìïîíåíò" });
|
|
componentcBox1.ExplicitEvent += Event_Handler;
|
|
componenttBox1.ExplicitEvent += Event_Handler;
|
|
componenttBox1.setExample("eeee@mail.ru");
|
|
}
|
|
|
|
private void buttonAdd_Click(object sender, EventArgs e)
|
|
{
|
|
componentcBox1.AddingToList(list);
|
|
}
|
|
|
|
private void Event_Handler(object sender, EventArgs e)
|
|
{
|
|
MessageBox.Show("Èçìåíåííî");
|
|
}
|
|
|
|
private void buttonShow_Click(object sender, EventArgs e)
|
|
{
|
|
textBoxShow.Text = componentcBox1.Selected;
|
|
}
|
|
|
|
private void buttonClear_Click(object sender, EventArgs e)
|
|
{
|
|
componentcBox1.Clear();
|
|
}
|
|
|
|
|
|
//private void buttonSetExample_Click(object sender, EventArgs e)
|
|
//{
|
|
// if (textBoxExample.Text == String.Empty)
|
|
// {
|
|
// return;
|
|
// }
|
|
// componenttBox1.setExample(textBoxExample.Text);
|
|
//}
|
|
|
|
private void buttonShowTB_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (componenttBox1.TextBoxValue != null)
|
|
{
|
|
textBoxShowTB.Text = "true";
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
componentlBox1.AddInListBox<Student>(students);
|
|
}
|
|
|
|
private void buttonShowItem_Click(object sender, EventArgs e)
|
|
{
|
|
string str = componentlBox1.GetObjectFromStr<Student>().FIO + " " + componentlBox1.GetObjectFromStr<Student>().Group + " " + componentlBox1.GetObjectFromStr<Student>().Email;
|
|
textBoxShowItem.Text = str;
|
|
}
|
|
private void componentcBox1_ExplicitEvent(object sender, EventArgs e)
|
|
{
|
|
MessageBox.Show("Change avatar");
|
|
}
|
|
}
|
|
} |