From 9c83262c3e584caddfcc8ef8884a29087aa5c5f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D0=BC=D0=B8=D1=80=20=D0=94?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=BB=D0=BE=D0=B2?= Date: Fri, 20 Sep 2024 08:33:51 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BC=D0=BF=D0=BE=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D1=82=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Components/Components.csproj | 10 ++ Components/Components.sln | 25 +++++ Components/CustomDataGridView.Designer.cs | 37 +++++++ Components/CustomDataGridView.cs | 20 ++++ Components/CustomDataGridView.resx | 120 ++++++++++++++++++++++ Components/CustomListBox.Designer.cs | 57 ++++++++++ Components/CustomListBox.cs | 49 +++++++++ Components/CustomListBox.resx | 120 ++++++++++++++++++++++ Components/CustomTextBox.Designer.cs | 37 +++++++ Components/CustomTextBox.cs | 20 ++++ Components/CustomTextBox.resx | 120 ++++++++++++++++++++++ Components/Person.cs | 14 +++ 12 files changed, 629 insertions(+) create mode 100644 Components/Components.csproj create mode 100644 Components/Components.sln create mode 100644 Components/CustomDataGridView.Designer.cs create mode 100644 Components/CustomDataGridView.cs create mode 100644 Components/CustomDataGridView.resx create mode 100644 Components/CustomListBox.Designer.cs create mode 100644 Components/CustomListBox.cs create mode 100644 Components/CustomListBox.resx create mode 100644 Components/CustomTextBox.Designer.cs create mode 100644 Components/CustomTextBox.cs create mode 100644 Components/CustomTextBox.resx create mode 100644 Components/Person.cs diff --git a/Components/Components.csproj b/Components/Components.csproj new file mode 100644 index 0000000..3e210aa --- /dev/null +++ b/Components/Components.csproj @@ -0,0 +1,10 @@ + + + + net8.0-windows + enable + true + enable + + + diff --git a/Components/Components.sln b/Components/Components.sln new file mode 100644 index 0000000..de68749 --- /dev/null +++ b/Components/Components.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Components", "Components.csproj", "{D813A63B-837E-45AD-8F7D-B6A964F1B794}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D813A63B-837E-45AD-8F7D-B6A964F1B794}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D813A63B-837E-45AD-8F7D-B6A964F1B794}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D813A63B-837E-45AD-8F7D-B6A964F1B794}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D813A63B-837E-45AD-8F7D-B6A964F1B794}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C5C673BE-0306-44AF-9FA5-36E50BAD9083} + EndGlobalSection +EndGlobal diff --git a/Components/CustomDataGridView.Designer.cs b/Components/CustomDataGridView.Designer.cs new file mode 100644 index 0000000..540bbf8 --- /dev/null +++ b/Components/CustomDataGridView.Designer.cs @@ -0,0 +1,37 @@ +namespace Components +{ + partial class CustomDataGridView + { + /// + /// Обязательная переменная конструктора. + /// + 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() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/Components/CustomDataGridView.cs b/Components/CustomDataGridView.cs new file mode 100644 index 0000000..727cb65 --- /dev/null +++ b/Components/CustomDataGridView.cs @@ -0,0 +1,20 @@ +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 Components +{ + public partial class CustomDataGridView : UserControl + { + public CustomDataGridView() + { + InitializeComponent(); + } + } +} diff --git a/Components/CustomDataGridView.resx b/Components/CustomDataGridView.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Components/CustomDataGridView.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/Components/CustomListBox.Designer.cs b/Components/CustomListBox.Designer.cs new file mode 100644 index 0000000..ecd437f --- /dev/null +++ b/Components/CustomListBox.Designer.cs @@ -0,0 +1,57 @@ +namespace Components +{ + partial class CustomListBox + { + /// + /// Обязательная переменная конструктора. + /// + 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(); + SuspendLayout(); + // + // listBox + // + listBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + listBox.FormattingEnabled = true; + listBox.ItemHeight = 15; + listBox.Location = new Point(3, 5); + listBox.Name = "listBox"; + listBox.Size = new Size(144, 139); + listBox.TabIndex = 0; + // + // CustomListBox + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + Controls.Add(listBox); + Name = "CustomListBox"; + ResumeLayout(false); + } + + #endregion + + private ListBox listBox; + } +} diff --git a/Components/CustomListBox.cs b/Components/CustomListBox.cs new file mode 100644 index 0000000..dfa9dd5 --- /dev/null +++ b/Components/CustomListBox.cs @@ -0,0 +1,49 @@ +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 Components +{ + public partial class CustomListBox : UserControl + { + private event EventHandler? _itemSelected; + + public CustomListBox() + { + InitializeComponent(); + } + + public void SetItems(List items) + { + listBox.Items.AddRange(items.ToArray()); + } + + public void ClearList() + { + listBox.Items.Clear(); + } + + public string SelectedItem + { + get { return (string?)listBox.SelectedItem ?? string.Empty; } + set { listBox.SelectedItem = value; } + } + + public event EventHandler? ItemSelected + { + add { _itemSelected += value; } + remove { _itemSelected -= value; } + } + + private void MainListBox_SelectedIndexChanged(object sender, EventArgs e) + { + _itemSelected?.Invoke(this, e); + } + } +} diff --git a/Components/CustomListBox.resx b/Components/CustomListBox.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/Components/CustomListBox.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/Components/CustomTextBox.Designer.cs b/Components/CustomTextBox.Designer.cs new file mode 100644 index 0000000..898ebd8 --- /dev/null +++ b/Components/CustomTextBox.Designer.cs @@ -0,0 +1,37 @@ +namespace Components +{ + partial class CustomTextBox + { + /// + /// Обязательная переменная конструктора. + /// + 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() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/Components/CustomTextBox.cs b/Components/CustomTextBox.cs new file mode 100644 index 0000000..388b673 --- /dev/null +++ b/Components/CustomTextBox.cs @@ -0,0 +1,20 @@ +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 Components +{ + public partial class CustomTextBox : UserControl + { + public CustomTextBox() + { + InitializeComponent(); + } + } +} diff --git a/Components/CustomTextBox.resx b/Components/CustomTextBox.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Components/CustomTextBox.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/Components/Person.cs b/Components/Person.cs new file mode 100644 index 0000000..7358f4a --- /dev/null +++ b/Components/Person.cs @@ -0,0 +1,14 @@ +namespace Components.Object +{ + public class Person + { + public string Name { get; set; } + public int Age { get; set; } + + public Person(string name, int age) + { + Name = name; + Age = age; + } + } +}