Compare commits
5 Commits
main
...
LabWork_01
Author | SHA1 | Date | |
---|---|---|---|
2bfe317437 | |||
c90b181d85 | |||
5b17be9211 | |||
82f6fc6e49 | |||
c5f307ec81 |
6
WinFormsProject/WinFormsLibrary/Class1.cs
Normal file
6
WinFormsProject/WinFormsLibrary/Class1.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace WinFormsLibrary
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
}
|
||||
}
|
58
WinFormsProject/WinFormsLibrary/CustomCheckedListBox.Designer.cs
generated
Normal file
58
WinFormsProject/WinFormsLibrary/CustomCheckedListBox.Designer.cs
generated
Normal file
@ -0,0 +1,58 @@
|
||||
namespace WinFormsLibrary
|
||||
{
|
||||
partial class CustomCheckedListBox
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.checkedListBox = new System.Windows.Forms.CheckedListBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// checkedListBox
|
||||
//
|
||||
this.checkedListBox.FormattingEnabled = true;
|
||||
this.checkedListBox.Location = new System.Drawing.Point(31, 16);
|
||||
this.checkedListBox.Name = "checkedListBox";
|
||||
this.checkedListBox.Size = new System.Drawing.Size(262, 94);
|
||||
this.checkedListBox.TabIndex = 0;
|
||||
this.checkedListBox.SelectedValueChanged += new System.EventHandler(this.checkedListBox_SelectedValueChanged);
|
||||
//
|
||||
// CustomCheckedListBox
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.checkedListBox);
|
||||
this.Name = "CustomCheckedListBox";
|
||||
this.Size = new System.Drawing.Size(333, 141);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private CheckedListBox checkedListBox;
|
||||
}
|
||||
}
|
78
WinFormsProject/WinFormsLibrary/CustomCheckedListBox.cs
Normal file
78
WinFormsProject/WinFormsLibrary/CustomCheckedListBox.cs
Normal file
@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace WinFormsLibrary
|
||||
{
|
||||
|
||||
public partial class CustomCheckedListBox : UserControl
|
||||
{
|
||||
public CustomCheckedListBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
checkedListBox.Items.Clear();
|
||||
}
|
||||
|
||||
public CheckedListBox.ObjectCollection Items
|
||||
{
|
||||
get
|
||||
{
|
||||
return checkedListBox.Items;
|
||||
}
|
||||
}
|
||||
|
||||
public string Selected
|
||||
{
|
||||
get
|
||||
{
|
||||
if (checkedListBox.SelectedItem != null)
|
||||
{
|
||||
return checkedListBox.SelectedItem.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
for (int i = 0; i < checkedListBox.Items.Count; ++i)
|
||||
{
|
||||
if (checkedListBox.Items[i].ToString() == value)
|
||||
{
|
||||
checkedListBox.SetItemChecked(i, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private EventHandler onValueChanged;
|
||||
public event EventHandler ValueChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
onValueChanged += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
onValueChanged -= value;
|
||||
}
|
||||
}
|
||||
|
||||
private void checkedListBox_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
onValueChanged?.Invoke(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
60
WinFormsProject/WinFormsLibrary/CustomCheckedListBox.resx
Normal file
60
WinFormsProject/WinFormsLibrary/CustomCheckedListBox.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<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>
|
||||
</root>
|
59
WinFormsProject/WinFormsLibrary/NumberTextBox.Designer.cs
generated
Normal file
59
WinFormsProject/WinFormsLibrary/NumberTextBox.Designer.cs
generated
Normal file
@ -0,0 +1,59 @@
|
||||
namespace WinFormsLibrary
|
||||
{
|
||||
partial class NumberTextBox
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
numericUpDown = new NumericUpDown();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDown).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// numericUpDown
|
||||
//
|
||||
numericUpDown.Location = new Point(117, 37);
|
||||
numericUpDown.Maximum = new decimal(new int[] { 110, 0, 0, 0 });
|
||||
numericUpDown.Minimum = new decimal(new int[] { 50, 0, 0, int.MinValue });
|
||||
numericUpDown.Name = "numericUpDown";
|
||||
numericUpDown.Size = new Size(120, 23);
|
||||
numericUpDown.TabIndex = 0;
|
||||
//
|
||||
// NumberTextBox
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
Controls.Add(numericUpDown);
|
||||
Name = "NumberTextBox";
|
||||
Size = new Size(364, 106);
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDown).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private NumericUpDown numericUpDown;
|
||||
}
|
||||
}
|
92
WinFormsProject/WinFormsLibrary/NumberTextBox.cs
Normal file
92
WinFormsProject/WinFormsLibrary/NumberTextBox.cs
Normal file
@ -0,0 +1,92 @@
|
||||
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 WinFormsLibrary
|
||||
{
|
||||
public partial class NumberTextBox : UserControl
|
||||
{
|
||||
public int? maxValue = null;
|
||||
public int? minValue = null;
|
||||
public string errorText = "";
|
||||
|
||||
public NumberTextBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
public int? MinValue
|
||||
{
|
||||
get { return minValue; }
|
||||
set
|
||||
{
|
||||
if (value == null) return;
|
||||
minValue = value;
|
||||
numericUpDown.Minimum = (int)value;
|
||||
}
|
||||
}
|
||||
|
||||
public int? MaxValue
|
||||
{
|
||||
get { return maxValue; }
|
||||
set
|
||||
{
|
||||
if (value == null) return;
|
||||
maxValue = value;
|
||||
numericUpDown.Maximum = (int)value;
|
||||
}
|
||||
}
|
||||
|
||||
public decimal? Value
|
||||
{
|
||||
get {
|
||||
if (CheckRanges(numericUpDown.Value))
|
||||
{
|
||||
return numericUpDown.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
if (CheckRanges(value))
|
||||
{
|
||||
numericUpDown.Value = (decimal)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckRanges(decimal? value)
|
||||
{
|
||||
if (MinValue == null || MaxValue == null)
|
||||
{
|
||||
errorText = "Ошибка, диапазоны не заданы.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (value < MinValue || value > MaxValue)
|
||||
{
|
||||
errorText = "Ошибка, значение не входит в заданный диапазон.";
|
||||
return false;
|
||||
}
|
||||
|
||||
errorText = "Ошибок нет.";
|
||||
return true;
|
||||
}
|
||||
|
||||
public event EventHandler DateChanged
|
||||
{
|
||||
add { numericUpDown.ValueChanged += value; }
|
||||
remove { numericUpDown.ValueChanged -= value; }
|
||||
}
|
||||
}
|
||||
}
|
60
WinFormsProject/WinFormsLibrary/NumberTextBox.resx
Normal file
60
WinFormsProject/WinFormsLibrary/NumberTextBox.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<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>
|
||||
</root>
|
56
WinFormsProject/WinFormsLibrary/TreeClass.Designer.cs
generated
Normal file
56
WinFormsProject/WinFormsLibrary/TreeClass.Designer.cs
generated
Normal file
@ -0,0 +1,56 @@
|
||||
namespace WinFormsLibrary
|
||||
{
|
||||
partial class TreeClass
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
this.treeView = new System.Windows.Forms.TreeView();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// treeView
|
||||
//
|
||||
this.treeView.Location = new System.Drawing.Point(0, 0);
|
||||
this.treeView.Name = "treeView";
|
||||
this.treeView.Size = new System.Drawing.Size(292, 224);
|
||||
this.treeView.TabIndex = 0;
|
||||
//
|
||||
// TreeClass
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.treeView);
|
||||
this.Name = "TreeClass";
|
||||
this.Size = new System.Drawing.Size(292, 224);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TreeView treeView;
|
||||
}
|
||||
}
|
133
WinFormsProject/WinFormsLibrary/TreeClass.cs
Normal file
133
WinFormsProject/WinFormsLibrary/TreeClass.cs
Normal file
@ -0,0 +1,133 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace WinFormsLibrary
|
||||
{
|
||||
public partial class TreeClass : UserControl
|
||||
{
|
||||
private List<string> hierarchy;
|
||||
public bool hasError = false;
|
||||
|
||||
public TreeClass()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void setHierarchy(List<string> h)
|
||||
{
|
||||
hierarchy = h;
|
||||
}
|
||||
|
||||
private bool hasValue(TreeNodeCollection nodes, string value)
|
||||
{
|
||||
foreach (TreeNode node in nodes)
|
||||
{
|
||||
if (node.Text == value) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool addData<T>(T t, string propertyName)
|
||||
{
|
||||
TreeNodeCollection current = treeView.Nodes;
|
||||
|
||||
foreach (string h in hierarchy)
|
||||
{
|
||||
if (h == propertyName)
|
||||
{
|
||||
var field = t.GetType().GetField(h);
|
||||
|
||||
if (field == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string value = field.GetValue(t).ToString();
|
||||
if (!hasValue(current, value)) current.Add(value);
|
||||
|
||||
TreeNode elem = null;
|
||||
|
||||
foreach (TreeNode child in current)
|
||||
{
|
||||
if (child.Text == value)
|
||||
{
|
||||
elem = child;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (elem != null) current = elem.Nodes;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!hasValue(current, h)) current.Add(h);
|
||||
|
||||
TreeNode elem = null;
|
||||
|
||||
foreach (TreeNode child in current)
|
||||
{
|
||||
if (child.Text == h)
|
||||
{
|
||||
elem = child;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (elem != null) current = elem.Nodes;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool setData<T>(T data, string propertyName)
|
||||
{
|
||||
bool status = addData<T>(data, propertyName);
|
||||
if (!status) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public T GetSelectedClass<T>() where T : new()
|
||||
{
|
||||
T res = default(T);
|
||||
TreeNode node = treeView.SelectedNode;
|
||||
|
||||
if (node.Nodes.Count != 0)
|
||||
{
|
||||
hasError = true;
|
||||
return res;
|
||||
}
|
||||
|
||||
for (int i = hierarchy.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (node == null)
|
||||
{
|
||||
hasError = true;
|
||||
return res;
|
||||
}
|
||||
|
||||
var curr = res.GetType().GetField(hierarchy[i]);
|
||||
if (curr == null)
|
||||
{
|
||||
hasError = true;
|
||||
return res;
|
||||
}
|
||||
|
||||
curr.SetValue(res, node.Text);
|
||||
node = node.Parent;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
60
WinFormsProject/WinFormsLibrary/TreeClass.resx
Normal file
60
WinFormsProject/WinFormsLibrary/TreeClass.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<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>
|
||||
</root>
|
10
WinFormsProject/WinFormsLibrary/WinFormsLibrary.csproj
Normal file
10
WinFormsProject/WinFormsLibrary/WinFormsLibrary.csproj
Normal file
@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
31
WinFormsProject/WinFormsProject.sln
Normal file
31
WinFormsProject/WinFormsProject.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.3.32819.101
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsProject", "WinFormsProject\WinFormsProject.csproj", "{1FC6ABE3-DF27-453A-B2EE-FA17C71C9CF0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsLibrary", "WinFormsLibrary\WinFormsLibrary.csproj", "{CF6B5601-DC60-48A2-8BDC-1CE32E3F6F15}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1FC6ABE3-DF27-453A-B2EE-FA17C71C9CF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1FC6ABE3-DF27-453A-B2EE-FA17C71C9CF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1FC6ABE3-DF27-453A-B2EE-FA17C71C9CF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1FC6ABE3-DF27-453A-B2EE-FA17C71C9CF0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CF6B5601-DC60-48A2-8BDC-1CE32E3F6F15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CF6B5601-DC60-48A2-8BDC-1CE32E3F6F15}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CF6B5601-DC60-48A2-8BDC-1CE32E3F6F15}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CF6B5601-DC60-48A2-8BDC-1CE32E3F6F15}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {2774D1CA-C461-4F94-89BF-C2FD28AC4024}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
97
WinFormsProject/WinFormsProject/Form1.Designer.cs
generated
Normal file
97
WinFormsProject/WinFormsProject/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,97 @@
|
||||
namespace WinFormsProject
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <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.customCheckedListBox1 = new WinFormsLibrary.CustomCheckedListBox();
|
||||
this.Button_Fill = new System.Windows.Forms.Button();
|
||||
this.Button_Clear = new System.Windows.Forms.Button();
|
||||
this.Button_GetChosenValues = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// customCheckedListBox1
|
||||
//
|
||||
this.customCheckedListBox1.Location = new System.Drawing.Point(21, 21);
|
||||
this.customCheckedListBox1.Name = "customCheckedListBox1";
|
||||
this.customCheckedListBox1.Selected = "";
|
||||
this.customCheckedListBox1.Size = new System.Drawing.Size(333, 141);
|
||||
this.customCheckedListBox1.TabIndex = 0;
|
||||
//
|
||||
// Button_Fill
|
||||
//
|
||||
this.Button_Fill.Location = new System.Drawing.Point(130, 141);
|
||||
this.Button_Fill.Name = "Button_Fill";
|
||||
this.Button_Fill.Size = new System.Drawing.Size(106, 45);
|
||||
this.Button_Fill.TabIndex = 1;
|
||||
this.Button_Fill.Text = "Заполнить";
|
||||
this.Button_Fill.UseVisualStyleBackColor = true;
|
||||
this.Button_Fill.Click += new System.EventHandler(this.Button_Fill_Click);
|
||||
//
|
||||
// Button_Clear
|
||||
//
|
||||
this.Button_Clear.Location = new System.Drawing.Point(130, 206);
|
||||
this.Button_Clear.Name = "Button_Clear";
|
||||
this.Button_Clear.Size = new System.Drawing.Size(106, 53);
|
||||
this.Button_Clear.TabIndex = 2;
|
||||
this.Button_Clear.Text = "Очистить";
|
||||
this.Button_Clear.UseVisualStyleBackColor = true;
|
||||
this.Button_Clear.Click += new System.EventHandler(this.Button_Clear_Click);
|
||||
//
|
||||
// Button_GetChosenValues
|
||||
//
|
||||
this.Button_GetChosenValues.Location = new System.Drawing.Point(130, 277);
|
||||
this.Button_GetChosenValues.Name = "Button_GetChosenValues";
|
||||
this.Button_GetChosenValues.Size = new System.Drawing.Size(106, 52);
|
||||
this.Button_GetChosenValues.TabIndex = 3;
|
||||
this.Button_GetChosenValues.Text = "Выбранные значения";
|
||||
this.Button_GetChosenValues.UseVisualStyleBackColor = true;
|
||||
this.Button_GetChosenValues.Click += new System.EventHandler(this.Button_GetChosenValues_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.Button_GetChosenValues);
|
||||
this.Controls.Add(this.Button_Clear);
|
||||
this.Controls.Add(this.Button_Fill);
|
||||
this.Controls.Add(this.customCheckedListBox1);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private WinFormsLibrary.CustomCheckedListBox customCheckedListBox1;
|
||||
private Button Button_Fill;
|
||||
private Button Button_Clear;
|
||||
private Button Button_GetChosenValues;
|
||||
}
|
||||
}
|
41
WinFormsProject/WinFormsProject/Form1.cs
Normal file
41
WinFormsProject/WinFormsProject/Form1.cs
Normal file
@ -0,0 +1,41 @@
|
||||
namespace WinFormsProject
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
List<string> list = new List<string> { "Ìàðàò", "Áóðàê", "Ðîâøàê" };
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
customCheckedListBox1.FillCheckedListBox(list);
|
||||
customCheckedListBox1.ValueChanged += CustomEventHandler;
|
||||
}
|
||||
|
||||
private void CustomEventHandler(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("Çíà÷åíèå áûëî èçìåíåíî.");
|
||||
}
|
||||
|
||||
private void Button_Clear_Click(object sender, EventArgs e)
|
||||
{
|
||||
customCheckedListBox1.Clear();
|
||||
}
|
||||
|
||||
private void Button_Fill_Click(object sender, EventArgs e)
|
||||
{
|
||||
customCheckedListBox1.FillCheckedListBox(list);
|
||||
}
|
||||
|
||||
private void Button_GetChosenValues_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (customCheckedListBox1.Selected == null || customCheckedListBox1.Selected == "")
|
||||
{
|
||||
MessageBox.Show("Íåòó âûáðàííûõ ýëåìåíòîâ.");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(customCheckedListBox1.Selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
60
WinFormsProject/WinFormsProject/Form1.resx
Normal file
60
WinFormsProject/WinFormsProject/Form1.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<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>
|
||||
</root>
|
17
WinFormsProject/WinFormsProject/Program.cs
Normal file
17
WinFormsProject/WinFormsProject/Program.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace WinFormsProject
|
||||
{
|
||||
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 Form1());
|
||||
}
|
||||
}
|
||||
}
|
15
WinFormsProject/WinFormsProject/WinFormsProject.csproj
Normal file
15
WinFormsProject/WinFormsProject/WinFormsProject.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="..\WinFormsLibrary\WinFormsLibrary.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user