diff --git a/VisualComponentsForm/VisualComponentsForm/Form1.Designer.cs b/VisualComponentsForm/VisualComponentsForm/FormMain.Designer.cs
similarity index 78%
rename from VisualComponentsForm/VisualComponentsForm/Form1.Designer.cs
rename to VisualComponentsForm/VisualComponentsForm/FormMain.Designer.cs
index f857ff1..98a0549 100644
--- a/VisualComponentsForm/VisualComponentsForm/Form1.Designer.cs
+++ b/VisualComponentsForm/VisualComponentsForm/FormMain.Designer.cs
@@ -1,6 +1,6 @@
namespace VisualComponentsForm
{
- partial class Form1
+ partial class FormMain
{
///
/// Required designer variable.
@@ -28,10 +28,10 @@
///
private void InitializeComponent()
{
- this.components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
- this.Text = "Form1";
+ components = new System.ComponentModel.Container();
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Text = "Form1";
}
#endregion
diff --git a/VisualComponentsForm/VisualComponentsForm/Form1.cs b/VisualComponentsForm/VisualComponentsForm/FormMain.cs
similarity index 59%
rename from VisualComponentsForm/VisualComponentsForm/Form1.cs
rename to VisualComponentsForm/VisualComponentsForm/FormMain.cs
index 4e38605..c5ccc56 100644
--- a/VisualComponentsForm/VisualComponentsForm/Form1.cs
+++ b/VisualComponentsForm/VisualComponentsForm/FormMain.cs
@@ -1,8 +1,8 @@
namespace VisualComponentsForm
{
- public partial class Form1 : Form
+ public partial class FormMain : Form
{
- public Form1()
+ public FormMain()
{
InitializeComponent();
}
diff --git a/VisualComponentsForm/VisualComponentsForm/Form1.resx b/VisualComponentsForm/VisualComponentsForm/FormMain.resx
similarity index 93%
rename from VisualComponentsForm/VisualComponentsForm/Form1.resx
rename to VisualComponentsForm/VisualComponentsForm/FormMain.resx
index 1af7de1..a395bff 100644
--- a/VisualComponentsForm/VisualComponentsForm/Form1.resx
+++ b/VisualComponentsForm/VisualComponentsForm/FormMain.resx
@@ -1,24 +1,24 @@
-
diff --git a/VisualComponentsForm/VisualComponentsForm/Program.cs b/VisualComponentsForm/VisualComponentsForm/Program.cs
index 90b9f61..9647fa6 100644
--- a/VisualComponentsForm/VisualComponentsForm/Program.cs
+++ b/VisualComponentsForm/VisualComponentsForm/Program.cs
@@ -11,7 +11,7 @@ namespace VisualComponentsForm
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
+ Application.Run(new FormMain());
}
}
}
\ No newline at end of file
diff --git a/VisualComponentsLib/CustomListBox/MyListBox.cs b/VisualComponentsLib/CustomListBox/MyListBox.cs
index 63fe1da..689c249 100644
--- a/VisualComponentsLib/CustomListBox/MyListBox.cs
+++ b/VisualComponentsLib/CustomListBox/MyListBox.cs
@@ -8,6 +8,40 @@ namespace VisualComponentsLib.CustomListBox
{
public class MyListBox : ListBox
{
+ //получение выбранного значения
+ string _chooiceElem { get; set; } = string.Empty;
+ //делегат на смену значения
+ public delegate void GetNewVal(string data, EventArgs e);
+
+ //событие
+ public event GetNewVal ChangeSelectedVal;
+
+ //base constructor; привязываем событие к делегату
+ public MyListBox() : base()
+ {
+ ChangeSelectedVal += _changeSelectedVal;
+ }
+
+ public void _addNewElem(string data)
+ {
+ Items.Add(data);
+ }
+
+ public void _clearListBox()
+ {
+ Items.Clear();
+ }
+
+ public void _clickToList(string data, EventArgs e)
+ {
+ ChangeSelectedVal(data, e);
+ }
+
+ //перезапись поля при событии смены значения
+ public void _changeSelectedVal(string data, EventArgs e)
+ {
+ _chooiceElem = data;
+ }
}
}