Compare commits

...

6 Commits

Author SHA1 Message Date
45e5a8066c fix for lab3 2024-11-10 16:43:20 +04:00
66702ee864 lab 1 done 2024-09-19 23:40:13 +04:00
cca38e76c1 lil fix 2024-09-18 19:06:51 +04:00
5f19fb8329 Хоть как-то но работает... 2024-09-04 20:00:33 +04:00
c44986349c still gotta work 2024-09-04 17:42:18 +04:00
52a0e50af6 almost done, still got a work on add and check buttons 2024-09-04 16:40:39 +04:00
18 changed files with 1513 additions and 0 deletions

31
VolkovLabs/VolkovLabs.sln Normal file
View 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

View File

@ -0,0 +1,59 @@
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(142, 23);
dateTimePicker.TabIndex = 0;
dateTimePicker.ValueChanged += dateTimePicker_ValueChanged;
dateTimePicker.Enter += dateTimePicker_Enter;
dateTimePicker.MaxDate = new DateTime(2024, 12, 31, 0, 0, 0, 0);
dateTimePicker.MinDate = new DateTime(2004, 1, 11, 0, 0, 0, 0);
//
// CustomInputRangeDate
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(dateTimePicker);
Name = "CustomInputRangeDate";
Size = new Size(148, 231);
ResumeLayout(false);
}
#endregion
private DateTimePicker dateTimePicker;
}
}

View 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;
// 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)
{
throw new ArgumentException("Диапазон не задан");
}
if (dateTimePicker.Value >= MinDate && dateTimePicker.Value <= MaxDate)
{
return dateTimePicker.Value;
}
throw new ArgumentException($"Введенная дана лежит вне диапазона {MinDate.ToShortDateString()} - {MaxDate.ToShortDateString()}");
}
set
{
if (MinDate == null || MaxDate == null)
{
Error = "Диапазон не задан";
}
if (value >= MinDate && value <= MaxDate)
{
dateTimePicker.Value = value;
}
}
}
private void dateTimePicker_Enter(object sender, EventArgs e)
{
ToolTip tt = new ToolTip();
example = "Введите дату от " + MinDate.ToShortDateString() + " до " + MaxDate.ToShortDateString();
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;
}
}
}
}

View File

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

View File

@ -0,0 +1,58 @@
namespace WinFormsLibraryVolkov
{
partial class CustomSelectedCheckedListBox
{
/// <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;
checkedListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.checkedListBox_ItemCheck);
checkedListBox.SelectedIndexChanged += new System.EventHandler(this.checkedListBox_SelectedIndexChanged);
//
// SelectionListBox
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(checkedListBox);
Name = "SelectionListBox";
ResumeLayout(false);
}
#endregion
private CheckedListBox checkedListBox;
}
}

View File

@ -0,0 +1,89 @@
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 CustomSelectedCheckedListBox : UserControl
{
public event EventHandler _changeEvent;
public CustomSelectedCheckedListBox()
{
InitializeComponent();
}
// Метод для заполнения списка строками
public void PopulateList(List<string> items)
{
if (items == null)
throw new ArgumentNullException(nameof(items));
foreach (var item in items)
{
checkedListBox.Items.Add(item, false);
}
}
//Cобытие, вызываемое при смене значения в CheckedListBox
public event EventHandler ChangeEvent
{
add
{
_changeEvent += value;
}
remove
{
_changeEvent -= value;
}
}
// Метод для очистки списка
public void ClearList()
{
checkedListBox.Items.Clear();
}
// Публичное свойство для получения и установки выбранного значения
public string SelectedElement
{
get
{
return (checkedListBox.SelectedIndex > -1 && checkedListBox.GetItemChecked(checkedListBox.SelectedIndex)) ? checkedListBox.SelectedItem.ToString() : string.Empty;
}
set
{
if (checkedListBox.Items.Contains(value))
{
int selectedIndex = checkedListBox.Items.IndexOf(value);
checkedListBox.SelectedItem = value;
checkedListBox.SetItemChecked(selectedIndex, true);
}
}
}
// Обработчик изменения состояния элементов
private void checkedListBox_ItemCheck(object sender, ItemCheckEventArgs e)
{
if (e.NewValue == CheckState.Checked && checkedListBox.CheckedItems.Count > 0)
{
checkedListBox.ItemCheck -= checkedListBox_ItemCheck;
checkedListBox.SetItemChecked(checkedListBox.CheckedIndices[0], value: false);
checkedListBox.ItemCheck += checkedListBox_ItemCheck;
}
}
private void checkedListBox_SelectedIndexChanged(object sender, EventArgs e)
{
_changeEvent?.Invoke(sender, e);
}
}
}

