diff --git a/ComponentProgramming/ComponentProgramming.sln b/ComponentProgramming/ComponentProgramming.sln
index 76de1e4..b2c5b1b 100644
--- a/ComponentProgramming/ComponentProgramming.sln
+++ b/ComponentProgramming/ComponentProgramming.sln
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.9.34714.143
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComponentProgramming", "ComponentProgramming\ComponentProgramming.csproj", "{97AC6509-906E-4688-9C6F-67406629A6CA}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Forms", "Forms\Forms.csproj", "{A490A64E-3A3B-4782-B0DB-142543BDC6A5}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
{97AC6509-906E-4688-9C6F-67406629A6CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97AC6509-906E-4688-9C6F-67406629A6CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97AC6509-906E-4688-9C6F-67406629A6CA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A490A64E-3A3B-4782-B0DB-142543BDC6A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A490A64E-3A3B-4782-B0DB-142543BDC6A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A490A64E-3A3B-4782-B0DB-142543BDC6A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A490A64E-3A3B-4782-B0DB-142543BDC6A5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/ComponentProgramming/ComponentProgramming/ControlComboBox.Designer.cs b/ComponentProgramming/ComponentProgramming/ControlComboBox.Designer.cs
new file mode 100644
index 0000000..00dceff
--- /dev/null
+++ b/ComponentProgramming/ComponentProgramming/ControlComboBox.Designer.cs
@@ -0,0 +1,58 @@
+namespace ComponentProgramming
+{
+ partial class ControlComboBox
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ 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()
+ {
+ comboBoxElements = new ComboBox();
+ SuspendLayout();
+ //
+ // comboBoxElements
+ //
+ comboBoxElements.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ comboBoxElements.FormattingEnabled = true;
+ comboBoxElements.Location = new Point(4, 3);
+ comboBoxElements.Name = "comboBoxElements";
+ comboBoxElements.Size = new Size(170, 23);
+ comboBoxElements.TabIndex = 0;
+ comboBoxElements.SelectedIndexChanged += comboBoxElements_SelectedIndexChanged;
+ //
+ // ControlComboBox
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(comboBoxElements);
+ Name = "ControlComboBox";
+ Size = new Size(177, 29);
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private ComboBox comboBoxElements;
+ }
+}
diff --git a/ComponentProgramming/ComponentProgramming/ControlComboBox.cs b/ComponentProgramming/ComponentProgramming/ControlComboBox.cs
new file mode 100644
index 0000000..8766ef9
--- /dev/null
+++ b/ComponentProgramming/ComponentProgramming/ControlComboBox.cs
@@ -0,0 +1,53 @@
+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;
+using static System.Runtime.InteropServices.JavaScript.JSType;
+
+namespace ComponentProgramming
+{
+ public partial class ControlComboBox : UserControl
+ {
+ private event EventHandler? _comboBoxChanged;
+ private event Action? _errorOccured;
+ public string Error { get; private set; }
+
+ public object?[] elements
+ {
+ get { return comboBoxElements.SelectedItem == null ? [" "] : [comboBoxElements.SelectedItem]; }
+ set { comboBoxElements.Items.AddRange(value); }
+ }
+
+ public event EventHandler ComboBoxChanged
+ {
+ add { _comboBoxChanged += value; }
+ remove { _comboBoxChanged -= value; }
+ }
+ public event Action AnErrorOccured
+ {
+ add { _errorOccured += value; }
+ remove { _errorOccured -= value; }
+ }
+
+ public ControlComboBox()
+ {
+ InitializeComponent();
+ Error = string.Empty;
+ }
+
+ public void ClearComboBox()
+ {
+ comboBoxElements.Items.Clear();
+ }
+
+ private void comboBoxElements_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ _comboBoxChanged?.Invoke(this, e);
+ }
+ }
+}
diff --git a/ComponentProgramming/ComponentProgramming/ControlComboBox.resx b/ComponentProgramming/ComponentProgramming/ControlComboBox.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/ComponentProgramming/ComponentProgramming/ControlComboBox.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/ComponentProgramming/ComponentProgramming/ControlImage.Designer.cs b/ComponentProgramming/ComponentProgramming/ControlImage.Designer.cs
new file mode 100644
index 0000000..9df1a7c
--- /dev/null
+++ b/ComponentProgramming/ComponentProgramming/ControlImage.Designer.cs
@@ -0,0 +1,72 @@
+namespace ComponentProgramming
+{
+ partial class ControlImage
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ 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()
+ {
+ pictureBoxAvatar = new PictureBox();
+ buttonLoad = new Button();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxAvatar).BeginInit();
+ SuspendLayout();
+ //
+ // pictureBoxAvatar
+ //
+ pictureBoxAvatar.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ pictureBoxAvatar.Location = new Point(3, 3);
+ pictureBoxAvatar.Name = "pictureBoxAvatar";
+ pictureBoxAvatar.Size = new Size(144, 115);
+ pictureBoxAvatar.TabIndex = 0;
+ pictureBoxAvatar.TabStop = false;
+ //
+ // buttonLoad
+ //
+ buttonLoad.Anchor = AnchorStyles.Bottom;
+ buttonLoad.Location = new Point(35, 124);
+ buttonLoad.Name = "buttonLoad";
+ buttonLoad.Size = new Size(75, 23);
+ buttonLoad.TabIndex = 1;
+ buttonLoad.Text = "Загрузить";
+ buttonLoad.UseVisualStyleBackColor = true;
+ buttonLoad.Click += buttonLoad_Click;
+ //
+ // Control
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(buttonLoad);
+ Controls.Add(pictureBoxAvatar);
+ Name = "Control";
+ ((System.ComponentModel.ISupportInitialize)pictureBoxAvatar).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private PictureBox pictureBoxAvatar;
+ private Button buttonLoad;
+ }
+}
diff --git a/ComponentProgramming/ComponentProgramming/ControlImage.cs b/ComponentProgramming/ComponentProgramming/ControlImage.cs
new file mode 100644
index 0000000..2f81f49
--- /dev/null
+++ b/ComponentProgramming/ComponentProgramming/ControlImage.cs
@@ -0,0 +1,67 @@
+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 ComponentProgramming
+{
+ public partial class ControlImage : UserControl
+ {
+ private event EventHandler? _avatarChanged;
+ private event Action? _errorOccured;
+ public string Error { get; private set; }
+ public Image Avatar
+ {
+ get
+ {
+ return pictureBoxAvatar.Image;
+ }
+ set
+ {
+ pictureBoxAvatar.Image = value;
+ }
+ }
+
+ public event EventHandler AvatarChanged
+ {
+ add { _avatarChanged += value; }
+ remove { _avatarChanged -= value; }
+ }
+
+ public event Action AnErrorOccured
+ {
+ add { _errorOccured += value; }
+ remove { _errorOccured -= value; }
+ }
+
+ public ControlImage()
+ {
+ InitializeComponent();
+ Error = string.Empty;
+ }
+
+ private void buttonLoad_Click(object sender, EventArgs e)
+ {
+ var ofd = new OpenFileDialog();
+ if(ofd.ShowDialog() == DialogResult.OK)
+ {
+ try
+ {
+ pictureBoxAvatar.Image = Image.FromFile(ofd.FileName);
+ pictureBoxAvatar.Width = pictureBoxAvatar.Image.Width;
+ _avatarChanged?.Invoke(this, e);
+ }
+ catch( Exception ex)
+ {
+ Error = ex.Message;
+ _errorOccured?.Invoke();
+ }
+ }
+ }
+ }
+}
diff --git a/ComponentProgramming/ComponentProgramming/ControlImage.resx b/ComponentProgramming/ComponentProgramming/ControlImage.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/ComponentProgramming/ComponentProgramming/ControlImage.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/ComponentProgramming/Forms/Form.Designer.cs b/ComponentProgramming/Forms/Form.Designer.cs
new file mode 100644
index 0000000..d715ba8
--- /dev/null
+++ b/ComponentProgramming/Forms/Form.Designer.cs
@@ -0,0 +1,58 @@
+namespace Forms
+{
+ partial class Form
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ controlComboBox = new ComponentProgramming.ControlComboBox();
+ SuspendLayout();
+ //
+ // controlComboBox
+ //
+ controlComboBox.Location = new Point(12, 3);
+ controlComboBox.Name = "controlComboBox";
+ controlComboBox.Size = new Size(177, 31);
+ controlComboBox.TabIndex = 0;
+ controlComboBox.ComboBoxChanged += controlComboBox_ComboBoxChanged;
+ //
+ // Form
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Controls.Add(controlComboBox);
+ Name = "Form";
+ Text = "Form";
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private ComponentProgramming.ControlImage control;
+ private ComponentProgramming.ControlComboBox controlComboBox;
+ }
+}
diff --git a/ComponentProgramming/Forms/Form.cs b/ComponentProgramming/Forms/Form.cs
new file mode 100644
index 0000000..0c9924b
--- /dev/null
+++ b/ComponentProgramming/Forms/Form.cs
@@ -0,0 +1,22 @@
+namespace Forms
+{
+ public partial class Form : System.Windows.Forms.Form
+ {
+ public Form()
+ {
+ InitializeComponent();
+ FillBox();
+ }
+
+ private void FillBox()
+ {
+ controlComboBox.elements = new object[] {" 1", " 2", " 3", " 4" };
+ }
+
+ private void controlComboBox_ComboBoxChanged(object sender, EventArgs e)
+ {
+ var elem = controlComboBox.elements[0];
+ MessageBox.Show($": {elem?.ToString()}");
+ }
+ }
+}
diff --git a/ComponentProgramming/Forms/Form.resx b/ComponentProgramming/Forms/Form.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/ComponentProgramming/Forms/Form.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/ComponentProgramming/Forms/Forms.csproj b/ComponentProgramming/Forms/Forms.csproj
new file mode 100644
index 0000000..812d01e
--- /dev/null
+++ b/ComponentProgramming/Forms/Forms.csproj
@@ -0,0 +1,15 @@
+
+
+
+ WinExe
+ net8.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ComponentProgramming/Forms/Program.cs b/ComponentProgramming/Forms/Program.cs
new file mode 100644
index 0000000..3e01fbd
--- /dev/null
+++ b/ComponentProgramming/Forms/Program.cs
@@ -0,0 +1,17 @@
+namespace Forms
+{
+ internal static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
+ ApplicationConfiguration.Initialize();
+ Application.Run(new Form());
+ }
+ }
+}
\ No newline at end of file