Исправление лаб1
This commit is contained in:
parent
9464a7b934
commit
cbdf90f3ee
@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisEl", "VisEl\VisEl.csproj
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{D173D582-D0AE-45DF-88FC-0DE0A8183E82}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnvisualComponents", "UnvisualComponents\UnvisualComponents.csproj", "{1AFA08FF-CCF8-46DE-8980-D5C42B313267}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -21,6 +23,10 @@ Global
|
||||
{D173D582-D0AE-45DF-88FC-0DE0A8183E82}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D173D582-D0AE-45DF-88FC-0DE0A8183E82}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D173D582-D0AE-45DF-88FC-0DE0A8183E82}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1AFA08FF-CCF8-46DE-8980-D5C42B313267}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1AFA08FF-CCF8-46DE-8980-D5C42B313267}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1AFA08FF-CCF8-46DE-8980-D5C42B313267}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1AFA08FF-CCF8-46DE-8980-D5C42B313267}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
126
VisEl/Test/Form1.Designer.cs
generated
126
VisEl/Test/Form1.Designer.cs
generated
@ -45,15 +45,20 @@
|
||||
this.labelChecked = new System.Windows.Forms.Label();
|
||||
this.buttonStart = new System.Windows.Forms.Button();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.myTreeView1 = new VisEl.MyTreeView();
|
||||
this.myTextBoxDate = new VisEl.MyTextBoxDate();
|
||||
this.newCheckList1 = new VisEl.MyCheckList();
|
||||
this.buttonAddHier = new System.Windows.Forms.Button();
|
||||
this.labelHier = new System.Windows.Forms.Label();
|
||||
this.listBox1 = new System.Windows.Forms.ListBox();
|
||||
this.buttonGen = new System.Windows.Forms.Button();
|
||||
this.buttonTakeNode = new System.Windows.Forms.Button();
|
||||
this.labelNode = new System.Windows.Forms.Label();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.lab2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.labelChange = new System.Windows.Forms.Label();
|
||||
this.labelDateChange = new System.Windows.Forms.Label();
|
||||
this.myTreeView1 = new VisEl.MyTreeView();
|
||||
this.newCheckList1 = new VisEl.MyCheckList();
|
||||
this.myTextBoxDate = new VisEl.MyTextBoxDate();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBoxList
|
||||
@ -176,7 +181,7 @@
|
||||
// labelTitle
|
||||
//
|
||||
this.labelTitle.AutoSize = true;
|
||||
this.labelTitle.Location = new System.Drawing.Point(428, 286);
|
||||
this.labelTitle.Location = new System.Drawing.Point(394, 286);
|
||||
this.labelTitle.Name = "labelTitle";
|
||||
this.labelTitle.Size = new System.Drawing.Size(88, 16);
|
||||
this.labelTitle.TabIndex = 15;
|
||||
@ -203,42 +208,11 @@
|
||||
// comboBox1
|
||||
//
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Location = new System.Drawing.Point(525, 412);
|
||||
this.comboBox1.Location = new System.Drawing.Point(517, 432);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new System.Drawing.Size(121, 24);
|
||||
this.comboBox1.TabIndex = 19;
|
||||
//
|
||||
// myTreeView1
|
||||
//
|
||||
this.myTreeView1.AutoSize = true;
|
||||
this.myTreeView1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.myTreeView1.BackColor = System.Drawing.SystemColors.ControlDark;
|
||||
this.myTreeView1.Location = new System.Drawing.Point(12, 412);
|
||||
this.myTreeView1.Name = "myTreeView1";
|
||||
this.myTreeView1.Size = new System.Drawing.Size(427, 403);
|
||||
this.myTreeView1.TabIndex = 17;
|
||||
//
|
||||
// myTextBoxDate
|
||||
//
|
||||
this.myTextBoxDate.DateMaximum = new System.DateTime(2025, 12, 31, 0, 0, 0, 0);
|
||||
this.myTextBoxDate.DateMinimum = new System.DateTime(2000, 1, 1, 0, 0, 0, 0);
|
||||
this.myTextBoxDate.Location = new System.Drawing.Point(31, 286);
|
||||
this.myTextBoxDate.Name = "myTextBoxDate";
|
||||
this.myTextBoxDate.Size = new System.Drawing.Size(316, 150);
|
||||
this.myTextBoxDate.TabIndex = 11;
|
||||
this.myTextBoxDate.Value = "13.09.2023";
|
||||
//
|
||||
// newCheckList1
|
||||
//
|
||||
this.newCheckList1.AutoSize = true;
|
||||
this.newCheckList1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.newCheckList1.BackColor = System.Drawing.SystemColors.ActiveBorder;
|
||||
this.newCheckList1.Location = new System.Drawing.Point(31, 12);
|
||||
this.newCheckList1.Name = "newCheckList1";
|
||||
this.newCheckList1.selectedValue = "";
|
||||
this.newCheckList1.Size = new System.Drawing.Size(285, 248);
|
||||
this.newCheckList1.TabIndex = 0;
|
||||
//
|
||||
// buttonAddHier
|
||||
//
|
||||
this.buttonAddHier.Location = new System.Drawing.Point(678, 412);
|
||||
@ -294,11 +268,80 @@
|
||||
this.labelNode.Size = new System.Drawing.Size(0, 16);
|
||||
this.labelNode.TabIndex = 25;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.lab2ToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(800, 28);
|
||||
this.menuStrip1.TabIndex = 26;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// lab2ToolStripMenuItem
|
||||
//
|
||||
this.lab2ToolStripMenuItem.Name = "lab2ToolStripMenuItem";
|
||||
this.lab2ToolStripMenuItem.Size = new System.Drawing.Size(55, 24);
|
||||
this.lab2ToolStripMenuItem.Text = "Lab2";
|
||||
this.lab2ToolStripMenuItem.Click += new System.EventHandler(this.lab2ToolStripMenuItem_Click);
|
||||
//
|
||||
// labelChange
|
||||
//
|
||||
this.labelChange.AutoSize = true;
|
||||
this.labelChange.ForeColor = System.Drawing.Color.Red;
|
||||
this.labelChange.Location = new System.Drawing.Point(336, 128);
|
||||
this.labelChange.Name = "labelChange";
|
||||
this.labelChange.Size = new System.Drawing.Size(0, 16);
|
||||
this.labelChange.TabIndex = 27;
|
||||
//
|
||||
// labelDateChange
|
||||
//
|
||||
this.labelDateChange.AutoSize = true;
|
||||
this.labelDateChange.Location = new System.Drawing.Point(22, 419);
|
||||
this.labelDateChange.Name = "labelDateChange";
|
||||
this.labelDateChange.Size = new System.Drawing.Size(0, 16);
|
||||
this.labelDateChange.TabIndex = 28;
|
||||
//
|
||||
// myTreeView1
|
||||
//
|
||||
this.myTreeView1.AutoSize = true;
|
||||
this.myTreeView1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.myTreeView1.BackColor = System.Drawing.SystemColors.ControlDark;
|
||||
this.myTreeView1.Location = new System.Drawing.Point(13, 442);
|
||||
this.myTreeView1.Name = "myTreeView1";
|
||||
this.myTreeView1.Size = new System.Drawing.Size(427, 403);
|
||||
this.myTreeView1.TabIndex = 17;
|
||||
//
|
||||
// newCheckList1
|
||||
//
|
||||
this.newCheckList1.AutoSize = true;
|
||||
this.newCheckList1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.newCheckList1.BackColor = System.Drawing.SystemColors.ActiveBorder;
|
||||
this.newCheckList1.Location = new System.Drawing.Point(12, 32);
|
||||
this.newCheckList1.Name = "newCheckList1";
|
||||
this.newCheckList1.selectedValue = "";
|
||||
this.newCheckList1.Size = new System.Drawing.Size(285, 248);
|
||||
this.newCheckList1.TabIndex = 0;
|
||||
//
|
||||
// myTextBoxDate
|
||||
//
|
||||
this.myTextBoxDate.DateMaximum = null;
|
||||
this.myTextBoxDate.DateMinimum = null;
|
||||
this.myTextBoxDate.Location = new System.Drawing.Point(20, 286);
|
||||
this.myTextBoxDate.Name = "myTextBoxDate";
|
||||
this.myTextBoxDate.Size = new System.Drawing.Size(316, 95);
|
||||
this.myTextBoxDate.TabIndex = 29;
|
||||
this.myTextBoxDate.Value = null;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 867);
|
||||
this.Controls.Add(this.myTextBoxDate);
|
||||
this.Controls.Add(this.labelDateChange);
|
||||
this.Controls.Add(this.labelChange);
|
||||
this.Controls.Add(this.labelNode);
|
||||
this.Controls.Add(this.buttonTakeNode);
|
||||
this.Controls.Add(this.buttonGen);
|
||||
@ -313,7 +356,6 @@
|
||||
this.Controls.Add(this.buttonGiveTime);
|
||||
this.Controls.Add(this.buttonTakeTime);
|
||||
this.Controls.Add(this.dateTimePicker);
|
||||
this.Controls.Add(this.myTextBoxDate);
|
||||
this.Controls.Add(this.buttonReplace);
|
||||
this.Controls.Add(this.buttonTake);
|
||||
this.Controls.Add(this.textBoxTakeValue);
|
||||
@ -325,8 +367,12 @@
|
||||
this.Controls.Add(this.labelList);
|
||||
this.Controls.Add(this.textBoxList);
|
||||
this.Controls.Add(this.newCheckList1);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@ -345,7 +391,6 @@
|
||||
private System.Windows.Forms.TextBox textBoxTakeValue;
|
||||
private System.Windows.Forms.Button buttonTake;
|
||||
private System.Windows.Forms.Button buttonReplace;
|
||||
private VisEl.MyTextBoxDate myTextBoxDate;
|
||||
private System.Windows.Forms.DateTimePicker dateTimePicker;
|
||||
private System.Windows.Forms.Button buttonTakeTime;
|
||||
private System.Windows.Forms.Button buttonGiveTime;
|
||||
@ -360,6 +405,11 @@
|
||||
private System.Windows.Forms.Button buttonGen;
|
||||
private System.Windows.Forms.Button buttonTakeNode;
|
||||
private System.Windows.Forms.Label labelNode;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem lab2ToolStripMenuItem;
|
||||
private System.Windows.Forms.Label labelChange;
|
||||
private System.Windows.Forms.Label labelDateChange;
|
||||
private VisEl.MyTextBoxDate myTextBoxDate;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,19 @@ namespace Test
|
||||
InitializeComponent();
|
||||
comboBox1.Items.AddRange(typeof(Sportsmen).GetFields().Select(x => x.Name).ToArray());
|
||||
comboBox1.Items.AddRange(typeof(Sportsmen).GetProperties().Select(x => x.Name).ToArray());
|
||||
myTextBoxDate.DateMax = new DateTime(2019, 12, 1);
|
||||
myTextBoxDate.DateMin = new DateTime(2012, 12, 1);
|
||||
|
||||
newCheckList1.ValueChanged += CustomEvent_Handler;
|
||||
myTextBoxDate.ValueChanged += CustomEvent_HandlerDate;
|
||||
}
|
||||
private void CustomEvent_Handler(object sender, EventArgs e)
|
||||
{
|
||||
labelChange.Text = "oп оп я поменялся";
|
||||
}
|
||||
private void CustomEvent_HandlerDate(object sender, EventArgs e)
|
||||
{
|
||||
labelDateChange.Text = "Ку-ку";
|
||||
}
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
@ -64,19 +77,17 @@ namespace Test
|
||||
|
||||
private void buttonTakeTime_Click(object sender, EventArgs e)
|
||||
{
|
||||
labelChecked.Text = myTextBoxDate.Value;
|
||||
labelChecked.Text = myTextBoxDate.Value.ToString();
|
||||
}
|
||||
|
||||
private void buttonGiveTime_Click(object sender, EventArgs e)
|
||||
{
|
||||
myTextBoxDate.Value = dateTimePicker.Value.ToString();
|
||||
myTextBoxDate.Value = dateTimePicker.Value;
|
||||
}
|
||||
|
||||
private void buttonGO_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach(string step in stringToHierachy)
|
||||
myTreeView1.addToHierarchy(step, false);
|
||||
|
||||
myTreeView1.addToHierarchy(stringToHierachy);
|
||||
myTreeView1.LoadTree(sportsmens);
|
||||
labelHier.Text = "";
|
||||
stringToHierachy.Clear();
|
||||
@ -106,7 +117,15 @@ namespace Test
|
||||
|
||||
private void buttonTakeNode_Click(object sender, EventArgs e)
|
||||
{
|
||||
labelNode.Text = myTreeView1.GetNode();
|
||||
var f = typeof(Sportsmen);
|
||||
var res = myTreeView1.GetNode(typeof(Sportsmen));
|
||||
labelNode.Text = res.ToString();
|
||||
}
|
||||
|
||||
private void lab2ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Lab2 lab2 = new Lab2();
|
||||
lab2.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,4 +117,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
39
VisEl/Test/Lab2.Designer.cs
generated
Normal file
39
VisEl/Test/Lab2.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
||||
namespace Test
|
||||
{
|
||||
partial class Lab2
|
||||
{
|
||||
/// <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.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Lab2";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
20
VisEl/Test/Lab2.cs
Normal file
20
VisEl/Test/Lab2.cs
Normal file
@ -0,0 +1,20 @@
|
||||
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 Test
|
||||
{
|
||||
public partial class Lab2 : Form
|
||||
{
|
||||
public Lab2()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -52,6 +52,12 @@
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Lab2.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Lab2.Designer.cs">
|
||||
<DependentUpon>Lab2.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TestClasses\Sportsmen.cs" />
|
||||
|
@ -22,5 +22,10 @@ namespace TestLib
|
||||
this.country = country;
|
||||
this.awards = awards;
|
||||
}
|
||||
public Sportsmen() { }
|
||||
public override string ToString()
|
||||
{
|
||||
return country + " " + city + " " + name + " " + sport + " " + awards;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
VisEl/UnvisualComponents/ImageExcel.cs
Normal file
12
VisEl/UnvisualComponents/ImageExcel.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UnvisualComponents
|
||||
{
|
||||
public class ImageExcel
|
||||
{
|
||||
}
|
||||
}
|
9
VisEl/UnvisualComponents/UnvisualComponents.csproj
Normal file
9
VisEl/UnvisualComponents/UnvisualComponents.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
@ -12,6 +12,18 @@ namespace VisEl
|
||||
{
|
||||
public partial class MyCheckList : UserControl
|
||||
{
|
||||
private EventHandler onValueChanged;
|
||||
public event EventHandler ValueChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
onValueChanged += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
onValueChanged -= value;
|
||||
}
|
||||
}
|
||||
public MyCheckList()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -43,6 +55,7 @@ namespace VisEl
|
||||
{
|
||||
Random rn = new Random();
|
||||
checkedList.BackColor = Color.FromArgb(rn.Next(0,255), rn.Next(0, 255), rn.Next(0, 255));
|
||||
onValueChanged?.Invoke(this,e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
VisEl/VisEl/MyTextBoxDate.Designer.cs
generated
11
VisEl/VisEl/MyTextBoxDate.Designer.cs
generated
@ -29,7 +29,6 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.dateTimePicker = new System.Windows.Forms.DateTimePicker();
|
||||
this.labelEr = new System.Windows.Forms.Label();
|
||||
this.labelMin = new System.Windows.Forms.Label();
|
||||
this.labelMax = new System.Windows.Forms.Label();
|
||||
this.panel = new System.Windows.Forms.Panel();
|
||||
@ -46,14 +45,6 @@
|
||||
this.dateTimePicker.TabIndex = 0;
|
||||
this.dateTimePicker.ValueChanged += new System.EventHandler(this.dateTimePicker_ValueChanged);
|
||||
//
|
||||
// labelEr
|
||||
//
|
||||
this.labelEr.AutoSize = true;
|
||||
this.labelEr.Location = new System.Drawing.Point(27, 105);
|
||||
this.labelEr.Name = "labelEr";
|
||||
this.labelEr.Size = new System.Drawing.Size(0, 16);
|
||||
this.labelEr.TabIndex = 1;
|
||||
//
|
||||
// labelMin
|
||||
//
|
||||
this.labelMin.AutoSize = true;
|
||||
@ -87,7 +78,6 @@
|
||||
this.Controls.Add(this.panel);
|
||||
this.Controls.Add(this.labelMax);
|
||||
this.Controls.Add(this.labelMin);
|
||||
this.Controls.Add(this.labelEr);
|
||||
this.Name = "MyTextBoxDate";
|
||||
this.Size = new System.Drawing.Size(316, 150);
|
||||
this.panel.ResumeLayout(false);
|
||||
@ -99,7 +89,6 @@
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DateTimePicker dateTimePicker;
|
||||
private System.Windows.Forms.Label labelEr;
|
||||
private System.Windows.Forms.Label labelMin;
|
||||
private System.Windows.Forms.Label labelMax;
|
||||
private System.Windows.Forms.Panel panel;
|
||||
|
@ -1,9 +1,10 @@
|
||||
using System;
|
||||
using Microsoft.Build.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
@ -12,46 +13,65 @@ namespace VisEl
|
||||
{
|
||||
public partial class MyTextBoxDate : UserControl
|
||||
{
|
||||
public DateTime DateMin = new DateTime(1999, 1, 1);
|
||||
public DateTime DateMax = new DateTime(2025, 12, 31);
|
||||
private EventHandler onValueChanged;
|
||||
public event EventHandler ValueChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
onValueChanged += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
onValueChanged -= value;
|
||||
}
|
||||
}
|
||||
public string TextEr;
|
||||
public string Err { get { return TextEr; } private set { TextEr = value; } }
|
||||
public DateTime? DateMin = null;
|
||||
public DateTime? DateMax = null;
|
||||
public MyTextBoxDate()
|
||||
{
|
||||
InitializeComponent();
|
||||
labelMin.Text = DateMin.ToShortDateString();
|
||||
labelMax.Text = DateMax.ToShortDateString();
|
||||
}
|
||||
public DateTime DateMaximum {
|
||||
get { return DateMax; }
|
||||
set {
|
||||
DateMax = value;
|
||||
labelMax.Text = DateMax.ToString();
|
||||
public DateTime? DateMaximum {
|
||||
get { return DateMax ; }
|
||||
set {
|
||||
|
||||
DateMax = value;
|
||||
|
||||
}
|
||||
}
|
||||
public DateTime DateMinimum
|
||||
public DateTime? DateMinimum
|
||||
{
|
||||
get { return DateMin; }
|
||||
set
|
||||
{
|
||||
DateMin = value;
|
||||
labelMin.Text = DateMin.ToString();
|
||||
|
||||
DateMin = value;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
public string Value
|
||||
public DateTime? Value
|
||||
{
|
||||
get
|
||||
{
|
||||
if(DateMin is null || DateMax is null) {
|
||||
Err = "Ошибка: НЕТ диапазона";
|
||||
return null;
|
||||
}
|
||||
if (dateTimePicker.Value > DateMax || dateTimePicker.Value < DateMin)
|
||||
{
|
||||
labelEr.ForeColor = Color.Red;
|
||||
labelEr.Text = "Ошибка: Выход за допустимые пределы!!!";
|
||||
return null; }
|
||||
labelEr.Text = "";
|
||||
return dateTimePicker.Value.ToShortDateString();
|
||||
Err = "Ошибка: Выход за допустимые пределы!!!";
|
||||
return null;
|
||||
}
|
||||
return dateTimePicker.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (DateTime.Parse(value) > DateMax || DateTime.Parse(value) < DateMin) return;
|
||||
dateTimePicker.Value = DateTime.Parse(value);
|
||||
if (value == null) return;
|
||||
if (value > DateMax || value < DateMin) return;
|
||||
dateTimePicker.Value = (DateTime)value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,6 +79,7 @@ namespace VisEl
|
||||
{
|
||||
if (dateTimePicker.Value >= DateMinimum && dateTimePicker.Value <= DateMaximum) panel.BackColor = Color.LightBlue;
|
||||
else panel.BackColor = Color.Red;
|
||||
onValueChanged?.Invoke(this,e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,27 +8,45 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace VisEl
|
||||
{
|
||||
|
||||
public partial class MyTreeView : UserControl
|
||||
{
|
||||
List<(string, bool)> hierarchy = new List<(string, bool)>();
|
||||
List<string> hierarchy = new List<string>();
|
||||
public MyTreeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public void addToHierarchy(string member , bool isolation) { hierarchy.Add((member, isolation)); }
|
||||
public void addToHierarchy(List<string> list) { hierarchy = list; }
|
||||
public int GetId
|
||||
{
|
||||
get { return treeView.SelectedNode.Index; }
|
||||
get {
|
||||
if(treeView.SelectedNode.FirstNode == null)
|
||||
return treeView.SelectedNode.Index;
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
public string GetNode()
|
||||
public object GetNode<T>(T nodeClass) where T: Type
|
||||
{
|
||||
var res = Activator.CreateInstance(nodeClass);
|
||||
T child;
|
||||
if (treeView.SelectedNode.FirstNode == null)
|
||||
return treeView.SelectedNode.Text.ToString();
|
||||
{
|
||||
|
||||
TreeNode parent = treeView.SelectedNode;
|
||||
do
|
||||
{
|
||||
if (nodeClass.GetField(parent.Name) == null)
|
||||
nodeClass.GetProperty(parent.Name).SetValue(res, parent.Text);
|
||||
else nodeClass.GetField(parent.Name).SetValue(res, parent.Text);
|
||||
parent = parent.Parent;
|
||||
} while(parent != null);
|
||||
return res;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public void LoadTree<T>(List<T> nodes)
|
||||
@ -38,30 +56,23 @@ namespace VisEl
|
||||
{
|
||||
TreeNode parent = null;
|
||||
Type type = node.GetType();
|
||||
foreach((string, bool) step in hierarchy)
|
||||
foreach(string step in hierarchy)
|
||||
{
|
||||
var aa = type.GetFields();
|
||||
if (type.GetField(step.Item1) != null || type.GetProperty(step.Item1) != null)
|
||||
if (type.GetField(step) != null || type.GetProperty(step) != null)
|
||||
{
|
||||
var value = type.GetField(step.Item1) == null ? type.GetProperty(step.Item1).GetValue(node) : type.GetField(step.Item1).GetValue(node);
|
||||
var value = type.GetField(step) == null ? type.GetProperty(step).GetValue(node) : type.GetField(step).GetValue(node);
|
||||
TreeNode[] nodesLevel;
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
if (step.Item2)
|
||||
{
|
||||
TreeNode newNode = new TreeNode(value.ToString());
|
||||
newNode.Name = step.Item1;
|
||||
treeView.Nodes.Add(newNode);
|
||||
parent = newNode;
|
||||
continue;
|
||||
}
|
||||
nodesLevel = treeView.Nodes.Find(step.Item1, false);
|
||||
|
||||
nodesLevel = treeView.Nodes.Find(step, false);
|
||||
TreeNode currentNode = nodesLevel.FirstOrDefault(x => x.Text.Equals(value));
|
||||
if (currentNode is null)
|
||||
{
|
||||
TreeNode newNode = new TreeNode(value.ToString());
|
||||
newNode.Name = step.Item1;
|
||||
newNode.Name = step;
|
||||
treeView.Nodes.Add(newNode);
|
||||
parent = newNode;
|
||||
}else
|
||||
@ -72,20 +83,13 @@ namespace VisEl
|
||||
}
|
||||
else
|
||||
{
|
||||
if (step.Item2)
|
||||
{
|
||||
TreeNode newNode = new TreeNode(value.ToString());
|
||||
newNode.Name = step.Item1;
|
||||
parent.Nodes.Add(newNode);
|
||||
parent = newNode;
|
||||
continue;
|
||||
}
|
||||
nodesLevel = parent.Nodes.Find(step.Item1, false);
|
||||
|
||||
nodesLevel = parent.Nodes.Find(step, false);
|
||||
TreeNode currentNode = nodesLevel.FirstOrDefault(x => x.Text.Equals(value));
|
||||
if (currentNode is null)
|
||||
{
|
||||
TreeNode newNode = new TreeNode(value.ToString());
|
||||
newNode.Name = step.Item1;
|
||||
newNode.Name = step;
|
||||
parent.Nodes.Add(newNode);
|
||||
parent = newNode;
|
||||
}else
|
||||
|
@ -30,6 +30,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Build.Framework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
Loading…
Reference in New Issue
Block a user