View File

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

View File

@ -0,0 +1,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;
}
}

View File

@ -0,0 +1,101 @@
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 void AddCell<T>(int columnIndex, T element)
{
if (Levels == null) throw new ArgumentException("Levels равен null");
if (element == null) throw new ArgumentException("element равен null");
if (columnIndex < 0) throw new ArgumentException("индекс колонки < 0");
if (columnIndex >= Levels.NodeNames.Count) throw new ArgumentException("Индекс колонки > чем общее кол-во");
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++;
}
}
public T GetSelectedObject<T>() where T : class, new()
{
if (treeView.SelectedNode == null) throw new ArgumentException("treeView.SelectedNode == null");
if (Levels == null) throw new ArgumentException("Levels равен null");
if (treeView.SelectedNode.Nodes.Count > 0) throw new ArgumentException("treeView.SelectedNode.Nodes.Count > 0");
T val = new T();
TreeNode treeNode = treeView.SelectedNode;
int i = Levels.NodeNames.ToArray().Length - 1; // Получаем массив из очереди
while (treeNode != null && i >= 0)
{
PropertyInfo property = val.GetType().GetProperty(Levels.NodeNames.ToArray()[i]); // Обращаемся к массиву
if (property != null)
{
property.SetValue(val, Convert.ChangeType(treeNode.Text, property.PropertyType));
}
treeNode = treeNode.Parent;
i--;
}
if (i >= 0)
{
return null; // Не все свойства объекта установлены
}
return val;
}
}
}

View File

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

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WinFormsLibraryVolkov
{
public class DataTreeNodeConfig
{
public Queue<string> NodeNames { get; set; }
}
}

View 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>

View File

