Почти все, третья часть осталась

This commit is contained in:
Алексей Тихоненков 2024-09-04 20:05:23 +04:00
parent a489b504ca
commit c0b76475ef
15 changed files with 980 additions and 0 deletions

View File

@ -0,0 +1,58 @@
namespace FormLibrary
{
partial class CustomListBox
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
listBox1 = new ListBox();
SuspendLayout();
//
// listBox1
//
listBox1.FormattingEnabled = true;
listBox1.ItemHeight = 15;
listBox1.Location = new Point(3, 3);
listBox1.Name = "listBox1";
listBox1.Size = new Size(231, 169);
listBox1.TabIndex = 0;
listBox1.SelectedIndexChanged += ListBox1_SelectedIndexChanged;
//
// CustomListBox
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(listBox1);
Name = "CustomListBox";
Size = new Size(237, 179);
ResumeLayout(false);
}
#endregion
private ListBox listBox1;
}
}

View File

@ -0,0 +1,74 @@
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.Windows.Forms.VisualStyles.VisualStyleElement.Header;
namespace FormLibrary
{
public partial class CustomListBox : UserControl
{
public event EventHandler? SelectedItemChanged;
public CustomListBox()
{
InitializeComponent();
}
public string SelectedItem
{
get
{
if (listBox1.SelectedItem != null)
{
return listBox1.SelectedItem.ToString();
}
return string.Empty;
}
set
{
int index = listBox1.Items.IndexOf(value);
if (index >= 0)
{
listBox1.SelectedIndex = index;
}
}
}
private void ListBox1_SelectedIndexChanged(object? sender, EventArgs e)
{
SelectedItemChanged?.Invoke(this, EventArgs.Empty);
}
public void PopulateListBox(ListBox listBox, List<string> items)
{
listBox1.Items.Clear();
foreach (var item in items)
{
listBox.Items.Add(item);
}
}
// Метод для заполнения списка элементами
public void PopulateListBox(List<string> items)
{
listBox1.Items.Clear();
foreach (var item in items)
{
listBox1.Items.Add(item);
}
}
// Метод для очистки списка
public void ClearListBox()
{
listBox1.Items.Clear();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FormLibrary.Exceptions
{
public class EmptyValueException : Exception
{
public EmptyValueException() : base("Значение не заполнено.") { }
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FormLibrary.Exceptions
{
public class InvalidValueTypeException : Exception
{
public InvalidValueTypeException() : base("Значение не соответствует требуемому типу.") { }
}
}

View File

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,68 @@
namespace FormLibrary
{
partial class IntegerInputControl
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
checkBoxNull = new CheckBox();
textBoxInput = new TextBox();
SuspendLayout();
//
// checkBoxNull
//
checkBoxNull.AutoSize = true;
checkBoxNull.Location = new Point(13, 17);
checkBoxNull.Name = "checkBoxNull";
checkBoxNull.Size = new Size(15, 14);
checkBoxNull.TabIndex = 0;
checkBoxNull.UseVisualStyleBackColor = true;
//
// textBoxInput
//
textBoxInput.Location = new Point(34, 13);
textBoxInput.Name = "textBoxInput";
textBoxInput.Size = new Size(100, 23);
textBoxInput.TabIndex = 1;
//
// IntegerInputControl
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(textBoxInput);
Controls.Add(checkBoxNull);
Name = "IntegerInputControl";
Size = new Size(146, 49);
ResumeLayout(false);
PerformLayout();
}
#endregion
private CheckBox checkBoxNull;
private TextBox textBoxInput;
}
}

View File

@ -0,0 +1,97 @@
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 System;
using System.Windows.Forms;
using FormLibrary.Exceptions;
namespace FormLibrary
{
public partial class IntegerInputControl : UserControl
{
// Событие, вызываемое при изменении значения в TextBox
public event EventHandler? ValueChanged;
// Событие, вызываемое при изменении состояния CheckBox
public event EventHandler? CheckBoxChanged;
public IntegerInputControl()
{
InitializeComponent();
checkBoxNull.CheckedChanged += CheckBoxNull_CheckedChanged;
textBoxInput.TextChanged += TextBoxInput_TextChanged;
}
// Публичное свойство для установки и получения введенного значения
public int? Value
{
get
{
if (checkBoxNull.Checked)
{
return null;
}
else
{
if (string.IsNullOrWhiteSpace(textBoxInput.Text))
{
throw new EmptyValueException();
}
if (int.TryParse(textBoxInput.Text, out int result))
{
return result;
}
else
{
throw new InvalidValueTypeException();
}
}
}
set
{
if (value == null)
{
checkBoxNull.Checked = true;
textBoxInput.Enabled = false;
textBoxInput.Text = string.Empty;
}
else
{
checkBoxNull.Checked = false;
textBoxInput.Enabled = true;
textBoxInput.Text = value.ToString();
}
}
}
// Метод обработки изменения состояния CheckBox
private void CheckBoxNull_CheckedChanged(object sender, EventArgs e)
{
textBoxInput.Enabled = !checkBoxNull.Checked;
if (checkBoxNull.Checked)
{
textBoxInput.Text = string.Empty;
}
// Вызываем событие при изменении состояния CheckBox
CheckBoxChanged?.Invoke(this, EventArgs.Empty);
}
// Метод обработки изменения текста в текстовом поле
private void TextBoxInput_TextChanged(object sender, EventArgs e)
{
// Вызываем событие при изменении текста
ValueChanged?.Invoke(this, EventArgs.Empty);
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\FormLibrary\FormLibrary.csproj" />
</ItemGroup>
</Project>

130
KopLab1/Forms/MainForm.Designer.cs generated Normal file
View File

@ -0,0 +1,130 @@
namespace Forms
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
customListBox1 = new FormLibrary.CustomListBox();
button1 = new Button();
button2 = new Button();
integerInputControl1 = new FormLibrary.IntegerInputControl();
button3 = new Button();
button4 = new Button();
textBox1 = new TextBox();
SuspendLayout();
//
// customListBox1
//
customListBox1.Location = new Point(12, 12);
customListBox1.Name = "customListBox1";
customListBox1.SelectedItem = "";
customListBox1.Size = new Size(237, 176);
customListBox1.TabIndex = 0;
//
// button1
//
button1.Location = new Point(12, 194);
button1.Name = "button1";
button1.Size = new Size(237, 34);
button1.TabIndex = 1;
button1.Text = "Заполнить список";
button1.UseVisualStyleBackColor = true;
button1.Click += ButtonLoad_Click;
//
// button2
//
button2.Location = new Point(12, 234);
button2.Name = "button2";
button2.Size = new Size(237, 34);
button2.TabIndex = 2;
button2.Text = "Очистить список";
button2.UseVisualStyleBackColor = true;
button2.Click += ButtonClear_Click;
//
// integerInputControl1
//
integerInputControl1.Location = new Point(329, 12);
integerInputControl1.Name = "integerInputControl1";
integerInputControl1.Size = new Size(146, 56);
integerInputControl1.TabIndex = 3;
//
// button3
//
button3.Location = new Point(361, 74);
button3.Name = "button3";
button3.Size = new Size(103, 23);
button3.TabIndex = 4;
button3.Text = "Set";
button3.UseVisualStyleBackColor = true;
button3.Click += buttonInput_Click;
//
// button4
//
button4.Location = new Point(361, 103);
button4.Name = "button4";
button4.Size = new Size(103, 23);
button4.TabIndex = 5;
button4.Text = "Get";
button4.UseVisualStyleBackColor = true;
button4.Click += buttonOutput_Click;
//
// textBox1
//
textBox1.Location = new Point(329, 132);
textBox1.Name = "textBox1";
textBox1.Size = new Size(135, 23);
textBox1.TabIndex = 6;
//
// MainForm
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(textBox1);
Controls.Add(button4);
Controls.Add(button3);
Controls.Add(integerInputControl1);
Controls.Add(button2);
Controls.Add(button1);
Controls.Add(customListBox1);
Name = "MainForm";
Text = "MainForm";
ResumeLayout(false);
PerformLayout();
}
#endregion
private FormLibrary.CustomListBox customListBox1;
private Button button1;
private Button button2;
private FormLibrary.IntegerInputControl integerInputControl1;
private Button button3;
private Button button4;
private TextBox textBox1;
}
}

94
KopLab1/Forms/MainForm.cs Normal file
View File

@ -0,0 +1,94 @@
using FormLibrary;
using FormLibrary.Exceptions;
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 System.Windows.Forms.VisualStyles;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Header;
namespace Forms
{
public partial class MainForm : Form
{
private int? savedValue;
public MainForm()
{
InitializeComponent();
customListBox1.SelectedItemChanged += CustomListBox1_SelectedItemChanged;
integerInputControl1.ValueChanged += IntegerInputControl1_ValueChanged;
integerInputControl1.CheckBoxChanged += IntegerInputControl_CheckBoxChanged;
}
private void CustomListBox1_SelectedItemChanged(object? sender, EventArgs e)
{
if (sender is CustomListBox customListBox)
{
string selectedItem = customListBox.SelectedItem;
MessageBox.Show($"Выбранный элемент: {selectedItem}", "Выбор элемента", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
// Обработчик для кнопки загрузки элементов
private void ButtonLoad_Click(object? sender, EventArgs e)
{
List<string> items = new List<string>();
for (int i = 0; i <= 5; i++)
{
items.Add("Item " + i.ToString());
}
customListBox1.PopulateListBox(items);
}
// Обработчик для кнопки очистки списка
private void ButtonClear_Click(object? sender, EventArgs e)
{
customListBox1.ClearListBox();
}
private void buttonInput_Click(object sender, EventArgs e)
{
try
{
// Проверка и сохранение значения в контроллере
savedValue = integerInputControl1.Value;
MessageBox.Show("Значение успешно сохранено.", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (EmptyValueException ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (InvalidValueTypeException ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonOutput_Click(object sender, EventArgs e)
{
if (savedValue.HasValue)
{
MessageBox.Show($"Сохраненное значение: {savedValue}", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Сохраненное значение: null", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void IntegerInputControl1_ValueChanged(object? sender, EventArgs e)
{
// Обработка изменения значения в IntegerInputControl
textBox1.Text = "Textbox changed";
}
private void IntegerInputControl_CheckBoxChanged(object? sender, EventArgs e)
{
// Обработка изменения состояния CheckBox в IntegerInputControl
textBox1.Text = "Checkbox changed";
}
}
}

120
KopLab1/Forms/MainForm.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

17
KopLab1/Forms/Program.cs Normal file
View File

@ -0,0 +1,17 @@
namespace Forms
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[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 MainForm());
}
}
}

31
KopLab1/KopLab1.sln Normal file
View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35222.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormLibrary", "FormLibrary\FormLibrary.csproj", "{E840E4D9-B195-449A-AB24-ECAAE2655D58}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Forms", "Forms\Forms.csproj", "{83F3C50D-D872-48B6-8932-1D5B7E0A40F0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E840E4D9-B195-449A-AB24-ECAAE2655D58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E840E4D9-B195-449A-AB24-ECAAE2655D58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E840E4D9-B195-449A-AB24-ECAAE2655D58}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E840E4D9-B195-449A-AB24-ECAAE2655D58}.Release|Any CPU.Build.0 = Release|Any CPU
{83F3C50D-D872-48B6-8932-1D5B7E0A40F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{83F3C50D-D872-48B6-8932-1D5B7E0A40F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{83F3C50D-D872-48B6-8932-1D5B7E0A40F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{83F3C50D-D872-48B6-8932-1D5B7E0A40F0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C6DEED66-161D-4CE7-B327-9DB0A6D32439}
EndGlobalSection
EndGlobal