diff --git a/WinForm/WinForm.sln b/WinForm/WinForm.sln
index 95c17eb..6efa8df 100644
--- a/WinForm/WinForm.sln
+++ b/WinForm/WinForm.sln
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33424.131
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinForm", "WinForm\WinForm.csproj", "{79A863DB-93E6-44C2-AB0F-DE0D19BE72DC}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinForm", "WinForm\WinForm.csproj", "{79A863DB-93E6-44C2-AB0F-DE0D19BE72DC}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsLibrary", "WinFormsLibrary\WinFormsLibrary.csproj", "{B617E65D-B482-4120-BC74-66B760D66FEF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +17,10 @@ Global
{79A863DB-93E6-44C2-AB0F-DE0D19BE72DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79A863DB-93E6-44C2-AB0F-DE0D19BE72DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79A863DB-93E6-44C2-AB0F-DE0D19BE72DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B617E65D-B482-4120-BC74-66B760D66FEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B617E65D-B482-4120-BC74-66B760D66FEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B617E65D-B482-4120-BC74-66B760D66FEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B617E65D-B482-4120-BC74-66B760D66FEF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/WinForm/WinFormsLibrary/DropDownList.Designer.cs b/WinForm/WinFormsLibrary/DropDownList.Designer.cs
new file mode 100644
index 0000000..0ca55a2
--- /dev/null
+++ b/WinForm/WinFormsLibrary/DropDownList.Designer.cs
@@ -0,0 +1,71 @@
+namespace WinForm
+{
+ partial class DropDownList
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ comboBox = new ComboBox();
+ labelTitle = new Label();
+ SuspendLayout();
+ //
+ // comboBox
+ //
+ comboBox.FormattingEnabled = true;
+ comboBox.Location = new Point(13, 39);
+ comboBox.Name = "comboBox";
+ comboBox.Size = new Size(232, 23);
+ comboBox.TabIndex = 0;
+ comboBox.SelectedValueChanged += ComboBox_SelectedValueChanged;
+ //
+ // labelTitle
+ //
+ labelTitle.AutoSize = true;
+ labelTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
+ labelTitle.Location = new Point(13, 11);
+ labelTitle.Name = "labelTitle";
+ labelTitle.Size = new Size(133, 15);
+ labelTitle.TabIndex = 1;
+ labelTitle.Text = "Выпадающий список";
+ //
+ // DropDownList
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(labelTitle);
+ Controls.Add(comboBox);
+ Name = "DropDownList";
+ Size = new Size(260, 80);
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private ComboBox comboBox;
+ private Label labelTitle;
+ }
+}
diff --git a/WinForm/WinFormsLibrary/DropDownList.cs b/WinForm/WinFormsLibrary/DropDownList.cs
new file mode 100644
index 0000000..adb11c9
--- /dev/null
+++ b/WinForm/WinFormsLibrary/DropDownList.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace WinForm
+{
+ public partial class DropDownList : UserControl
+ {
+ public DropDownList()
+ {
+ InitializeComponent();
+ }
+
+ public void Clear()
+ {
+ comboBox.Items.Clear();
+ }
+
+ public string Selected
+ {
+ get
+ {
+ if (comboBox.Items.Count == 0)
+ {
+ return "";
+ }
+ if (comboBox.SelectedItem == null)
+ {
+ return "";
+ }
+ return comboBox.SelectedItem.ToString()!;
+ }
+ set
+ {
+ if (comboBox.Items.Contains(value))
+ {
+ comboBox.SelectedItem = value;
+ }
+
+ }
+ }
+
+ public ComboBox.ObjectCollection ComboBoxItems
+ {
+ get { return comboBox.Items; }
+ }
+
+ private EventHandler _explicitEvent;
+ public event EventHandler ExplicitEvent
+ {
+ add
+ {
+ _explicitEvent += value;
+ }
+ remove
+ {
+ _explicitEvent -= value;
+ }
+ }
+
+ private void ComboBox_SelectedValueChanged(object sender, EventArgs e)
+ {
+ _explicitEvent?.Invoke(sender, e);
+ }
+ }
+}
diff --git a/WinForm/WinFormsLibrary/DropDownList.resx b/WinForm/WinFormsLibrary/DropDownList.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/WinForm/WinFormsLibrary/DropDownList.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/WinForm/WinFormsLibrary/ListBoxValues.Designer.cs b/WinForm/WinFormsLibrary/ListBoxValues.Designer.cs
new file mode 100644
index 0000000..9c07d6b
--- /dev/null
+++ b/WinForm/WinFormsLibrary/ListBoxValues.Designer.cs
@@ -0,0 +1,71 @@
+namespace WinForm
+{
+ partial class ListBoxValues
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ listBox = new ListBox();
+ componentTitleLabel = new Label();
+ SuspendLayout();
+ //
+ // listBox
+ //
+ listBox.FormattingEnabled = true;
+ listBox.ItemHeight = 15;
+ listBox.Location = new Point(12, 39);
+ listBox.Name = "listBox";
+ listBox.Size = new Size(172, 154);
+ listBox.TabIndex = 0;
+ //
+ // componentTitleLabel
+ //
+ componentTitleLabel.AutoSize = true;
+ componentTitleLabel.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
+ componentTitleLabel.Location = new Point(12, 12);
+ componentTitleLabel.Name = "componentTitleLabel";
+ componentTitleLabel.Size = new Size(108, 15);
+ componentTitleLabel.TabIndex = 1;
+ componentTitleLabel.Text = "Список занчений";
+ //
+ // ListBoxValues
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(componentTitleLabel);
+ Controls.Add(listBox);
+ Name = "ListBoxValues";
+ Size = new Size(200, 206);
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private ListBox listBox;
+ private Label componentTitleLabel;
+ }
+}
diff --git a/WinForm/WinFormsLibrary/ListBoxValues.cs b/WinForm/WinFormsLibrary/ListBoxValues.cs
new file mode 100644
index 0000000..a186a8c
--- /dev/null
+++ b/WinForm/WinFormsLibrary/ListBoxValues.cs
@@ -0,0 +1,113 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace WinForm
+{
+ public partial class ListBoxValues : UserControl
+ {
+ private string layoutString;
+ private string startSymbol;
+ private string endSymbol;
+
+ public ListBoxValues()
+ {
+ InitializeComponent();
+ }
+
+ public void SetLayoutInfo(string layout, string startS, string endS)
+ {
+ if (layout == null || startS == null || endS == null)
+ {
+ return;
+ }
+ layoutString = layout;
+ startSymbol = startS;
+ endSymbol = endS;
+ }
+
+ public int SelectedIndex
+ {
+ get
+ {
+ if (listBox.SelectedIndex == -1)
+ {
+ return -1;
+ }
+ return listBox.SelectedIndex;
+ }
+ set
+ {
+ if (listBox.SelectedItems.Count != 0)
+ {
+ listBox.SelectedIndex = value;
+ }
+ }
+ }
+
+ public T GetObjectFromStr() where T : class, new()
+ {
+ if (listBox.SelectedIndex == -1)
+ {
+ return null;
+ }
+ string row = listBox.SelectedItem.ToString()!;
+ T curObject = new T();
+ StringBuilder sb = new StringBuilder(row);
+ foreach (var property in typeof(T).GetProperties())
+ {
+ if (!property.CanWrite)
+ {
+ continue;
+ }
+
+ int borderOne = sb.ToString().IndexOf(startSymbol);
+ if (borderOne == -1)
+ {
+ break;
+ }
+
+ int borderTwo = sb.ToString().IndexOf(endSymbol, borderOne + 1);
+ if (borderTwo == -1)
+ {
+ break;
+ }
+
+ string propertyValue = sb.ToString(borderOne + 1, borderTwo - borderOne - 1);
+ sb.Remove(0, borderTwo + 1);
+ property.SetValue(curObject, Convert.ChangeType(propertyValue, property.PropertyType));
+ }
+ return curObject;
+ }
+
+ public void FillProperty(T dataObject, int rowIndex, string propertyName)
+ {
+ if (layoutString == null || startSymbol == null || endSymbol == null)
+ {
+ return;
+ }
+
+ while (listBox.Items.Count <= rowIndex)
+ {
+ listBox.Items.Add(layoutString);
+ }
+
+ string row = listBox.Items[rowIndex].ToString();
+ PropertyInfo propertyInfo = dataObject.GetType().GetProperty(propertyName);
+
+ if (propertyInfo != null)
+ {
+ object propertyValue = propertyInfo.GetValue(dataObject);
+ row = row.Replace($"{startSymbol}{propertyName}{endSymbol}", propertyValue.ToString());
+ listBox.Items[rowIndex] = row;
+ }
+ }
+ }
+}
diff --git a/WinForm/WinFormsLibrary/ListBoxValues.resx b/WinForm/WinFormsLibrary/ListBoxValues.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/WinForm/WinFormsLibrary/ListBoxValues.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/WinForm/WinFormsLibrary/NumberTextBox.Designer.cs b/WinForm/WinFormsLibrary/NumberTextBox.Designer.cs
new file mode 100644
index 0000000..96dec40
--- /dev/null
+++ b/WinForm/WinFormsLibrary/NumberTextBox.Designer.cs
@@ -0,0 +1,72 @@
+namespace WinForm
+{
+ partial class NumberTextBox
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ componentTitleLabel = new Label();
+ textBox = new TextBox();
+ SuspendLayout();
+ //
+ // componentTitleLabel
+ //
+ componentTitleLabel.AutoSize = true;
+ componentTitleLabel.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
+ componentTitleLabel.Location = new Point(13, 12);
+ componentTitleLabel.Name = "componentTitleLabel";
+ componentTitleLabel.Size = new Size(154, 15);
+ componentTitleLabel.TabIndex = 1;
+ componentTitleLabel.Text = "Введите номер телефона";
+ //
+ // textBox
+ //
+ textBox.Location = new Point(13, 41);
+ textBox.Name = "textBox";
+ textBox.Size = new Size(234, 23);
+ textBox.TabIndex = 2;
+ textBox.TextChanged += TextBox_TextChanged;
+ textBox.Enter += TextBox_Enter;
+ //
+ // NumberTextBox
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(textBox);
+ Controls.Add(componentTitleLabel);
+ Name = "NumberTextBox";
+ Size = new Size(260, 80);
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private TextBox numberTextBox;
+ private Label componentTitleLabel;
+ private TextBox textBox;
+ }
+}
diff --git a/WinForm/WinFormsLibrary/NumberTextBox.cs b/WinForm/WinFormsLibrary/NumberTextBox.cs
new file mode 100644
index 0000000..6d0d62b
--- /dev/null
+++ b/WinForm/WinFormsLibrary/NumberTextBox.cs
@@ -0,0 +1,86 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace WinForm
+{
+ public partial class NumberTextBox : UserControl
+ {
+ //Шаблон для textbox
+ private string? pattern;
+ private string example = "+7XXXXXXXXXX";
+
+ public NumberTextBox()
+ {
+ InitializeComponent();
+ }
+
+ //Публичное свойство для получения и заполнения шаблона
+ public string? Pattern
+ {
+ get { return pattern; }
+ set { pattern = value; }
+ }
+
+ public string? TextBoxValue
+ {
+ get
+ {
+ if (new Regex(Pattern).IsMatch(textBox.Text))
+ {
+ return textBox.Text;
+ }
+ return null;
+ }
+ set
+ {
+ if (new Regex(Pattern).IsMatch(value))
+ {
+ textBox.Text = value;
+ }
+
+ }
+ }
+
+ //Метод для заполнения примера
+ public void SetExample(string str)
+ {
+ if (new Regex(Pattern).IsMatch(str))
+ {
+ example = str;
+ }
+ }
+
+ private void TextBox_Enter(object sender, EventArgs e)
+ {
+ int VisibleTime = 3000;
+ ToolTip tt = new ToolTip();
+ tt.Show(example, textBox, 0, 25, VisibleTime);
+ }
+
+ private EventHandler _explicitEvent;
+ public event EventHandler ExplicitEvent
+ {
+ add
+ {
+ _explicitEvent += value;
+ }
+ remove
+ {
+ _explicitEvent -= value;
+ }
+ }
+
+ private void TextBox_TextChanged(object sender, EventArgs e)
+ {
+ _explicitEvent?.Invoke(sender, e);
+ }
+ }
+}
diff --git a/WinForm/WinFormsLibrary/NumberTextBox.resx b/WinForm/WinFormsLibrary/NumberTextBox.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/WinForm/WinFormsLibrary/NumberTextBox.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file