@ -0,0 +1,339 @@
using WinFormsLibraryVolkov;
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()
{
customInputRangeDate = new WinFormsLibraryVolkov.CustomInputRangeDate();
buttonCheck = new Button();
labelCheckValue = new Label();
groupBoxInput = new GroupBox();
groupBoxSelected = new GroupBox();
buttonGetSelected = new Button();
labelSelectedValue = new Label();
buttonClear = new Button();
buttonAdd = new Button();
textBoxAdd = new TextBox();
customSelectedCheckedListBox = new WinFormsLibraryVolkov.CustomSelectedCheckedListBox();
groupBoxData = new GroupBox();
labelTransportType = new Label();
labelModel = new Label();
labelRegNum = new Label();
buttonGetFromTree = new Button();
buttonAddToTree = new Button();
comboBoxTransportType = new ComboBox();
textBoxModel = new TextBox();
textBoxRegNumber = new TextBox();
customTreeCell = new WinFormsLibraryVolkov.CustomTreeCell();
tabControl = new TabControl();
Visual = new TabPage();
groupBoxInput.SuspendLayout();
groupBoxSelected.SuspendLayout();
groupBoxData.SuspendLayout();
tabControl.SuspendLayout();
Visual.SuspendLayout();
SuspendLayout();
//
// customInputRangeDate
//
customInputRangeDate.AutoValidate = AutoValidate.Disable;
customInputRangeDate.CausesValidation = false;
customInputRangeDate.Date = new DateTime(2024, 9, 4, 18, 20, 42, 32);
customInputRangeDate.Location = new Point(15, 19);
customInputRangeDate.Margin = new Padding(3, 4, 3, 4);
customInputRangeDate.MaxDate = new DateTime(2024, 12, 31, 0, 0, 0, 0);
customInputRangeDate.MinDate = new DateTime(2004, 1, 11, 0, 0, 0, 0);
customInputRangeDate.Name = "customInputRangeDate";
customInputRangeDate.Size = new Size(148, 30);
customInputRangeDate.TabIndex = 0;
//
// buttonCheck
//
buttonCheck.Location = new Point(169, 22);
buttonCheck.Name = "buttonCheck";
buttonCheck.Size = new Size(126, 23);
buttonCheck.TabIndex = 1;
buttonCheck.Text = "Check";
buttonCheck.UseVisualStyleBackColor = true;
buttonCheck.Click += buttonCheck_Click;
//
// labelCheckValue
//
labelCheckValue.AutoSize = true;
labelCheckValue.Location = new Point(30, 111);
labelCheckValue.Name = "labelCheckValue";
labelCheckValue.Size = new Size(65, 15);
labelCheckValue.TabIndex = 2;
labelCheckValue.Text = "Enter value";
//
// groupBoxInput
//
groupBoxInput.Controls.Add(customInputRangeDate);
groupBoxInput.Controls.Add(labelCheckValue);
groupBoxInput.Controls.Add(buttonCheck);
groupBoxInput.Location = new Point(6, 6);
groupBoxInput.Name = "groupBoxInput";
groupBoxInput.Size = new Size(311, 190);
groupBoxInput.TabIndex = 9;
groupBoxInput.TabStop = false;
groupBoxInput.Text = "Input";
//
// groupBoxSelected
//
groupBoxSelected.Controls.Add(buttonGetSelected);
groupBoxSelected.Controls.Add(labelSelectedValue);
groupBoxSelected.Controls.Add(buttonClear);
groupBoxSelected.Controls.Add(buttonAdd);
groupBoxSelected.Controls.Add(textBoxAdd);
groupBoxSelected.Controls.Add(customSelectedCheckedListBox);
groupBoxSelected.Location = new Point(324, 6);
groupBoxSelected.Name = "groupBoxSelected";
groupBoxSelected.Size = new Size(311, 190);
groupBoxSelected.TabIndex = 10;
groupBoxSelected.TabStop = false;
groupBoxSelected.Text = "Selected";
//
// buttonGetSelected
//
buttonGetSelected.Location = new Point(174, 139);
buttonGetSelected.Name = "buttonGetSelected";
buttonGetSelected.Size = new Size(100, 23);
buttonGetSelected.TabIndex = 14;
buttonGetSelected.Text = "Get Selected";
buttonGetSelected.UseVisualStyleBackColor = true;
buttonGetSelected.Click += buttonGetSelected_Click;
//
// labelSelectedValue
//
labelSelectedValue.AutoSize = true;
labelSelectedValue.Location = new Point(178, 111);
labelSelectedValue.Name = "labelSelectedValue";
labelSelectedValue.Size = new Size(82, 15);
labelSelectedValue.TabIndex = 11;
labelSelectedValue.Text = "Selected value";
//
// buttonClear
//
buttonClear.Location = new Point(174, 81);
buttonClear.Name = "buttonClear";
buttonClear.Size = new Size(100, 23);
buttonClear.TabIndex = 13;
buttonClear.Text = "Clear";
buttonClear.UseVisualStyleBackColor = true;
buttonClear.Click += buttonClear_Click;
//
// buttonAdd
//
buttonAdd.Location = new Point(174, 52);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(100, 23);
buttonAdd.TabIndex = 12;
buttonAdd.Text = "Add or Select";
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += buttonAdd_Click;
//
// textBoxAdd
//
textBoxAdd.Location = new Point(162, 23);
textBoxAdd.Name = "textBoxAdd";
textBoxAdd.Size = new Size(140, 23);
textBoxAdd.TabIndex = 11;
//
// customSelectedCheckedListBox
//
customSelectedCheckedListBox.Location = new Point(6, 19);
customSelectedCheckedListBox.Margin = new Padding(3, 4, 3, 4);
customSelectedCheckedListBox.Name = "customSelectedCheckedListBox";
customSelectedCheckedListBox.SelectedElement = "";
customSelectedCheckedListBox.Size = new Size(150, 157);
customSelectedCheckedListBox.TabIndex = 0;
//
// groupBoxData
//
groupBoxData.Controls.Add(labelTransportType);
groupBoxData.Controls.Add(labelModel);
groupBoxData.Controls.Add(labelRegNum);
groupBoxData.Controls.Add(buttonGetFromTree);
groupBoxData.Controls.Add(buttonAddToTree);
groupBoxData.Controls.Add(comboBoxTransportType);
groupBoxData.Controls.Add(textBoxModel);
groupBoxData.Controls.Add(textBoxRegNumber);
groupBoxData.Controls.Add(customTreeCell);
groupBoxData.Location = new Point(6, 202);
groupBoxData.Name = "groupBoxData";
groupBoxData.Size = new Size(629, 230);
groupBoxData.TabIndex = 11;
groupBoxData.TabStop = false;
groupBoxData.Text = "Data";
//
// labelTransportType
//
labelTransportType.AutoSize = true;
labelTransportType.Location = new Point(432, 116);
labelTransportType.Name = "labelTransportType";
labelTransportType.Size = new Size(93, 15);
labelTransportType.TabIndex = 8;
labelTransportType.Text = "Тип транспорта";
//
// labelModel
//
labelModel.AutoSize = true;
labelModel.Location = new Point(432, 72);
labelModel.Name = "labelModel";
labelModel.Size = new Size(50, 15);
labelModel.TabIndex = 7;
labelModel.Text = "Модель";
//
// labelRegNum
//
labelRegNum.AutoSize = true;
labelRegNum.Location = new Point(432, 28);
labelRegNum.Name = "labelRegNum";
labelRegNum.Size = new Size(146, 15);
labelRegNum.TabIndex = 6;
labelRegNum.Text = "Регистрационный номер";
//
// buttonGetFromTree
//
buttonGetFromTree.Location = new Point(432, 195);
buttonGetFromTree.Name = "buttonGetFromTree";
buttonGetFromTree.Size = new Size(188, 23);
buttonGetFromTree.TabIndex = 5;
buttonGetFromTree.Text = "Get Selected";
buttonGetFromTree.UseVisualStyleBackColor = true;
buttonGetFromTree.Click += buttonGetFromTree_Click;
//
// buttonAddToTree
//
buttonAddToTree.Location = new Point(432, 166);
buttonAddToTree.Name = "buttonAddToTree";
buttonAddToTree.Size = new Size(188, 23);
buttonAddToTree.TabIndex = 4;
buttonAddToTree.Text = "Add";
buttonAddToTree.UseVisualStyleBackColor = true;
buttonAddToTree.Click += buttonAddToTree_Click;
//
// comboBoxTransportType
//
comboBoxTransportType.FormattingEnabled = true;
comboBoxTransportType.Location = new Point(432, 134);
comboBoxTransportType.Name = "comboBoxTransportType";
comboBoxTransportType.Size = new Size(188, 23);
comboBoxTransportType.TabIndex = 3;
//
// textBoxModel
//
textBoxModel.Location = new Point(432, 90);
textBoxModel.Name = "textBoxModel";
textBoxModel.Size = new Size(188, 23);
textBoxModel.TabIndex = 2;
//
// textBoxRegNumber
//
textBoxRegNumber.Location = new Point(432, 46);
textBoxRegNumber.Name = "textBoxRegNumber";
textBoxRegNumber.Size = new Size(188, 23);
textBoxRegNumber.TabIndex = 1;
//
// customTreeCell
//
customTreeCell.Location = new Point(15, 22);
customTreeCell.Margin = new Padding(3, 4, 3, 4);
customTreeCell.Name = "customTreeCell";
customTreeCell.Size = new Size(398, 202);
customTreeCell.TabIndex = 0;
//
// tabControl
//
tabControl.Controls.Add(Visual);
tabControl.Location = new Point(12, 12);
tabControl.Name = "tabControl";
tabControl.SelectedIndex = 0;
tabControl.Size = new Size(653, 466);
tabControl.TabIndex = 12;
//
// Visual
//
Visual.Controls.Add(groupBoxData);
Visual.Controls.Add(groupBoxInput);
Visual.Controls.Add(groupBoxSelected);
Visual.Location = new Point(4, 24);
Visual.Name = "Visual";
Visual.Padding = new Padding(3);
Visual.Size = new Size(645, 438);
Visual.TabIndex = 0;
Visual.Text = "Visual";
Visual.UseVisualStyleBackColor = true;
//
// FormMain
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(675, 486);
Controls.Add(tabControl);
Name = "FormMain";
Text = "FormMain";
groupBoxInput.ResumeLayout(false);
groupBoxInput.PerformLayout();
groupBoxSelected.ResumeLayout(false);
groupBoxSelected.PerformLayout();
groupBoxData.ResumeLayout(false);
groupBoxData.PerformLayout();
tabControl.ResumeLayout(false);
Visual.ResumeLayout(false);
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.CustomSelectedCheckedListBox customSelectedCheckedListBox;
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;
}
}

View File

@ -0,0 +1,118 @@
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" };
customSelectedCheckedListBox.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)
{
labelCheckValue.Text = customInputRangeDate.Date.ToString();
if (labelCheckValue.Text == "")
{
labelCheckValue.Text = customInputRangeDate.Error;
}
}
private void buttonAdd_Click(object sender, EventArgs e)
{
string newItem = textBoxAdd.Text.Trim();
if (!string.IsNullOrEmpty(newItem))
{
var itemsToAdd = new List<string> { newItem };
// Добавляем новый элемент в список
customSelectedCheckedListBox.PopulateList(itemsToAdd);
}
else
{
MessageBox.Show("Введите элемент для добавления.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
private void buttonClear_Click(object sender, EventArgs e)
{
customSelectedCheckedListBox.ClearList();
}
private void buttonGetSelected_Click(object sender, EventArgs e)
{
labelSelectedValue.Text = customSelectedCheckedListBox.SelectedElement;
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;
}
}
}

View File

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

View File

@ -0,0 +1,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());
}
}
}

View 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() { }
}
}

View 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>