In progres
This commit is contained in:
parent
bcb154a864
commit
5a901fc072
96
TestsComponents/FormTestComponents.Designer.cs
generated
Normal file
96
TestsComponents/FormTestComponents.Designer.cs
generated
Normal file
@ -0,0 +1,96 @@
|
||||
namespace TestsComponents
|
||||
{
|
||||
partial class FormTestComponents
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
userCheckedListBox = new WinFormsLibrary1.UserCheckedListBox();
|
||||
buttonClear = new Button();
|
||||
ButtonShowItems = new Button();
|
||||
textBoxItems = new TextBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// userCheckedListBox
|
||||
//
|
||||
userCheckedListBox.Location = new Point(0, 0);
|
||||
userCheckedListBox.Name = "userCheckedListBox";
|
||||
userCheckedListBox.SelectedValue = "";
|
||||
userCheckedListBox.Size = new Size(263, 170);
|
||||
userCheckedListBox.TabIndex = 0;
|
||||
userCheckedListBox.SelectedValueChanged += UserCheckedListBox_SelectedValueChanged;
|
||||
//
|
||||
// buttonClear
|
||||
//
|
||||
buttonClear.Location = new Point(0, 176);
|
||||
buttonClear.Name = "buttonClear";
|
||||
buttonClear.Size = new Size(263, 29);
|
||||
buttonClear.TabIndex = 2;
|
||||
buttonClear.Text = "Очистить";
|
||||
buttonClear.UseVisualStyleBackColor = true;
|
||||
buttonClear.Click += buttonClear_Click;
|
||||
//
|
||||
// ButtonShowItems
|
||||
//
|
||||
ButtonShowItems.Location = new Point(0, 211);
|
||||
ButtonShowItems.Name = "ButtonShowItems";
|
||||
ButtonShowItems.Size = new Size(263, 29);
|
||||
ButtonShowItems.TabIndex = 3;
|
||||
ButtonShowItems.Text = "Показать";
|
||||
ButtonShowItems.UseVisualStyleBackColor = true;
|
||||
ButtonShowItems.Click += ButtonShowItems_Click;
|
||||
//
|
||||
// textBoxItems
|
||||
//
|
||||
textBoxItems.Location = new Point(0, 246);
|
||||
textBoxItems.Multiline = true;
|
||||
textBoxItems.Name = "textBoxItems";
|
||||
textBoxItems.Size = new Size(263, 87);
|
||||
textBoxItems.TabIndex = 4;
|
||||
//
|
||||
// FormTestComponents
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(textBoxItems);
|
||||
Controls.Add(ButtonShowItems);
|
||||
Controls.Add(buttonClear);
|
||||
Controls.Add(userCheckedListBox);
|
||||
Name = "FormTestComponents";
|
||||
Text = "FormTestComponents ";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private WinFormsLibrary1.UserCheckedListBox userCheckedListBox;
|
||||
private Button buttonClear;
|
||||
private Button ButtonShowItems;
|
||||
private TextBox textBoxItems;
|
||||
}
|
||||
}
|
29
TestsComponents/FormTestComponents.cs
Normal file
29
TestsComponents/FormTestComponents.cs
Normal file
@ -0,0 +1,29 @@
|
||||
namespace TestsComponents
|
||||
{
|
||||
public partial class FormTestComponents : Form
|
||||
{
|
||||
public FormTestComponents()
|
||||
{
|
||||
InitializeComponent();
|
||||
Fill();
|
||||
}
|
||||
public void Fill()
|
||||
{
|
||||
userCheckedListBox.append(new() { "items1", "dsdsf", "items3", "fgdg", "iit" });
|
||||
}
|
||||
private void UserCheckedListBox_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("Selected value changed");
|
||||
}
|
||||
private void buttonClear_Click(object sender, EventArgs e)
|
||||
{
|
||||
userCheckedListBox.ClearList();
|
||||
}
|
||||
private void ButtonShowItems_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
textBoxItems.Text = userCheckedListBox.SelectedValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
120
TestsComponents/FormTestComponents.resx
Normal file
120
TestsComponents/FormTestComponents.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>
|
17
TestsComponents/Program.cs
Normal file
17
TestsComponents/Program.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace TestsComponents
|
||||
{
|
||||
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 FormTestComponents());
|
||||
}
|
||||
}
|
||||
}
|
15
TestsComponents/TestsComponents.csproj
Normal file
15
TestsComponents/TestsComponents.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\COP.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
31
WinFormsLibrary1.sln
Normal file
31
WinFormsLibrary1.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.10.35027.167
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "COP", "WinFormsLibrary1\COP.csproj", "{2A43B10F-50CB-4768-A95A-2E6B90D0AD41}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestsComponents", "TestsComponents\TestsComponents.csproj", "{C720866B-F5B4-4063-931A-2DB4A35DD888}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2A43B10F-50CB-4768-A95A-2E6B90D0AD41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2A43B10F-50CB-4768-A95A-2E6B90D0AD41}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2A43B10F-50CB-4768-A95A-2E6B90D0AD41}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2A43B10F-50CB-4768-A95A-2E6B90D0AD41}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C720866B-F5B4-4063-931A-2DB4A35DD888}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C720866B-F5B4-4063-931A-2DB4A35DD888}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C720866B-F5B4-4063-931A-2DB4A35DD888}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C720866B-F5B4-4063-931A-2DB4A35DD888}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {5428C310-3E76-48CB-A3D2-14609E3EA213}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
10
WinFormsLibrary1/COP.csproj
Normal file
10
WinFormsLibrary1/COP.csproj
Normal file
@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
18
WinFormsLibrary1/Exceptions/NoRangeException.cs
Normal file
18
WinFormsLibrary1/Exceptions/NoRangeException.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace COP.Exceptions
|
||||
{
|
||||
[Serializable]
|
||||
public class NoRangeException : ApplicationException
|
||||
{
|
||||
public NoRangeException() : base() { }
|
||||
public NoRangeException(string message) : base(message) { }
|
||||
public NoRangeException(string message, Exception exception) : base(message, exception) { }
|
||||
protected NoRangeException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
||||
}
|
||||
}
|
19
WinFormsLibrary1/Exceptions/NotIncludedInRangeException.cs
Normal file
19
WinFormsLibrary1/Exceptions/NotIncludedInRangeException.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace COP.Exceptions
|
||||
{
|
||||
[Serializable]
|
||||
public class NotIncludedInRangeException: ApplicationException
|
||||
|
||||
{
|
||||
public NotIncludedInRangeException() : base() { }
|
||||
public NotIncludedInRangeException(string message) : base(message) { }
|
||||
public NotIncludedInRangeException(string message, Exception exception) : base(message, exception) { }
|
||||
protected NotIncludedInRangeException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
||||
}
|
||||
}
|
57
WinFormsLibrary1/UserCheckedListBox.Designer.cs
generated
Normal file
57
WinFormsLibrary1/UserCheckedListBox.Designer.cs
generated
Normal file
@ -0,0 +1,57 @@
|
||||
namespace WinFormsLibrary1
|
||||
{
|
||||
partial class UserCheckedListBox
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
checkedListBox = new CheckedListBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// checkedListBox
|
||||
//
|
||||
checkedListBox.FormattingEnabled = true;
|
||||
checkedListBox.Location = new Point(0, 0);
|
||||
checkedListBox.Name = "checkedListBox";
|
||||
checkedListBox.Size = new Size(256, 158);
|
||||
checkedListBox.TabIndex = 0;
|
||||
checkedListBox.SelectedIndexChanged += CheckedListBox_SelectedIndexChanged;
|
||||
//
|
||||
// UserCheckedListBox
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
Controls.Add(checkedListBox);
|
||||
Name = "UserCheckedListBox";
|
||||
Size = new Size(257, 155);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private CheckedListBox checkedListBox;
|
||||
}
|
||||
}
|
77
WinFormsLibrary1/UserCheckedListBox.cs
Normal file
77
WinFormsLibrary1/UserCheckedListBox.cs
Normal file
@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WinFormsLibrary1
|
||||
{
|
||||
public partial class UserCheckedListBox : UserControl
|
||||
{
|
||||
private event EventHandler? _selectedValueChanged;
|
||||
public UserCheckedListBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public void append(List<String> items)
|
||||
{
|
||||
if (items.Count == 0 || items is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
checkedListBox.Items.AddRange(items.ToArray());
|
||||
}
|
||||
public void ClearList()
|
||||
{
|
||||
checkedListBox.Items.Clear();
|
||||
}
|
||||
public string SelectedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
string checkedItems = "";
|
||||
for (int i = 0; i < checkedListBox.Items.Count; i++)
|
||||
{
|
||||
if (checkedListBox.GetItemChecked(i))
|
||||
{
|
||||
checkedItems += checkedListBox.Items[i].ToString() + " ";
|
||||
}
|
||||
}
|
||||
if (checkedListBox.CheckedItems != null)
|
||||
return checkedItems;
|
||||
else
|
||||
return "";
|
||||
}
|
||||
set
|
||||
{
|
||||
for (int i = 0; i < checkedListBox.Items.Count; i++)
|
||||
{
|
||||
if (checkedListBox.Items[i].ToString() == value)
|
||||
{
|
||||
checkedListBox.SetItemChecked(i, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler SelectedValueChanged
|
||||
{
|
||||
add { _selectedValueChanged += value; }
|
||||
remove { _selectedValueChanged += value; }
|
||||
}
|
||||
|
||||
private void CheckedListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
_selectedValueChanged?.Invoke(this, e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
120
WinFormsLibrary1/UserCheckedListBox.resx
Normal file
120
WinFormsLibrary1/UserCheckedListBox.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>
|
56
WinFormsLibrary1/UserDateTimePickercs.Designer.cs
generated
Normal file
56
WinFormsLibrary1/UserDateTimePickercs.Designer.cs
generated
Normal file
@ -0,0 +1,56 @@
|
||||
namespace COP
|
||||
{
|
||||
partial class UserDateTimePickercs
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dateTimePicker = new DateTimePicker();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Location = new Point(0, 0);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(250, 27);
|
||||
dateTimePicker.TabIndex = 0;
|
||||
dateTimePicker.ValueChanged += DateTimePicker_ValueChanged;
|
||||
//
|
||||
// UserDateTimePickercs
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
Controls.Add(dateTimePicker);
|
||||
Name = "UserDateTimePickercs";
|
||||
Size = new Size(254, 29);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DateTimePicker dateTimePicker;
|
||||
}
|
||||
}
|
83
WinFormsLibrary1/UserDateTimePickercs.cs
Normal file
83
WinFormsLibrary1/UserDateTimePickercs.cs
Normal file
@ -0,0 +1,83 @@
|
||||
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 COP.Exceptions;
|
||||
|
||||
namespace COP
|
||||
{
|
||||
public partial class UserDateTimePickercs : UserControl
|
||||
{
|
||||
private DateTime? minValue;
|
||||
private DateTime? maxValue;
|
||||
|
||||
public event EventHandler? _valueChanged;
|
||||
public UserDateTimePickercs()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
public DateTime? MinValue
|
||||
{
|
||||
get { return minValue; }
|
||||
set { minValue = value; }
|
||||
}
|
||||
|
||||
public DateTime? MaxValue
|
||||
{
|
||||
get { return maxValue; }
|
||||
set { maxValue = value; }
|
||||
}
|
||||
public DateTime? SelectedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!minValue.HasValue || !maxValue.HasValue)
|
||||
{
|
||||
throw new NoRangeException("Диапозон не был задан");
|
||||
}
|
||||
else if (dateTimePicker.Value < minValue ||
|
||||
dateTimePicker.Value > maxValue)
|
||||
{
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return dateTimePicker.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
if (!minValue.HasValue || !maxValue.HasValue)
|
||||
{
|
||||
throw new NoRangeException("Диапозон не был задан");
|
||||
}
|
||||
if (value < minValue || value > maxValue)
|
||||
{
|
||||
|
||||
throw new NotIncludedInRangeException("Selected value is out of range.");
|
||||
}
|
||||
|
||||
dateTimePicker.Value = value.Value;
|
||||
|
||||
}
|
||||
}
|
||||
public event EventHandler ValueChanged
|
||||
{
|
||||
add { _valueChanged += value; }
|
||||
remove { _valueChanged -= value; }
|
||||
}
|
||||
private void DateTimePicker_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
_valueChanged?.Invoke(this, e);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
120
WinFormsLibrary1/UserDateTimePickercs.resx
Normal file
120
WinFormsLibrary1/UserDateTimePickercs.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>
|
Loading…
Reference in New Issue
Block a user