almost done, still got a work on add and check buttons
This commit is contained in:
parent
a489b504ca
commit
52a0e50af6
31
VolkovLabs/VolkovLabs.sln
Normal file
31
VolkovLabs/VolkovLabs.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}") = "WinFormsLibraryVolkov", "WinFormsLibraryVolkov\WinFormsLibraryVolkov.csproj", "{80044A4D-FF3B-4CA9-AA16-4E4E2520B60C}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsTestApp", "WinFormsTestApp\WinFormsTestApp.csproj", "{10C4BDA8-E7E7-4B43-8F9E-6549C5C40646}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{80044A4D-FF3B-4CA9-AA16-4E4E2520B60C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{80044A4D-FF3B-4CA9-AA16-4E4E2520B60C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{80044A4D-FF3B-4CA9-AA16-4E4E2520B60C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{80044A4D-FF3B-4CA9-AA16-4E4E2520B60C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{10C4BDA8-E7E7-4B43-8F9E-6549C5C40646}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{10C4BDA8-E7E7-4B43-8F9E-6549C5C40646}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{10C4BDA8-E7E7-4B43-8F9E-6549C5C40646}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{10C4BDA8-E7E7-4B43-8F9E-6549C5C40646}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {07EF6063-AD68-403B-A72B-B19E4B920CD0}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
56
VolkovLabs/WinFormsLibraryVolkov/CustomInputRangeDate.Designer.cs
generated
Normal file
56
VolkovLabs/WinFormsLibraryVolkov/CustomInputRangeDate.Designer.cs
generated
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
namespace WinFormsLibraryVolkov
|
||||||
|
{
|
||||||
|
partial class CustomInputRangeDate
|
||||||
|
{
|
||||||
|
/// <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(3, 3);
|
||||||
|
dateTimePicker.Name = "dateTimePicker";
|
||||||
|
dateTimePicker.Size = new Size(200, 23);
|
||||||
|
dateTimePicker.TabIndex = 0;
|
||||||
|
dateTimePicker.ValueChanged += dateTimePicker_ValueChanged;
|
||||||
|
//
|
||||||
|
// CustomInputRangeDate
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(dateTimePicker);
|
||||||
|
Name = "CustomInputRangeDate";
|
||||||
|
Size = new Size(206, 183);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DateTimePicker dateTimePicker;
|
||||||
|
}
|
||||||
|
}
|
91
VolkovLabs/WinFormsLibraryVolkov/CustomInputRangeDate.cs
Normal file
91
VolkovLabs/WinFormsLibraryVolkov/CustomInputRangeDate.cs
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
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 ToolTip = System.Windows.Forms.ToolTip;
|
||||||
|
|
||||||
|
namespace WinFormsLibraryVolkov
|
||||||
|
{
|
||||||
|
public partial class CustomInputRangeDate : UserControl
|
||||||
|
{
|
||||||
|
private EventHandler _changeEvent;
|
||||||
|
|
||||||
|
// Диапазон
|
||||||
|
private string example = "Введите дату от " + DateTime.MinValue.ToShortDateString() + " до " + DateTime.MaxValue.ToShortDateString();
|
||||||
|
|
||||||
|
// 2 публичных поля для настройки границ диапазона
|
||||||
|
public DateTime? MinDate { get; set; }
|
||||||
|
public DateTime? MaxDate { get; set; }
|
||||||
|
|
||||||
|
public CustomInputRangeDate()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Error { get; protected set; } = string.Empty;
|
||||||
|
|
||||||
|
//Публичное свойство для установки и получения введенного значения(set, get).
|
||||||
|
///При получении проводиться проверка,
|
||||||
|
//если введенное значение не входит в диапазон, возвращать
|
||||||
|
//значение null, а в отдельное поле выводить текст ошибки.При
|
||||||
|
//установке должна проводиться проверка, если передаваемое
|
||||||
|
//значение не входит в диапазон, то не заполнять поле компонента.
|
||||||
|
public DateTime? Date
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (MinDate == null || MaxDate == null)
|
||||||
|
{
|
||||||
|
Error = "Диапазон не задан";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (dateTimePicker.Value >= MinDate && dateTimePicker.Value <= MaxDate)
|
||||||
|
{
|
||||||
|
return dateTimePicker.Value;
|
||||||
|
}
|
||||||
|
Error = "Введенная дата лежит вне диапазона " + MinDate?.ToShortDateString() + " - " + MaxDate?.ToShortDateString();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (MinDate == null || MaxDate == null)
|
||||||
|
{
|
||||||
|
Error = "Диапазон не задан";
|
||||||
|
}
|
||||||
|
if (value.HasValue && value >= MinDate && value <= MaxDate)
|
||||||
|
{
|
||||||
|
dateTimePicker.Value = value.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dateTimePicker_Enter(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ToolTip tt = new ToolTip();
|
||||||
|
tt.Show(example, dateTimePicker, 30, -20, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dateTimePicker_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_changeEvent?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Cобытие, вызываемое при смене значения.
|
||||||
|
public event EventHandler ChangeEvent
|
||||||
|
{
|
||||||
|
add
|
||||||
|
{
|
||||||
|
_changeEvent += value;
|
||||||
|
}
|
||||||
|
remove
|
||||||
|
{
|
||||||
|
_changeEvent -= value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
VolkovLabs/WinFormsLibraryVolkov/CustomInputRangeDate.resx
Normal file
120
VolkovLabs/WinFormsLibraryVolkov/CustomInputRangeDate.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>
|
55
VolkovLabs/WinFormsLibraryVolkov/CustomTreeCell.Designer.cs
generated
Normal file
55
VolkovLabs/WinFormsLibraryVolkov/CustomTreeCell.Designer.cs
generated
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
namespace WinFormsLibraryVolkov
|
||||||
|
{
|
||||||
|
partial class CustomTreeCell
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
treeView = new TreeView();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// treeView
|
||||||
|
//
|
||||||
|
treeView.Location = new Point(3, 3);
|
||||||
|
treeView.Name = "treeView";
|
||||||
|
treeView.Size = new Size(447, 189);
|
||||||
|
treeView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// CustomTreeCell
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(treeView);
|
||||||
|
Name = "CustomTreeCell";
|
||||||
|
Size = new Size(453, 195);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private TreeView treeView;
|
||||||
|
}
|
||||||
|
}
|
117
VolkovLabs/WinFormsLibraryVolkov/CustomTreeCell.cs
Normal file
117
VolkovLabs/WinFormsLibraryVolkov/CustomTreeCell.cs
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace WinFormsLibraryVolkov
|
||||||
|
{
|
||||||
|
public partial class CustomTreeCell : UserControl
|
||||||
|
{
|
||||||
|
public CustomTreeCell()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
treeView.Nodes.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Публичное свойство для установки и получения индекса выбранной ветки(set, get).
|
||||||
|
protected DataTreeNodeConfig Levels { get; set; }
|
||||||
|
|
||||||
|
public void LoadConfig(DataTreeNodeConfig levels)
|
||||||
|
{
|
||||||
|
if (levels != null)
|
||||||
|
{
|
||||||
|
Levels = levels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public T GetSelectedObject<T>() where T : class, new()
|
||||||
|
{
|
||||||
|
if (treeView.SelectedNode == null || Levels == null || treeView.SelectedNode.Nodes.Count > 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Stack<string> stack = new Stack<string>();
|
||||||
|
for (TreeNode treeNode = treeView.SelectedNode; treeNode != null; treeNode = treeNode.Parent)
|
||||||
|
{
|
||||||
|
stack.Push(treeNode.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.Count != Levels.NodeNames.Count)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
T val = new T();
|
||||||
|
foreach (string nodeName in Levels.NodeNames)
|
||||||
|
{
|
||||||
|
PropertyInfo property = val.GetType().GetProperty(nodeName);
|
||||||
|
string value = stack.Pop();
|
||||||
|
property?.SetValue(val, Convert.ChangeType(value, property?.PropertyType));
|
||||||
|
}
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddCells<T>(int columnIndex, List<T> elements)
|
||||||
|
{
|
||||||
|
if (elements == null || elements.Count == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (T element in elements)
|
||||||
|
{
|
||||||
|
AddCell(columnIndex, element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обновленный метод для добавления одного элемента в дерево
|
||||||
|
public void AddCell<T>(int columnIndex, T element)
|
||||||
|
{
|
||||||
|
if (Levels == null || element == null || columnIndex < 0 || columnIndex >= Levels.NodeNames.Count)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TreeNodeCollection treeNodeCollection = treeView.Nodes;
|
||||||
|
int num = 0;
|
||||||
|
foreach (string nodeName in Levels.NodeNames)
|
||||||
|
{
|
||||||
|
// Получение значения свойства или поля
|
||||||
|
PropertyInfo property = element.GetType().GetProperty(nodeName);
|
||||||
|
string text = property?.GetValue(element, null)?.ToString() ?? nodeName;
|
||||||
|
|
||||||
|
TreeNode treeNode = null;
|
||||||
|
foreach (TreeNode item in treeNodeCollection)
|
||||||
|
{
|
||||||
|
if (item.Text == text)
|
||||||
|
{
|
||||||
|
treeNode = item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Если узел не найден, добавляем новый
|
||||||
|
treeNodeCollection = (treeNode == null) ? treeNodeCollection.Add(text).Nodes : treeNode.Nodes;
|
||||||
|
|
||||||
|
if (num >= columnIndex)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
VolkovLabs/WinFormsLibraryVolkov/CustomTreeCell.resx
Normal file
120
VolkovLabs/WinFormsLibraryVolkov/CustomTreeCell.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>
|
13
VolkovLabs/WinFormsLibraryVolkov/DataTreeNodeConfig.cs
Normal file
13
VolkovLabs/WinFormsLibraryVolkov/DataTreeNodeConfig.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WinFormsLibraryVolkov
|
||||||
|
{
|
||||||
|
public class DataTreeNodeConfig
|
||||||
|
{
|
||||||
|
public Queue<string> NodeNames { get; set; }
|
||||||
|
}
|
||||||
|
}
|
56
VolkovLabs/WinFormsLibraryVolkov/SelectionListBox.Designer.cs
generated
Normal file
56
VolkovLabs/WinFormsLibraryVolkov/SelectionListBox.Designer.cs
generated
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
namespace WinFormsLibraryVolkov
|
||||||
|
{
|
||||||
|
partial class SelectionListBox
|
||||||
|
{
|
||||||
|
/// <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(3, 1);
|
||||||
|
checkedListBox.Name = "checkedListBox";
|
||||||
|
checkedListBox.Size = new Size(144, 148);
|
||||||
|
checkedListBox.TabIndex = 0;
|
||||||
|
checkedListBox.Dock = DockStyle.Fill;
|
||||||
|
//
|
||||||
|
// SelectionListBox
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(checkedListBox);
|
||||||
|
Name = "SelectionListBox";
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private CheckedListBox checkedListBox;
|
||||||
|
}
|
||||||
|
}
|
97
VolkovLabs/WinFormsLibraryVolkov/SelectionListBox.cs
Normal file
97
VolkovLabs/WinFormsLibraryVolkov/SelectionListBox.cs
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace WinFormsLibraryVolkov
|
||||||
|
{
|
||||||
|
public partial class SelectionListBox : UserControl
|
||||||
|
{
|
||||||
|
public event EventHandler _changeEvent;
|
||||||
|
|
||||||
|
public SelectionListBox()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Метод для заполнения списка строками
|
||||||
|
public void PopulateList(IEnumerable<string> items)
|
||||||
|
{
|
||||||
|
if (items == null)
|
||||||
|
throw new ArgumentNullException(nameof(items));
|
||||||
|
|
||||||
|
checkedListBox.Items.Clear();
|
||||||
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
checkedListBox.Items.Add(item, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Метод для очистки списка
|
||||||
|
public void ClearList()
|
||||||
|
{
|
||||||
|
checkedListBox.Items.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Публичное свойство для получения и установки выбранного значения
|
||||||
|
public string SelectedValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
foreach (var item in checkedListBox.CheckedItems)
|
||||||
|
{
|
||||||
|
return item.ToString();
|
||||||
|
}
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
for (int i = 0; i < checkedListBox.Items.Count; i++)
|
||||||
|
{
|
||||||
|
if (checkedListBox.Items[i].ToString() == value)
|
||||||
|
{
|
||||||
|
checkedListBox.SetItemChecked(i, true);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
checkedListBox.SetItemChecked(i, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
// Если значение не найдено, очистить выбор
|
||||||
|
foreach (int index in checkedListBox.CheckedIndices)
|
||||||
|
{
|
||||||
|
checkedListBox.SetItemChecked(index, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработчик изменения состояния элементов
|
||||||
|
private void CheckedListBox_ItemCheck(object sender, ItemCheckEventArgs e)
|
||||||
|
{
|
||||||
|
// Используем BeginInvoke, чтобы дождаться завершения изменения
|
||||||
|
this.BeginInvoke((MethodInvoker)delegate
|
||||||
|
{
|
||||||
|
// Убедимся, что только один элемент выбран
|
||||||
|
for (int i = 0; i < checkedListBox.Items.Count; i++)
|
||||||
|
{
|
||||||
|
if (i != e.Index)
|
||||||
|
{
|
||||||
|
checkedListBox.SetItemChecked(i, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Вызов события
|
||||||
|
_changeEvent?.Invoke(this, EventArgs.Empty);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
VolkovLabs/WinFormsLibraryVolkov/SelectionListBox.resx
Normal file
120
VolkovLabs/WinFormsLibraryVolkov/SelectionListBox.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>
|
@ -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>
|
358
VolkovLabs/WinFormsTestApp/FormMain.Designer.cs
generated
Normal file
358
VolkovLabs/WinFormsTestApp/FormMain.Designer.cs
generated
Normal file
@ -0,0 +1,358 @@
|
|||||||
|
namespace WinFormsTestApp
|
||||||
|
{
|
||||||
|
partial class FormMain
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.customInputRangeDate = new WinFormsLibraryVolkov.CustomInputRangeDate();
|
||||||
|
this.buttonCheck = new System.Windows.Forms.Button();
|
||||||
|
this.labelCheckValue = new System.Windows.Forms.Label();
|
||||||
|
this.groupBoxInput = new System.Windows.Forms.GroupBox();
|
||||||
|
this.groupBoxSelected = new System.Windows.Forms.GroupBox();
|
||||||
|
this.buttonGetSelected = new System.Windows.Forms.Button();
|
||||||
|
this.labelSelectedValue = new System.Windows.Forms.Label();
|
||||||
|
this.buttonClear = new System.Windows.Forms.Button();
|
||||||
|
this.buttonAdd = new System.Windows.Forms.Button();
|
||||||
|
this.textBoxAdd = new System.Windows.Forms.TextBox();
|
||||||
|
this.SelectionListBox = new WinFormsLibraryVolkov.SelectionListBox();
|
||||||
|
this.groupBoxData = new System.Windows.Forms.GroupBox();
|
||||||
|
this.labelTransportType = new System.Windows.Forms.Label();
|
||||||
|
this.labelModel = new System.Windows.Forms.Label();
|
||||||
|
this.labelRegNum = new System.Windows.Forms.Label();
|
||||||
|
this.buttonGetFromTree = new System.Windows.Forms.Button();
|
||||||
|
this.buttonAddToTree = new System.Windows.Forms.Button();
|
||||||
|
this.comboBoxTransportType = new System.Windows.Forms.ComboBox();
|
||||||
|
this.textBoxModel = new System.Windows.Forms.TextBox();
|
||||||
|
this.textBoxRegNumber = new System.Windows.Forms.TextBox();
|
||||||
|
this.customTreeCell = new WinFormsLibraryVolkov.CustomTreeCell();
|
||||||
|
this.tabControl = new System.Windows.Forms.TabControl();
|
||||||
|
this.Visual = new System.Windows.Forms.TabPage();
|
||||||
|
this.groupBoxInput.SuspendLayout();
|
||||||
|
this.groupBoxSelected.SuspendLayout();
|
||||||
|
this.groupBoxData.SuspendLayout();
|
||||||
|
this.tabControl.SuspendLayout();
|
||||||
|
this.Visual.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// customInputRangeDate
|
||||||
|
//
|
||||||
|
this.customInputRangeDate.AutoValidate = System.Windows.Forms.AutoValidate.Disable;
|
||||||
|
this.customInputRangeDate.CausesValidation = false;
|
||||||
|
this.customInputRangeDate.Location = new System.Drawing.Point(34, 25);
|
||||||
|
this.customInputRangeDate.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
|
||||||
|
this.customInputRangeDate.MaxDate = new DateTime(2024, 12, 31);
|
||||||
|
this.customInputRangeDate.MinDate = new DateTime(2004, 01, 11);
|
||||||
|
this.customInputRangeDate.Name = "customInputRangeDate";
|
||||||
|
this.customInputRangeDate.Size = new System.Drawing.Size(144, 40);
|
||||||
|
this.customInputRangeDate.TabIndex = 0;
|
||||||
|
this.customInputRangeDate.Date = new DateTime(2024, 9, 1);
|
||||||
|
//
|
||||||
|
// buttonCheck
|
||||||
|
//
|
||||||
|
this.buttonCheck.Location = new System.Drawing.Point(193, 29);
|
||||||
|
this.buttonCheck.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.buttonCheck.Name = "buttonCheck";
|
||||||
|
this.buttonCheck.Size = new System.Drawing.Size(144, 31);
|
||||||
|
this.buttonCheck.TabIndex = 1;
|
||||||
|
this.buttonCheck.Text = "Check";
|
||||||
|
this.buttonCheck.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonCheck.Click += new System.EventHandler(this.buttonCheck_Click);
|
||||||
|
//
|
||||||
|
// labelCheckValue
|
||||||
|
//
|
||||||
|
this.labelCheckValue.AutoSize = true;
|
||||||
|
this.labelCheckValue.Location = new System.Drawing.Point(34, 148);
|
||||||
|
this.labelCheckValue.Name = "labelCheckValue";
|
||||||
|
this.labelCheckValue.Size = new System.Drawing.Size(82, 20);
|
||||||
|
this.labelCheckValue.TabIndex = 2;
|
||||||
|
this.labelCheckValue.Text = "Enter value";
|
||||||
|
//
|
||||||
|
// groupBoxInput
|
||||||
|
//
|
||||||
|
this.groupBoxInput.Controls.Add(this.customInputRangeDate);
|
||||||
|
this.groupBoxInput.Controls.Add(this.labelCheckValue);
|
||||||
|
this.groupBoxInput.Controls.Add(this.buttonCheck);
|
||||||
|
this.groupBoxInput.Location = new System.Drawing.Point(7, 8);
|
||||||
|
this.groupBoxInput.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.groupBoxInput.Name = "groupBoxInput";
|
||||||
|
this.groupBoxInput.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.groupBoxInput.Size = new System.Drawing.Size(355, 253);
|
||||||
|
this.groupBoxInput.TabIndex = 9;
|
||||||
|
this.groupBoxInput.TabStop = false;
|
||||||
|
this.groupBoxInput.Text = "Input";
|
||||||
|
//
|
||||||
|
// groupBoxSelected
|
||||||
|
//
|
||||||
|
this.groupBoxSelected.Controls.Add(this.buttonGetSelected);
|
||||||
|
this.groupBoxSelected.Controls.Add(this.labelSelectedValue);
|
||||||
|
this.groupBoxSelected.Controls.Add(this.buttonClear);
|
||||||
|
this.groupBoxSelected.Controls.Add(this.buttonAdd);
|
||||||
|
this.groupBoxSelected.Controls.Add(this.textBoxAdd);
|
||||||
|
this.groupBoxSelected.Controls.Add(this.SelectionListBox);
|
||||||
|
this.groupBoxSelected.Location = new System.Drawing.Point(370, 8);
|
||||||
|
this.groupBoxSelected.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.groupBoxSelected.Name = "groupBoxSelected";
|
||||||
|
this.groupBoxSelected.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.groupBoxSelected.Size = new System.Drawing.Size(355, 253);
|
||||||
|
this.groupBoxSelected.TabIndex = 10;
|
||||||
|
this.groupBoxSelected.TabStop = false;
|
||||||
|
this.groupBoxSelected.Text = "Selected";
|
||||||
|
//
|
||||||
|
// buttonGetSelected
|
||||||
|
//
|
||||||
|
this.buttonGetSelected.Location = new System.Drawing.Point(219, 192);
|
||||||
|
this.buttonGetSelected.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.buttonGetSelected.Name = "buttonGetSelected";
|
||||||
|
this.buttonGetSelected.Size = new System.Drawing.Size(114, 31);
|
||||||
|
this.buttonGetSelected.TabIndex = 14;
|
||||||
|
this.buttonGetSelected.Text = "Get Selected";
|
||||||
|
this.buttonGetSelected.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonGetSelected.Click += new System.EventHandler(this.buttonGetSelected_Click);
|
||||||
|
//
|
||||||
|
// labelSelectedValue
|
||||||
|
//
|
||||||
|
this.labelSelectedValue.AutoSize = true;
|
||||||
|
this.labelSelectedValue.Location = new System.Drawing.Point(219, 148);
|
||||||
|
this.labelSelectedValue.Name = "labelSelectedValue";
|
||||||
|
this.labelSelectedValue.Size = new System.Drawing.Size(105, 20);
|
||||||
|
this.labelSelectedValue.TabIndex = 11;
|
||||||
|
this.labelSelectedValue.Text = "Selected value";
|
||||||
|
//
|
||||||
|
// buttonClear
|
||||||
|
//
|
||||||
|
this.buttonClear.Location = new System.Drawing.Point(219, 108);
|
||||||
|
this.buttonClear.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.buttonClear.Name = "buttonClear";
|
||||||
|
this.buttonClear.Size = new System.Drawing.Size(114, 31);
|
||||||
|
this.buttonClear.TabIndex = 13;
|
||||||
|
this.buttonClear.Text = "Clear";
|
||||||
|
this.buttonClear.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonClear.Click += new System.EventHandler(this.buttonClear_Click);
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
this.buttonAdd.Location = new System.Drawing.Point(219, 69);
|
||||||
|
this.buttonAdd.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.buttonAdd.Name = "buttonAdd";
|
||||||
|
this.buttonAdd.Size = new System.Drawing.Size(114, 31);
|
||||||
|
this.buttonAdd.TabIndex = 12;
|
||||||
|
this.buttonAdd.Text = "Add or Select";
|
||||||
|
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
|
||||||
|
//
|
||||||
|
// textBoxAdd
|
||||||
|
//
|
||||||
|
this.textBoxAdd.Location = new System.Drawing.Point(219, 31);
|
||||||
|
this.textBoxAdd.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.textBoxAdd.Name = "textBoxAdd";
|
||||||
|
this.textBoxAdd.Size = new System.Drawing.Size(114, 27);
|
||||||
|
this.textBoxAdd.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// SelectionListBox
|
||||||
|
//
|
||||||
|
this.SelectionListBox.Location = new System.Drawing.Point(41, 25);
|
||||||
|
this.SelectionListBox.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
|
||||||
|
this.SelectionListBox.Name = "SelectionListBox";
|
||||||
|
this.SelectionListBox.SelectedValue = "";
|
||||||
|
this.SelectionListBox.Size = new System.Drawing.Size(171, 209);
|
||||||
|
this.SelectionListBox.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// groupBoxData
|
||||||
|
//
|
||||||
|
this.groupBoxData.Controls.Add(this.labelTransportType);
|
||||||
|
this.groupBoxData.Controls.Add(this.labelModel);
|
||||||
|
this.groupBoxData.Controls.Add(this.labelRegNum);
|
||||||
|
this.groupBoxData.Controls.Add(this.buttonGetFromTree);
|
||||||
|
this.groupBoxData.Controls.Add(this.buttonAddToTree);
|
||||||
|
this.groupBoxData.Controls.Add(this.comboBoxTransportType);
|
||||||
|
this.groupBoxData.Controls.Add(this.textBoxModel);
|
||||||
|
this.groupBoxData.Controls.Add(this.textBoxRegNumber);
|
||||||
|
this.groupBoxData.Controls.Add(this.customTreeCell);
|
||||||
|
this.groupBoxData.Location = new System.Drawing.Point(7, 269);
|
||||||
|
this.groupBoxData.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.groupBoxData.Name = "groupBoxData";
|
||||||
|
this.groupBoxData.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.groupBoxData.Size = new System.Drawing.Size(719, 307);
|
||||||
|
this.groupBoxData.TabIndex = 11;
|
||||||
|
this.groupBoxData.TabStop = false;
|
||||||
|
this.groupBoxData.Text = "Data";
|
||||||
|
//
|
||||||
|
// labelTransportType
|
||||||
|
//
|
||||||
|
this.labelTransportType.AutoSize = true;
|
||||||
|
this.labelTransportType.Location = new System.Drawing.Point(494, 155);
|
||||||
|
this.labelTransportType.Name = "labelTransportType";
|
||||||
|
this.labelTransportType.Size = new System.Drawing.Size(119, 20);
|
||||||
|
this.labelTransportType.TabIndex = 8;
|
||||||
|
this.labelTransportType.Text = "Тип транспорта";
|
||||||
|
//
|
||||||
|
// labelModel
|
||||||
|
//
|
||||||
|
this.labelModel.AutoSize = true;
|
||||||
|
this.labelModel.Location = new System.Drawing.Point(494, 96);
|
||||||
|
this.labelModel.Name = "labelModel";
|
||||||
|
this.labelModel.Size = new System.Drawing.Size(63, 20);
|
||||||
|
this.labelModel.TabIndex = 7;
|
||||||
|
this.labelModel.Text = "Модель";
|
||||||
|
//
|
||||||
|
// labelRegNum
|
||||||
|
//
|
||||||
|
this.labelRegNum.AutoSize = true;
|
||||||
|
this.labelRegNum.Location = new System.Drawing.Point(494, 37);
|
||||||
|
this.labelRegNum.Name = "labelRegNum";
|
||||||
|
this.labelRegNum.Size = new System.Drawing.Size(185, 20);
|
||||||
|
this.labelRegNum.TabIndex = 6;
|
||||||
|
this.labelRegNum.Text = "Регистрационный номер";
|
||||||
|
//
|
||||||
|
// buttonGetFromTree
|
||||||
|
//
|
||||||
|
this.buttonGetFromTree.Location = new System.Drawing.Point(494, 260);
|
||||||
|
this.buttonGetFromTree.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.buttonGetFromTree.Name = "buttonGetFromTree";
|
||||||
|
this.buttonGetFromTree.Size = new System.Drawing.Size(215, 31);
|
||||||
|
this.buttonGetFromTree.TabIndex = 5;
|
||||||
|
this.buttonGetFromTree.Text = "Get Selected";
|
||||||
|
this.buttonGetFromTree.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonGetFromTree.Click += new System.EventHandler(this.buttonGetFromTree_Click);
|
||||||
|
//
|
||||||
|
// buttonAddToTree
|
||||||
|
//
|
||||||
|
this.buttonAddToTree.Location = new System.Drawing.Point(494, 221);
|
||||||
|
this.buttonAddToTree.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.buttonAddToTree.Name = "buttonAddToTree";
|
||||||
|
this.buttonAddToTree.Size = new System.Drawing.Size(215, 31);
|
||||||
|
this.buttonAddToTree.TabIndex = 4;
|
||||||
|
this.buttonAddToTree.Text = "Add";
|
||||||
|
this.buttonAddToTree.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAddToTree.Click += new System.EventHandler(this.buttonAddToTree_Click);
|
||||||
|
//
|
||||||
|
// comboBoxTransportType
|
||||||
|
//
|
||||||
|
this.comboBoxTransportType.FormattingEnabled = true;
|
||||||
|
this.comboBoxTransportType.Location = new System.Drawing.Point(494, 179);
|
||||||
|
this.comboBoxTransportType.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.comboBoxTransportType.Name = "comboBoxTransportType";
|
||||||
|
this.comboBoxTransportType.Size = new System.Drawing.Size(214, 28);
|
||||||
|
this.comboBoxTransportType.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// textBoxModel
|
||||||
|
//
|
||||||
|
this.textBoxModel.Location = new System.Drawing.Point(494, 120);
|
||||||
|
this.textBoxModel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.textBoxModel.Name = "textBoxModel";
|
||||||
|
this.textBoxModel.Size = new System.Drawing.Size(214, 27);
|
||||||
|
this.textBoxModel.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// textBoxRegNumber
|
||||||
|
//
|
||||||
|
this.textBoxRegNumber.Location = new System.Drawing.Point(494, 61);
|
||||||
|
this.textBoxRegNumber.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.textBoxRegNumber.Name = "textBoxRegNumber";
|
||||||
|
this.textBoxRegNumber.Size = new System.Drawing.Size(214, 27);
|
||||||
|
this.textBoxRegNumber.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// customTreeCell
|
||||||
|
//
|
||||||
|
this.customTreeCell.Location = new System.Drawing.Point(17, 29);
|
||||||
|
this.customTreeCell.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
|
||||||
|
this.customTreeCell.Name = "customTreeCell";
|
||||||
|
this.customTreeCell.Size = new System.Drawing.Size(455, 269);
|
||||||
|
this.customTreeCell.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// tabControl
|
||||||
|
//
|
||||||
|
this.tabControl.Controls.Add(this.Visual);
|
||||||
|
this.tabControl.Location = new System.Drawing.Point(14, 16);
|
||||||
|
this.tabControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.tabControl.Name = "tabControl";
|
||||||
|
this.tabControl.SelectedIndex = 0;
|
||||||
|
this.tabControl.Size = new System.Drawing.Size(746, 621);
|
||||||
|
this.tabControl.TabIndex = 12;
|
||||||
|
//
|
||||||
|
// Visual
|
||||||
|
//
|
||||||
|
this.Visual.Controls.Add(this.groupBoxData);
|
||||||
|
this.Visual.Controls.Add(this.groupBoxInput);
|
||||||
|
this.Visual.Controls.Add(this.groupBoxSelected);
|
||||||
|
this.Visual.Location = new System.Drawing.Point(4, 29);
|
||||||
|
this.Visual.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Visual.Name = "Visual";
|
||||||
|
this.Visual.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Visual.Size = new System.Drawing.Size(738, 588);
|
||||||
|
this.Visual.TabIndex = 0;
|
||||||
|
this.Visual.Text = "Visual";
|
||||||
|
this.Visual.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// FormMain
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(771, 648);
|
||||||
|
this.Controls.Add(this.tabControl);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||||
|
this.Name = "FormMain";
|
||||||
|
this.Text = "FormMain";
|
||||||
|
this.groupBoxInput.ResumeLayout(false);
|
||||||
|
this.groupBoxInput.PerformLayout();
|
||||||
|
this.groupBoxSelected.ResumeLayout(false);
|
||||||
|
this.groupBoxSelected.PerformLayout();
|
||||||
|
this.groupBoxData.ResumeLayout(false);
|
||||||
|
this.groupBoxData.PerformLayout();
|
||||||
|
this.tabControl.ResumeLayout(false);
|
||||||
|
this.Visual.ResumeLayout(false);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private WinFormsLibraryVolkov.CustomInputRangeDate customInputRangeDate;
|
||||||
|
private Button buttonCheck;
|
||||||
|
private Label labelCheckValue;
|
||||||
|
private GroupBox groupBoxInput;
|
||||||
|
private GroupBox groupBoxSelected;
|
||||||
|
private Button buttonGetSelected;
|
||||||
|
private Label labelSelectedValue;
|
||||||
|
private Button buttonClear;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private TextBox textBoxAdd;
|
||||||
|
private WinFormsLibraryVolkov.SelectionListBox SelectionListBox;
|
||||||
|
private GroupBox groupBoxData;
|
||||||
|
private WinFormsLibraryVolkov.CustomTreeCell customTreeCell;
|
||||||
|
private Button buttonGetFromTree;
|
||||||
|
private Button buttonAddToTree;
|
||||||
|
private ComboBox comboBoxTransportType;
|
||||||
|
private TextBox textBoxModel;
|
||||||
|
private TextBox textBoxRegNumber;
|
||||||
|
private Label labelTransportType;
|
||||||
|
private Label labelModel;
|
||||||
|
private Label labelRegNum;
|
||||||
|
private TabControl tabControl;
|
||||||
|
private TabPage Visual;
|
||||||
|
}
|
||||||
|
}
|
120
VolkovLabs/WinFormsTestApp/FormMain.cs
Normal file
120
VolkovLabs/WinFormsTestApp/FormMain.cs
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
using WinFormsLibraryVolkov;
|
||||||
|
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 WinFormsTestApp
|
||||||
|
{
|
||||||
|
public partial class FormMain : Form
|
||||||
|
{
|
||||||
|
readonly List<Transport> transports = new()
|
||||||
|
{
|
||||||
|
new Transport { Id = 1, Fuel="Авиакеросин", Mileage=239000, Owner="Аэрофлот", Price=70000000, State="Эксплуатируется", RegNumber = "EW-009EC", TransportType = "Воздушный транспорт", Model = "Ан-30" },
|
||||||
|
new Transport { Id = 2, Fuel="Авиакеросин", Mileage=452005, Owner="Азимут", Price=95000000, State="Не эксплуатируется", RegNumber = "EW-987ZY", TransportType = "Воздушный транспорт", Model = "Ан-28" },
|
||||||
|
new Transport { Id = 3, Fuel="Мазут", Mileage=790222, Owner="ВМФ США", Price=100000000, State="Эксплуатируется", RegNumber = "SSH-988", TransportType = "Морской транспорт", Model = "авианосец 'Нимиц'" },
|
||||||
|
new Transport { Id = 4, Fuel="92", Mileage=105777, Owner="Ползунова Татьяна Михайловна",State="Не эксплуатируется", Price=400000, RegNumber = "B901AУ74", TransportType = "Наземный транспорт", Model = "Renault Logan" },
|
||||||
|
new Transport { Id = 5, Fuel="Газ", Mileage=66782, Owner="Аветесян Сергей Георгиевич", State="Эксплуатируется", Price=160000, RegNumber = "Р187КН73", TransportType = "Наземный транспорт", Model = "Daewoo Matiz" },
|
||||||
|
};
|
||||||
|
public FormMain()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
var list = new List<string>() { "Значение 1", "Значение 2", "Значение 3", "Значение 4", "Значение 5" };
|
||||||
|
SelectionListBox.PopulateList(list);
|
||||||
|
|
||||||
|
comboBoxTransportType.Items.Add("Наземный транспорт");
|
||||||
|
comboBoxTransportType.Items.Add("Воздушный транспорт");
|
||||||
|
comboBoxTransportType.Items.Add("Морской транспорт");
|
||||||
|
|
||||||
|
var nodeNames = new Queue<string>();
|
||||||
|
nodeNames.Enqueue("TransportType");
|
||||||
|
nodeNames.Enqueue("Model");
|
||||||
|
nodeNames.Enqueue("RegNumber");
|
||||||
|
var treeConfig = new DataTreeNodeConfig { NodeNames = nodeNames };
|
||||||
|
|
||||||
|
customTreeCell.LoadConfig(treeConfig);
|
||||||
|
|
||||||
|
int counter = 0;
|
||||||
|
foreach (var transport in transports)
|
||||||
|
{
|
||||||
|
|
||||||
|
customTreeCell.AddCell(0, transport);
|
||||||
|
customTreeCell.AddCell(1, transport);
|
||||||
|
customTreeCell.AddCell(2, transport);
|
||||||
|
customTreeCell.AddCell(3, transport);
|
||||||
|
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCheck_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// доделать
|
||||||
|
}
|
||||||
|
|
||||||
|
private void textBoxMin_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
char ch = e.KeyChar;
|
||||||
|
if (!Char.IsDigit(ch) && ch != 8 && ch != 45)
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void textBoxMax_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
char ch = e.KeyChar;
|
||||||
|
if (!Char.IsDigit(ch) && ch != 8 && ch != 45)
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// доделать
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonClear_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SelectionListBox.ClearList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonGetSelected_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
labelSelectedValue.Text = SelectionListBox.SelectedValue;
|
||||||
|
if (labelSelectedValue.Text == "")
|
||||||
|
{
|
||||||
|
labelSelectedValue.Text = "Значение \nне выбрано";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAddToTree_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (textBoxRegNumber.Text == null || textBoxModel.Text == null || comboBoxTransportType.SelectedItem == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
customTreeCell.AddCell<Transport>(2, new(textBoxRegNumber.Text, comboBoxTransportType.SelectedItem.ToString(), textBoxModel.Text));
|
||||||
|
customTreeCell.Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonGetFromTree_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Transport tp = customTreeCell.GetSelectedObject<Transport>();
|
||||||
|
if (tp == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
textBoxRegNumber.Text = tp.RegNumber;
|
||||||
|
textBoxModel.Text = tp.Model;
|
||||||
|
comboBoxTransportType.SelectedItem = tp.TransportType;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
69
VolkovLabs/WinFormsTestApp/FormMain.resx
Normal file
69
VolkovLabs/WinFormsTestApp/FormMain.resx
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<root>
|
||||||
|
<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="wordWithImages.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="wordWithTable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>161, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="wordWithDiagram.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>295, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
17
VolkovLabs/WinFormsTestApp/Program.cs
Normal file
17
VolkovLabs/WinFormsTestApp/Program.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace WinFormsTestApp
|
||||||
|
{
|
||||||
|
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 FormMain());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
37
VolkovLabs/WinFormsTestApp/Transport.cs
Normal file
37
VolkovLabs/WinFormsTestApp/Transport.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WinFormsTestApp
|
||||||
|
{
|
||||||
|
public class Transport
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string RegNumber { get; set; }
|
||||||
|
|
||||||
|
public string State { get; set; }
|
||||||
|
|
||||||
|
public int Mileage { get; set; }
|
||||||
|
|
||||||
|
public int Price { get; set; }
|
||||||
|
|
||||||
|
public string TransportType { get; set; }
|
||||||
|
|
||||||
|
public string Model { get; set; }
|
||||||
|
|
||||||
|
public string Owner { get; set; }
|
||||||
|
|
||||||
|
public string Fuel { get; set; }
|
||||||
|
|
||||||
|
public Transport(string regNumber, string transportType, string model)
|
||||||
|
{
|
||||||
|
RegNumber = regNumber;
|
||||||
|
TransportType = transportType;
|
||||||
|
Model = model;
|
||||||
|
}
|
||||||
|
public Transport() { }
|
||||||
|
}
|
||||||
|
}
|
15
VolkovLabs/WinFormsTestApp/WinFormsTestApp.csproj
Normal file
15
VolkovLabs/WinFormsTestApp/WinFormsTestApp.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="..\WinFormsLibraryVolkov\WinFormsLibraryVolkov.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
x
Reference in New Issue
Block a user