end lab1
This commit is contained in:
parent
42a1a33f9e
commit
7fa0fee8f2
31
ComponentsLab.sln
Normal file
31
ComponentsLab.sln
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.9.34723.18
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComponentsLibrary", "WinFormsLibrary1\ComponentsLibrary.csproj", "{20C9A49F-95DB-4D70-9F84-B1C8BF2B4CED}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComponentsView", "WinFormsApp1\ComponentsView.csproj", "{05A9F38D-2D4B-4206-BF30-E2E0E9B2A159}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{20C9A49F-95DB-4D70-9F84-B1C8BF2B4CED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{20C9A49F-95DB-4D70-9F84-B1C8BF2B4CED}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{20C9A49F-95DB-4D70-9F84-B1C8BF2B4CED}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{20C9A49F-95DB-4D70-9F84-B1C8BF2B4CED}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{05A9F38D-2D4B-4206-BF30-E2E0E9B2A159}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{05A9F38D-2D4B-4206-BF30-E2E0E9B2A159}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{05A9F38D-2D4B-4206-BF30-E2E0E9B2A159}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{05A9F38D-2D4B-4206-BF30-E2E0E9B2A159}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {402122A1-1FB6-406E-869E-FADF8DF1F7EA}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
14
ComponentsLibrary/ComponentsLibrary.csproj
Normal file
14
ComponentsLibrary/ComponentsLibrary.csproj
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="System.Collections" Version="4.3.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
75
ComponentsLibrary/Email.Designer.cs
generated
Normal file
75
ComponentsLibrary/Email.Designer.cs
generated
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
namespace ComponentsLibrary
|
||||||
|
{
|
||||||
|
partial class Email
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
components = new System.ComponentModel.Container();
|
||||||
|
textBoxEmail = new TextBox();
|
||||||
|
labelEmail = new Label();
|
||||||
|
toolTipEmail = new ToolTip(components);
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// textBoxEmail
|
||||||
|
//
|
||||||
|
textBoxEmail.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
textBoxEmail.Location = new Point(62, 15);
|
||||||
|
textBoxEmail.Name = "textBoxEmail";
|
||||||
|
textBoxEmail.Size = new Size(139, 23);
|
||||||
|
textBoxEmail.TabIndex = 0;
|
||||||
|
textBoxEmail.TextChanged += textBoxEmail_TextChanged;
|
||||||
|
textBoxEmail.Enter += showToolTip;
|
||||||
|
//
|
||||||
|
// labelEmail
|
||||||
|
//
|
||||||
|
labelEmail.AutoSize = true;
|
||||||
|
labelEmail.Location = new Point(17, 18);
|
||||||
|
labelEmail.Name = "labelEmail";
|
||||||
|
labelEmail.Size = new Size(39, 15);
|
||||||
|
labelEmail.TabIndex = 1;
|
||||||
|
labelEmail.Text = "Email:";
|
||||||
|
//
|
||||||
|
// Email
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
Controls.Add(labelEmail);
|
||||||
|
Controls.Add(textBoxEmail);
|
||||||
|
Name = "Email";
|
||||||
|
Size = new Size(218, 54);
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private TextBox textBoxEmail;
|
||||||
|
private Label labelEmail;
|
||||||
|
private ToolTip toolTipEmail;
|
||||||
|
}
|
||||||
|
}
|
97
ComponentsLibrary/Email.cs
Normal file
97
ComponentsLibrary/Email.cs
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace ComponentsLibrary
|
||||||
|
{
|
||||||
|
public partial class Email : UserControl
|
||||||
|
{
|
||||||
|
private EventHandler? _changeEmail;
|
||||||
|
private string emailPattern;
|
||||||
|
public Email()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
//Должна всплывать подсказка ToolTip с примером правильного ввода (пример должен заполняться через публичный метод).
|
||||||
|
public void SetToolTip(string example)
|
||||||
|
{
|
||||||
|
toolTipEmail.SetToolTip(textBoxEmail, example);
|
||||||
|
}
|
||||||
|
private void showToolTip(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
toolTipEmail.Active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Публичное свойство для установки и получения введенного значения (set, get):
|
||||||
|
public string EmailValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(emailPattern))
|
||||||
|
{
|
||||||
|
throw new EmailException("Шаблон электронной почты не задан.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsValidEmail(textBoxEmail.Text))
|
||||||
|
{
|
||||||
|
throw new EmailException("Введенный адрес электронной почты не соответствует шаблону.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return textBoxEmail.Text;
|
||||||
|
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (IsValidEmail(value))
|
||||||
|
{
|
||||||
|
textBoxEmail.Text = value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textBoxEmail.Text = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Шаблон, по которому будет проверяться вводимое значение, должен заполняться через публичное свойство
|
||||||
|
public string EmailPattern
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return emailPattern;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
emailPattern = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//правильный ввод должен заполняться через публичный метод
|
||||||
|
private bool IsValidEmail(string email)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(emailPattern))
|
||||||
|
{
|
||||||
|
return true; // Если шаблон не задан, любая строка считается валидной.
|
||||||
|
}
|
||||||
|
return Regex.IsMatch(email, emailPattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
//событие, вызываемое при смене значения
|
||||||
|
public event EventHandler ChangeEmail
|
||||||
|
{
|
||||||
|
add { _changeEmail += value; }
|
||||||
|
remove { _changeEmail -= value; }
|
||||||
|
}
|
||||||
|
private void textBoxEmail_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_changeEmail?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TextBox EmailTextBox
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return textBoxEmail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
123
ComponentsLibrary/Email.resx
Normal file
123
ComponentsLibrary/Email.resx
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?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>
|
||||||
|
<metadata name="toolTipEmail.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>114, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
10
ComponentsLibrary/EmailException.cs
Normal file
10
ComponentsLibrary/EmailException.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace ComponentsLibrary
|
||||||
|
{
|
||||||
|
public class EmailException : Exception
|
||||||
|
{
|
||||||
|
public EmailException(string message) : base(message)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
75
ComponentsLibrary/ImageLoad.Designer.cs
generated
Normal file
75
ComponentsLibrary/ImageLoad.Designer.cs
generated
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
namespace ComponentsLab
|
||||||
|
{
|
||||||
|
partial class ImageLoad
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
pictureBoxAvatar = new PictureBox();
|
||||||
|
buttonLoad = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxAvatar).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// pictureBoxAvatar
|
||||||
|
//
|
||||||
|
pictureBoxAvatar.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
pictureBoxAvatar.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
pictureBoxAvatar.Location = new Point(3, 3);
|
||||||
|
pictureBoxAvatar.Name = "pictureBoxAvatar";
|
||||||
|
pictureBoxAvatar.Size = new Size(225, 194);
|
||||||
|
pictureBoxAvatar.TabIndex = 0;
|
||||||
|
pictureBoxAvatar.TabStop = false;
|
||||||
|
//
|
||||||
|
// buttonLoad
|
||||||
|
//
|
||||||
|
buttonLoad.Anchor = AnchorStyles.Bottom;
|
||||||
|
buttonLoad.Location = new Point(78, 203);
|
||||||
|
buttonLoad.Name = "buttonLoad";
|
||||||
|
buttonLoad.Size = new Size(74, 23);
|
||||||
|
buttonLoad.TabIndex = 1;
|
||||||
|
buttonLoad.Text = "Загрузить";
|
||||||
|
buttonLoad.UseVisualStyleBackColor = true;
|
||||||
|
buttonLoad.Click += buttonLoad_Click;
|
||||||
|
//
|
||||||
|
// ImageLoad
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
Controls.Add(buttonLoad);
|
||||||
|
Controls.Add(pictureBoxAvatar);
|
||||||
|
Name = "ImageLoad";
|
||||||
|
Size = new Size(232, 235);
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxAvatar).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private PictureBox pictureBoxAvatar;
|
||||||
|
private Button buttonLoad;
|
||||||
|
}
|
||||||
|
}
|
56
ComponentsLibrary/ImageLoad.cs
Normal file
56
ComponentsLibrary/ImageLoad.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
namespace ComponentsLab
|
||||||
|
{
|
||||||
|
|
||||||
|
public partial class ImageLoad : 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 AnErrorOccurred
|
||||||
|
{
|
||||||
|
add { _errorOccured += value; }
|
||||||
|
remove { _errorOccured -= value; }
|
||||||
|
}
|
||||||
|
public ImageLoad()
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
_avatarChanged?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Error = ex.Message;
|
||||||
|
_errorOccured?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ComponentsLibrary/ImageLoad.resx
Normal file
120
ComponentsLibrary/ImageLoad.resx
Normal 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>
|
58
ComponentsLibrary/ListBoxValues.Designer.cs
generated
Normal file
58
ComponentsLibrary/ListBoxValues.Designer.cs
generated
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
namespace ComponentsLibrary
|
||||||
|
{
|
||||||
|
partial class ListBoxValues
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
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, 3);
|
||||||
|
listBox.Name = "listBox";
|
||||||
|
listBox.Size = new Size(222, 124);
|
||||||
|
listBox.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ListBoxValues
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(listBox);
|
||||||
|
Name = "ListBoxValues";
|
||||||
|
Size = new Size(228, 132);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ListBox listBox;
|
||||||
|
}
|
||||||
|
}
|
72
ComponentsLibrary/ListBoxValues.cs
Normal file
72
ComponentsLibrary/ListBoxValues.cs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace ComponentsLibrary
|
||||||
|
{
|
||||||
|
public partial class ListBoxValues : UserControl
|
||||||
|
{
|
||||||
|
//private List<Employee> _employees;
|
||||||
|
private string layoutString = string.Empty;
|
||||||
|
private char startSymbol = '{';
|
||||||
|
private char endSymbol = '}';
|
||||||
|
private List<object> items = new List<object>();
|
||||||
|
public ListBoxValues()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Публичное свойство для установки и получения индекса выбранной строки (set, get).
|
||||||
|
public int SelectedIndex
|
||||||
|
{
|
||||||
|
get { return listBox.SelectedIndex; }
|
||||||
|
set { listBox.SelectedIndex = value; }
|
||||||
|
}
|
||||||
|
// Публичный метод для установки макетной строки и символов
|
||||||
|
public void SetLayout(string layout, char startChar, char endChar)
|
||||||
|
{
|
||||||
|
layoutString = layout;
|
||||||
|
startSymbol = startChar;
|
||||||
|
endSymbol = endChar;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Публичный метод для заполнения ListBox
|
||||||
|
public void FillListBox<T>(IEnumerable<T> itemList)
|
||||||
|
{
|
||||||
|
listBox.Items.Clear();
|
||||||
|
items.Clear();
|
||||||
|
foreach (var item in itemList)
|
||||||
|
{
|
||||||
|
items.Add(item);
|
||||||
|
string displayText = CreateDisplayText(item);
|
||||||
|
listBox.Items.Add(displayText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Метод для создания строки на основе макета
|
||||||
|
private string CreateDisplayText(object item)
|
||||||
|
{
|
||||||
|
string text = layoutString;
|
||||||
|
// Регулярное выражение для поиска имен свойств
|
||||||
|
var regex = new Regex($@"{startSymbol}(\w+){endSymbol}");
|
||||||
|
return regex.Replace(text, match =>
|
||||||
|
{
|
||||||
|
string propertyName = match.Groups[1].Value;
|
||||||
|
PropertyInfo prop = item.GetType().GetProperty(propertyName);
|
||||||
|
if (prop != null)
|
||||||
|
{
|
||||||
|
return prop.GetValue(item)?.ToString() ?? string.Empty;
|
||||||
|
}
|
||||||
|
return match.Value; // Возвращаем то, что нашли, если свойства нет
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Публичный параметризованный метод для получения объекта из выбранной строки
|
||||||
|
public T GetSelectedItem<T>()
|
||||||
|
{
|
||||||
|
if (listBox.SelectedIndex != -1)
|
||||||
|
{
|
||||||
|
return (T)items[listBox.SelectedIndex];
|
||||||
|
}
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ComponentsLibrary/ListBoxValues.resx
Normal file
120
ComponentsLibrary/ListBoxValues.resx
Normal 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>
|
74
ComponentsLibrary/VisualSelectionComponent.Designer.cs
generated
Normal file
74
ComponentsLibrary/VisualSelectionComponent.Designer.cs
generated
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
namespace ComponentsLab
|
||||||
|
{
|
||||||
|
partial class VisualSelectionComponent
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
comboBoxComponent = new ComboBox();
|
||||||
|
buttonClear = new Button();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// comboBoxComponent
|
||||||
|
//
|
||||||
|
comboBoxComponent.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
comboBoxComponent.FormattingEnabled = true;
|
||||||
|
comboBoxComponent.Items.AddRange(new object[] { "Значение 1", "Значение 2", "Значение 3", "Значение 4", "Значение 5" });
|
||||||
|
comboBoxComponent.Location = new Point(15, 23);
|
||||||
|
comboBoxComponent.Name = "comboBoxComponent";
|
||||||
|
comboBoxComponent.Size = new Size(121, 23);
|
||||||
|
comboBoxComponent.TabIndex = 0;
|
||||||
|
comboBoxComponent.SelectedIndexChanged += comboBoxComponent_SelectedIndexChanged;
|
||||||
|
//
|
||||||
|
// buttonClear
|
||||||
|
//
|
||||||
|
buttonClear.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
buttonClear.Location = new Point(16, 56);
|
||||||
|
buttonClear.Name = "buttonClear";
|
||||||
|
buttonClear.Size = new Size(120, 23);
|
||||||
|
buttonClear.TabIndex = 1;
|
||||||
|
buttonClear.Text = "Очистить";
|
||||||
|
buttonClear.UseVisualStyleBackColor = true;
|
||||||
|
buttonClear.Click += buttonClear_Click;
|
||||||
|
//
|
||||||
|
// VisualSelectionComponent
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
Controls.Add(buttonClear);
|
||||||
|
Controls.Add(comboBoxComponent);
|
||||||
|
Name = "VisualSelectionComponent";
|
||||||
|
Size = new Size(148, 94);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ComboBox comboBoxComponent;
|
||||||
|
private Button buttonClear;
|
||||||
|
}
|
||||||
|
}
|
56
ComponentsLibrary/VisualSelectionComponent.cs
Normal file
56
ComponentsLibrary/VisualSelectionComponent.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
namespace ComponentsLab
|
||||||
|
{
|
||||||
|
public partial class VisualSelectionComponent : UserControl
|
||||||
|
{
|
||||||
|
private EventHandler? _changeComboBox;
|
||||||
|
public VisualSelectionComponent()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
//Публичное свойство (set, get) для установки и получения выбранного значения (возвращает пустую строку, если нет выбранного значения)
|
||||||
|
public string comboBoxSelectedValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (comboBoxComponent.SelectedItem != null)
|
||||||
|
{
|
||||||
|
return comboBoxComponent.GetItemText(comboBoxComponent.SelectedItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (comboBoxComponent.SelectedIndex != -1)
|
||||||
|
{
|
||||||
|
comboBoxComponent.Items[comboBoxComponent.SelectedIndex] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Событие, вызываемое при смене значения в ComboBox
|
||||||
|
public event EventHandler ChangeComboBox
|
||||||
|
{
|
||||||
|
add { _changeComboBox += value; }
|
||||||
|
remove { _changeComboBox -= value; }
|
||||||
|
}
|
||||||
|
private void comboBoxComponent_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_changeComboBox?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Отдельный публичный метод отчистки списка
|
||||||
|
private void buttonClear_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
comboBoxComponent.Items.Clear();
|
||||||
|
comboBoxComponent.Text = string.Empty;
|
||||||
|
comboBoxComponent.SelectedItem = null;
|
||||||
|
MessageBox.Show($"The list has been cleared");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
120
ComponentsLibrary/VisualSelectionComponent.resx
Normal file
120
ComponentsLibrary/VisualSelectionComponent.resx
Normal 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>
|
15
ComponentsView/ComponentsView.csproj
Normal file
15
ComponentsView/ComponentsView.csproj
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\WinFormsLibrary1\ComponentsLibrary.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
113
ComponentsView/FormComponents.Designer.cs
generated
Normal file
113
ComponentsView/FormComponents.Designer.cs
generated
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
namespace ComponentsLab
|
||||||
|
{
|
||||||
|
partial class FormComponents
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
|
||||||
|
imageLoad = new ImageLoad();
|
||||||
|
visualSelectionComponent1 = new VisualSelectionComponent();
|
||||||
|
emailComponent = new ComponentsLibrary.Email();
|
||||||
|
buttonCheckEmail = new Button();
|
||||||
|
listBoxValues = new ComponentsLibrary.ListBoxValues();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// imageLoad
|
||||||
|
//
|
||||||
|
imageLoad.Avatar = null;
|
||||||
|
imageLoad.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
imageLoad.Location = new Point(12, 12);
|
||||||
|
imageLoad.Name = "imageLoad";
|
||||||
|
imageLoad.Size = new Size(147, 92);
|
||||||
|
imageLoad.TabIndex = 0;
|
||||||
|
imageLoad.AvatarChanged += ImageLoad_AvatarChanged;
|
||||||
|
//
|
||||||
|
// visualSelectionComponent1
|
||||||
|
//
|
||||||
|
visualSelectionComponent1.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
visualSelectionComponent1.comboBoxSelectedValue = "";
|
||||||
|
visualSelectionComponent1.Location = new Point(181, 12);
|
||||||
|
visualSelectionComponent1.Name = "visualSelectionComponent1";
|
||||||
|
visualSelectionComponent1.Size = new Size(156, 92);
|
||||||
|
visualSelectionComponent1.TabIndex = 1;
|
||||||
|
visualSelectionComponent1.ChangeComboBox += visualSelectionComponent1_ChangeComboBox;
|
||||||
|
//
|
||||||
|
// emailComponent
|
||||||
|
//
|
||||||
|
emailComponent.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
emailComponent.EmailPattern = null;
|
||||||
|
emailComponent.Location = new Point(356, 12);
|
||||||
|
emailComponent.Name = "emailComponent";
|
||||||
|
emailComponent.Size = new Size(172, 92);
|
||||||
|
emailComponent.TabIndex = 2;
|
||||||
|
emailComponent.ChangeEmail += emailComponent_ChangeEmail;
|
||||||
|
//
|
||||||
|
// buttonCheckEmail
|
||||||
|
//
|
||||||
|
buttonCheckEmail.Location = new Point(374, 66);
|
||||||
|
buttonCheckEmail.Name = "buttonCheckEmail";
|
||||||
|
buttonCheckEmail.Size = new Size(136, 23);
|
||||||
|
buttonCheckEmail.TabIndex = 3;
|
||||||
|
buttonCheckEmail.Text = "Проверить email";
|
||||||
|
buttonCheckEmail.UseVisualStyleBackColor = true;
|
||||||
|
buttonCheckEmail.Click += buttonCheckEmail_Click;
|
||||||
|
//
|
||||||
|
// listBoxValues
|
||||||
|
//
|
||||||
|
listBoxValues.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
listBoxValues.Location = new Point(12, 110);
|
||||||
|
listBoxValues.Name = "listBoxValues";
|
||||||
|
listBoxValues.SelectedIndex = -1;
|
||||||
|
listBoxValues.Size = new Size(516, 224);
|
||||||
|
listBoxValues.TabIndex = 4;
|
||||||
|
listBoxValues.Load += listBoxValues_Load;
|
||||||
|
//
|
||||||
|
// FormComponents
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(549, 345);
|
||||||
|
Controls.Add(listBoxValues);
|
||||||
|
Controls.Add(buttonCheckEmail);
|
||||||
|
Controls.Add(emailComponent);
|
||||||
|
Controls.Add(visualSelectionComponent1);
|
||||||
|
Controls.Add(imageLoad);
|
||||||
|
Name = "FormComponents";
|
||||||
|
Text = "FormComponents";
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.ComponentModel.BackgroundWorker backgroundWorker1;
|
||||||
|
private ComponentsLab.ImageLoad imageLoad;
|
||||||
|
private ComponentsLab.VisualSelectionComponent visualSelectionComponent1;
|
||||||
|
private ComponentsLibrary.Email emailComponent;
|
||||||
|
private Button buttonCheckEmail;
|
||||||
|
private ComponentsLibrary.ListBoxValues listBoxValues;
|
||||||
|
}
|
||||||
|
}
|
75
ComponentsView/FormComponents.cs
Normal file
75
ComponentsView/FormComponents.cs
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
using ComponentsLibrary;
|
||||||
|
using ComponentsView;
|
||||||
|
|
||||||
|
namespace ComponentsLab
|
||||||
|
{
|
||||||
|
public partial class FormComponents : Form
|
||||||
|
{
|
||||||
|
private Random random = new Random();
|
||||||
|
public FormComponents()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
CreateImage();
|
||||||
|
EmailLoad();
|
||||||
|
}
|
||||||
|
private void CreateImage()
|
||||||
|
{
|
||||||
|
Bitmap bmp = new(imageLoad.Width - 10, imageLoad.Height - 10);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
gr.DrawEllipse(new Pen(Color.Red), 10, 10, 20, 20);
|
||||||
|
imageLoad.Avatar = bmp;
|
||||||
|
}
|
||||||
|
private void ImageLoad_AvatarChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var width = imageLoad.Avatar.Width;
|
||||||
|
MessageBox.Show($"Change avatar, width={width}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void visualSelectionComponent1_ChangeComboBox(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var val = visualSelectionComponent1.comboBoxSelectedValue;
|
||||||
|
MessageBox.Show($"Change value, value={val}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EmailLoad()
|
||||||
|
{
|
||||||
|
emailComponent.EmailPattern = @"^[^@\s]+@[^@\s]+\.[^@\s]+$";
|
||||||
|
emailComponent.SetToolTip("Ïðèìåð: example@domain.com");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCheckEmail_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var email = emailComponent.EmailValue;
|
||||||
|
MessageBox.Show($"Email ñîîòâåòñòâóåò øàáëîíó");
|
||||||
|
}
|
||||||
|
catch (EmailException ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà. Âåäåííûé àäðåñ ýëåêòðîííîé ïî÷òû íå ñîîòâåòñòâóåò øàáëîíó. ", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void emailComponent_ChangeEmail(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
int r = random.Next(256);
|
||||||
|
int g = random.Next(256);
|
||||||
|
int b = random.Next(256);
|
||||||
|
emailComponent.EmailTextBox.ForeColor = Color.FromArgb(r, g, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void listBoxValues_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
listBoxValues.SetLayout("Òåìïåðàòóðà âîçäóõà {T}, äàâëåíèå {P}", '{', '}');
|
||||||
|
var objectList = new List<ObjectClass>
|
||||||
|
{
|
||||||
|
new ObjectClass { T = 20.5, P = 1012 },
|
||||||
|
new ObjectClass { T = 18.3, P = 1008 },
|
||||||
|
new ObjectClass { T = 50.1, P = 1010 },
|
||||||
|
new ObjectClass { T = 30.0, P = 1011 },
|
||||||
|
new ObjectClass { T = 18.9, P = 1009 },
|
||||||
|
};
|
||||||
|
listBoxValues.FillListBox(objectList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
123
ComponentsView/FormComponents.resx
Normal file
123
ComponentsView/FormComponents.resx
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?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>
|
||||||
|
<metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
8
ComponentsView/ObjectClass.cs
Normal file
8
ComponentsView/ObjectClass.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace ComponentsView
|
||||||
|
{
|
||||||
|
public class ObjectClass
|
||||||
|
{
|
||||||
|
public double T { get; set; }
|
||||||
|
public double P { get; set; }
|
||||||
|
}
|
||||||
|
}
|
17
ComponentsView/Program.cs
Normal file
17
ComponentsView/Program.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace ComponentsLab
|
||||||
|
{
|
||||||
|
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 FormComponents());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user