using MyUserControls; using System.ComponentModel; namespace WinFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); InitialChekedListBox(); InitialSmartTextBox(); InitialTree(); testComponent1.FileName = "1.txt"; } private void InitialChekedListBox() { smartCheckedListBox1.AddItem("Ýëåìåíò 1"); smartCheckedListBox1.AddItem("Ýëåìåíò 2"); smartCheckedListBox1.AddItem("Ýëåìåíò 3"); smartCheckedListBox1.SelectedValue = "Ýëåìåíò 3"; } private void InitialSmartTextBox() { smartTextBox1.MinLength = 0; smartTextBox1.MaxLength = 1000; smartTextBox1.InputText = "jjjjj"; } private void InitialTree() { var obj1 = new SampleClass { Name = "Item1", Category = "Category1", SubCategory = "SubCategory1" }; var obj2 = new SampleClass { Name = "Item2", Category = "Category1", SubCategory = "SubCategory2" }; List properties = new List { "Name", "Category", "SubCategory" }; hierarchicalTreeView.SetPropertyHierarchy(properties); hierarchicalTreeView.AddObject(obj1); hierarchicalTreeView.AddObject(obj2); hierarchicalTreeView.SelectNode(1, "SubCategory2"); smartTextBox1.InputText = hierarchicalTreeView.GetSelectedItem().ToString(); } private void buttonSave_Click(object sender, EventArgs e) { try { testComponent1.SaveToFile(richTextBoxText.Lines); MessageBox.Show("Ñîõàðíåíî óñïåøíî", "Ðåçóëüòàò", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }