Compare commits

...

2 Commits
main ... lab2

Author SHA1 Message Date
8f8f0ab6c1 готово 2023-10-13 17:33:04 +03:00
cbdf90f3ee Исправление лаб1 2023-09-27 12:07:44 +03:00
50 changed files with 1983 additions and 516 deletions

View File

@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisEl", "VisEl\VisEl.csproj", "{471DE73A-592F-45F0-8249-9F6DD539682C}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnvisableComponents", "UnvisableComponents\UnvisableComponents.csproj", "{B720A881-1A22-48BB-B0C6-23F616E6D10D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{D173D582-D0AE-45DF-88FC-0DE0A8183E82}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestForm", "TestForm\TestForm.csproj", "{53DEA306-E3B4-4662-A337-7076CF636F6A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisableComponents", "VisableComponents\VisableComponents.csproj", "{B0E42147-22BB-4B22-AB76-3C7DB2BF5353}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -13,14 +15,18 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{471DE73A-592F-45F0-8249-9F6DD539682C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{471DE73A-592F-45F0-8249-9F6DD539682C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{471DE73A-592F-45F0-8249-9F6DD539682C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{471DE73A-592F-45F0-8249-9F6DD539682C}.Release|Any CPU.Build.0 = Release|Any CPU
{D173D582-D0AE-45DF-88FC-0DE0A8183E82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{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
{B720A881-1A22-48BB-B0C6-23F616E6D10D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B720A881-1A22-48BB-B0C6-23F616E6D10D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B720A881-1A22-48BB-B0C6-23F616E6D10D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B720A881-1A22-48BB-B0C6-23F616E6D10D}.Release|Any CPU.Build.0 = Release|Any CPU
{53DEA306-E3B4-4662-A337-7076CF636F6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{53DEA306-E3B4-4662-A337-7076CF636F6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{53DEA306-E3B4-4662-A337-7076CF636F6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{53DEA306-E3B4-4662-A337-7076CF636F6A}.Release|Any CPU.Build.0 = Release|Any CPU
{B0E42147-22BB-4B22-AB76-3C7DB2BF5353}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0E42147-22BB-4B22-AB76-3C7DB2BF5353}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0E42147-22BB-4B22-AB76-3C7DB2BF5353}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0E42147-22BB-4B22-AB76-3C7DB2BF5353}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Test
{
internal static class Program
{
/// <summary>
/// Главная точка входа для приложения.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Общие сведения об этой сборке предоставляются следующим набором
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
// связанных со сборкой.
[assembly: AssemblyTitle("Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Test")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// COM, следует установить атрибут ComVisible в TRUE для этого типа.
[assembly: ComVisible(false)]
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
[assembly: Guid("d173d582-d0ae-45df-88fc-0de0a8183e82")]
// Сведения о версии сборки состоят из указанных ниже четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Редакция
//
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,71 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программным средством.
// Версия среды выполнения: 4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
// код создан повторно.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test.Properties
{
/// <summary>
/// Класс ресурсов со строгим типом для поиска локализованных строк и пр.
/// </summary>
// Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder
// класс с помощью таких средств, как ResGen или Visual Studio.
// Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen
// с параметром /str или заново постройте свой VS-проект.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Возврат кэшированного экземпляра ResourceManager, используемого этим классом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Test.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Переопределяет свойство CurrentUICulture текущего потока для всех
/// подстановки ресурсов с помощью этого класса ресурсов со строгим типом.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@ -1,30 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@ -1,93 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D173D582-D0AE-45DF-88FC-0DE0A8183E82}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Test</RootNamespace>
<AssemblyName>Test</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestClasses\Sportsmen.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VisEl\VisEl.csproj">
<Project>{471DE73A-592F-45F0-8249-9F6DD539682C}</Project>
<Name>VisEl</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,4 +1,4 @@
namespace Test
namespace TestForm
{
partial class Form1
{
@ -45,55 +45,62 @@
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 VisableComponents.MyTreeView();
this.newCheckList1 = new VisableComponents.MyCheckList();
this.myTextBoxDate = new VisableComponents.MyTextBoxDate();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// textBoxList
//
this.textBoxList.Location = new System.Drawing.Point(492, 12);
this.textBoxList.Location = new System.Drawing.Point(492, 15);
this.textBoxList.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.textBoxList.Name = "textBoxList";
this.textBoxList.Size = new System.Drawing.Size(261, 22);
this.textBoxList.Size = new System.Drawing.Size(261, 27);
this.textBoxList.TabIndex = 1;
//
// labelList
//
this.labelList.AutoSize = true;
this.labelList.Location = new System.Drawing.Point(336, 12);
this.labelList.Location = new System.Drawing.Point(336, 15);
this.labelList.Name = "labelList";
this.labelList.Size = new System.Drawing.Size(120, 16);
this.labelList.Size = new System.Drawing.Size(127, 20);
this.labelList.TabIndex = 2;
this.labelList.Text = "Создание списка";
//
// labelListEl
//
this.labelListEl.AutoSize = true;
this.labelListEl.Location = new System.Drawing.Point(336, 94);
this.labelListEl.Location = new System.Drawing.Point(336, 118);
this.labelListEl.Name = "labelListEl";
this.labelListEl.Size = new System.Drawing.Size(83, 16);
this.labelListEl.Size = new System.Drawing.Size(91, 20);
this.labelListEl.TabIndex = 3;
this.labelListEl.Text = "ListElements";
//
// elemetsOfList
//
this.elemetsOfList.AutoSize = true;
this.elemetsOfList.Location = new System.Drawing.Point(425, 94);
this.elemetsOfList.Location = new System.Drawing.Point(425, 118);
this.elemetsOfList.Name = "elemetsOfList";
this.elemetsOfList.Size = new System.Drawing.Size(0, 16);
this.elemetsOfList.Size = new System.Drawing.Size(0, 20);
this.elemetsOfList.TabIndex = 4;
//
// buttonAdd
//
this.buttonAdd.Location = new System.Drawing.Point(492, 55);
this.buttonAdd.Location = new System.Drawing.Point(492, 69);
this.buttonAdd.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.buttonAdd.Name = "buttonAdd";
this.buttonAdd.Size = new System.Drawing.Size(145, 23);
this.buttonAdd.Size = new System.Drawing.Size(145, 29);
this.buttonAdd.TabIndex = 5;
this.buttonAdd.Text = "Добавить в список";
this.buttonAdd.UseVisualStyleBackColor = true;
@ -101,9 +108,10 @@
//
// LoadInBox
//
this.LoadInBox.Location = new System.Drawing.Point(666, 55);
this.LoadInBox.Location = new System.Drawing.Point(666, 69);
this.LoadInBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.LoadInBox.Name = "LoadInBox";
this.LoadInBox.Size = new System.Drawing.Size(87, 23);
this.LoadInBox.Size = new System.Drawing.Size(87, 29);
this.LoadInBox.TabIndex = 6;
this.LoadInBox.Text = "Загрузить";
this.LoadInBox.UseVisualStyleBackColor = true;
@ -111,9 +119,10 @@
//
// buttonClear
//
this.buttonClear.Location = new System.Drawing.Point(339, 55);
this.buttonClear.Location = new System.Drawing.Point(339, 69);
this.buttonClear.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.buttonClear.Name = "buttonClear";
this.buttonClear.Size = new System.Drawing.Size(120, 23);
this.buttonClear.Size = new System.Drawing.Size(120, 29);
this.buttonClear.TabIndex = 7;
this.buttonClear.Text = "Очистить";
this.buttonClear.UseVisualStyleBackColor = true;
@ -121,16 +130,18 @@
//
// textBoxTakeValue
//
this.textBoxTakeValue.Location = new System.Drawing.Point(339, 147);
this.textBoxTakeValue.Location = new System.Drawing.Point(339, 184);
this.textBoxTakeValue.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.textBoxTakeValue.Name = "textBoxTakeValue";
this.textBoxTakeValue.Size = new System.Drawing.Size(321, 22);
this.textBoxTakeValue.Size = new System.Drawing.Size(321, 27);
this.textBoxTakeValue.TabIndex = 8;
//
// buttonTake
//
this.buttonTake.Location = new System.Drawing.Point(339, 193);
this.buttonTake.Location = new System.Drawing.Point(339, 241);
this.buttonTake.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.buttonTake.Name = "buttonTake";
this.buttonTake.Size = new System.Drawing.Size(75, 23);
this.buttonTake.Size = new System.Drawing.Size(75, 29);
this.buttonTake.TabIndex = 9;
this.buttonTake.Text = "Взять";
this.buttonTake.UseVisualStyleBackColor = true;
@ -138,9 +149,10 @@
//
// buttonReplace
//
this.buttonReplace.Location = new System.Drawing.Point(461, 192);
this.buttonReplace.Location = new System.Drawing.Point(461, 240);
this.buttonReplace.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.buttonReplace.Name = "buttonReplace";
this.buttonReplace.Size = new System.Drawing.Size(92, 23);
this.buttonReplace.Size = new System.Drawing.Size(92, 29);
this.buttonReplace.TabIndex = 10;
this.buttonReplace.Text = "Пяоменять";
this.buttonReplace.UseVisualStyleBackColor = true;
@ -148,16 +160,18 @@
//
// dateTimePicker
//
this.dateTimePicker.Location = new System.Drawing.Point(428, 321);
this.dateTimePicker.Location = new System.Drawing.Point(428, 401);
this.dateTimePicker.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.dateTimePicker.Name = "dateTimePicker";
this.dateTimePicker.Size = new System.Drawing.Size(200, 22);
this.dateTimePicker.Size = new System.Drawing.Size(200, 27);
this.dateTimePicker.TabIndex = 12;
//
// buttonTakeTime
//
this.buttonTakeTime.Location = new System.Drawing.Point(701, 286);
this.buttonTakeTime.Location = new System.Drawing.Point(701, 358);
this.buttonTakeTime.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.buttonTakeTime.Name = "buttonTakeTime";
this.buttonTakeTime.Size = new System.Drawing.Size(75, 23);
this.buttonTakeTime.Size = new System.Drawing.Size(75, 29);
this.buttonTakeTime.TabIndex = 13;
this.buttonTakeTime.Text = "Взять";
this.buttonTakeTime.UseVisualStyleBackColor = true;
@ -165,9 +179,10 @@
//
// buttonGiveTime
//
this.buttonGiveTime.Location = new System.Drawing.Point(428, 358);
this.buttonGiveTime.Location = new System.Drawing.Point(428, 448);
this.buttonGiveTime.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.buttonGiveTime.Name = "buttonGiveTime";
this.buttonGiveTime.Size = new System.Drawing.Size(75, 23);
this.buttonGiveTime.Size = new System.Drawing.Size(75, 29);
this.buttonGiveTime.TabIndex = 14;
this.buttonGiveTime.Text = "Загрузить";
this.buttonGiveTime.UseVisualStyleBackColor = true;
@ -176,25 +191,26 @@
// labelTitle
//
this.labelTitle.AutoSize = true;
this.labelTitle.Location = new System.Drawing.Point(428, 286);
this.labelTitle.Location = new System.Drawing.Point(394, 358);
this.labelTitle.Name = "labelTitle";
this.labelTitle.Size = new System.Drawing.Size(88, 16);
this.labelTitle.Size = new System.Drawing.Size(98, 20);
this.labelTitle.TabIndex = 15;
this.labelTitle.Text = "Вы выбрали:";
//
// labelChecked
//
this.labelChecked.AutoSize = true;
this.labelChecked.Location = new System.Drawing.Point(508, 285);
this.labelChecked.Location = new System.Drawing.Point(508, 356);
this.labelChecked.Name = "labelChecked";
this.labelChecked.Size = new System.Drawing.Size(0, 16);
this.labelChecked.Size = new System.Drawing.Size(0, 20);
this.labelChecked.TabIndex = 16;
//
// buttonStart
//
this.buttonStart.Location = new System.Drawing.Point(684, 743);
this.buttonStart.Location = new System.Drawing.Point(684, 929);
this.buttonStart.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.buttonStart.Name = "buttonStart";
this.buttonStart.Size = new System.Drawing.Size(75, 23);
this.buttonStart.Size = new System.Drawing.Size(75, 29);
this.buttonStart.TabIndex = 18;
this.buttonStart.Text = "Поехали";
this.buttonStart.UseVisualStyleBackColor = true;
@ -203,47 +219,18 @@
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(525, 412);
this.comboBox1.Location = new System.Drawing.Point(517, 540);
this.comboBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 24);
this.comboBox1.Size = new System.Drawing.Size(121, 28);
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);
this.buttonAddHier.Location = new System.Drawing.Point(678, 515);
this.buttonAddHier.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.buttonAddHier.Name = "buttonAddHier";
this.buttonAddHier.Size = new System.Drawing.Size(75, 23);
this.buttonAddHier.Size = new System.Drawing.Size(75, 29);
this.buttonAddHier.TabIndex = 20;
this.buttonAddHier.Text = "Добавить";
this.buttonAddHier.UseVisualStyleBackColor = true;
@ -252,25 +239,27 @@
// labelHier
//
this.labelHier.AutoSize = true;
this.labelHier.Location = new System.Drawing.Point(446, 460);
this.labelHier.Location = new System.Drawing.Point(446, 575);
this.labelHier.Name = "labelHier";
this.labelHier.Size = new System.Drawing.Size(0, 16);
this.labelHier.Size = new System.Drawing.Size(0, 20);
this.labelHier.TabIndex = 21;
//
// listBox1
//
this.listBox1.FormattingEnabled = true;
this.listBox1.ItemHeight = 16;
this.listBox1.Location = new System.Drawing.Point(517, 477);
this.listBox1.ItemHeight = 20;
this.listBox1.Location = new System.Drawing.Point(517, 596);
this.listBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(242, 260);
this.listBox1.Size = new System.Drawing.Size(242, 324);
this.listBox1.TabIndex = 22;
//
// buttonGen
//
this.buttonGen.Location = new System.Drawing.Point(678, 448);
this.buttonGen.Location = new System.Drawing.Point(678, 560);
this.buttonGen.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.buttonGen.Name = "buttonGen";
this.buttonGen.Size = new System.Drawing.Size(75, 23);
this.buttonGen.Size = new System.Drawing.Size(75, 29);
this.buttonGen.TabIndex = 23;
this.buttonGen.Text = "Генерир";
this.buttonGen.UseVisualStyleBackColor = true;
@ -278,9 +267,10 @@
//
// buttonTakeNode
//
this.buttonTakeNode.Location = new System.Drawing.Point(511, 743);
this.buttonTakeNode.Location = new System.Drawing.Point(511, 929);
this.buttonTakeNode.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.buttonTakeNode.Name = "buttonTakeNode";
this.buttonTakeNode.Size = new System.Drawing.Size(75, 23);
this.buttonTakeNode.Size = new System.Drawing.Size(75, 29);
this.buttonTakeNode.TabIndex = 24;
this.buttonTakeNode.Text = "Достать";
this.buttonTakeNode.UseVisualStyleBackColor = true;
@ -289,16 +279,88 @@
// labelNode
//
this.labelNode.AutoSize = true;
this.labelNode.Location = new System.Drawing.Point(514, 778);
this.labelNode.Location = new System.Drawing.Point(514, 972);
this.labelNode.Name = "labelNode";
this.labelNode.Size = new System.Drawing.Size(0, 16);
this.labelNode.Size = new System.Drawing.Size(0, 20);
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, 160);
this.labelChange.Name = "labelChange";
this.labelChange.Size = new System.Drawing.Size(0, 20);
this.labelChange.TabIndex = 27;
//
// labelDateChange
//
this.labelDateChange.AutoSize = true;
this.labelDateChange.Location = new System.Drawing.Point(22, 524);
this.labelDateChange.Name = "labelDateChange";
this.labelDateChange.Size = new System.Drawing.Size(0, 20);
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, 552);
this.myTreeView1.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
this.myTreeView1.Name = "myTreeView1";
this.myTreeView1.Size = new System.Drawing.Size(427, 503);
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, 40);
this.newCheckList1.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
this.newCheckList1.Name = "newCheckList1";
this.newCheckList1.selectedValue = "";
this.newCheckList1.Size = new System.Drawing.Size(285, 298);
this.newCheckList1.TabIndex = 0;
//
// myTextBoxDate
//
this.myTextBoxDate.DateMaximum = null;
this.myTextBoxDate.DateMinimum = null;
this.myTextBoxDate.Location = new System.Drawing.Point(20, 358);
this.myTextBoxDate.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
this.myTextBoxDate.Name = "myTextBoxDate";
this.myTextBoxDate.Size = new System.Drawing.Size(316, 119);
this.myTextBoxDate.TabIndex = 29;
this.myTextBoxDate.Value = null;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 867);
this.ClientSize = new System.Drawing.Size(800, 1055);
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 +375,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 +386,13 @@
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.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "Form1";
this.Text = "Form1";
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -334,7 +400,7 @@
#endregion
private VisEl.MyCheckList newCheckList1;
private VisableComponents.MyCheckList newCheckList1;
private System.Windows.Forms.TextBox textBoxList;
private System.Windows.Forms.Label labelList;
private System.Windows.Forms.Label labelListEl;
@ -345,13 +411,12 @@
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;
private System.Windows.Forms.Label labelTitle;
private System.Windows.Forms.Label labelChecked;
private VisEl.MyTreeView myTreeView1;
private VisableComponents.MyTreeView myTreeView1;
private System.Windows.Forms.Button buttonStart;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button buttonAddHier;
@ -360,6 +425,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 VisableComponents.MyTextBoxDate myTextBoxDate;
}
}

View File

@ -4,15 +4,14 @@ using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Management.Instrumentation;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TestLib;
using VisEl;
using VisableComponents;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace Test
namespace TestForm
{
public partial class Form1 : Form
{
@ -30,6 +29,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)
{
MessageBox.Show("Данные поменялись");
}
private void CustomEvent_HandlerDate(object sender, EventArgs e)
{
labelDateChange.Text = "Ку-ку";
}
private void buttonAdd_Click(object sender, EventArgs e)
@ -64,19 +76,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 +116,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();
}
}
}

63
VisEl/TestForm/Form1.resx Normal file
View File

@ -0,0 +1,63 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

197
VisEl/TestForm/Lab2.Designer.cs generated Normal file
View File

@ -0,0 +1,197 @@
namespace TestForm
{
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.imageExcel1 = new UnvisableComponents.ImageExcel(this.components);
this.buttonOne = new System.Windows.Forms.Button();
this.labelPathTitle = new System.Windows.Forms.Label();
this.labelImages = new System.Windows.Forms.Label();
this.buttonTakePath = new System.Windows.Forms.Button();
this.openFileDialogPath = new System.Windows.Forms.OpenFileDialog();
this.labelPath = new System.Windows.Forms.Label();
this.textBoxTitle = new System.Windows.Forms.TextBox();
this.labelTitle = new System.Windows.Forms.Label();
this.buttonTakeImage = new System.Windows.Forms.Button();
this.labelTakenImages = new System.Windows.Forms.Label();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.excelHead1 = new UnvisableComponents.ExcelHead(this.components);
this.buttonHead = new System.Windows.Forms.Button();
this.excelChart1 = new UnvisableComponents.ExcelChart(this.components);
this.buttonPaint = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// buttonOne
//
this.buttonOne.Location = new System.Drawing.Point(584, 40);
this.buttonOne.Name = "buttonOne";
this.buttonOne.Size = new System.Drawing.Size(94, 29);
this.buttonOne.TabIndex = 0;
this.buttonOne.Text = "Загрузить";
this.buttonOne.UseVisualStyleBackColor = true;
this.buttonOne.Click += new System.EventHandler(this.buttonOne_Click);
//
// labelPathTitle
//
this.labelPathTitle.AutoSize = true;
this.labelPathTitle.Location = new System.Drawing.Point(12, 40);
this.labelPathTitle.Name = "labelPathTitle";
this.labelPathTitle.Size = new System.Drawing.Size(41, 20);
this.labelPathTitle.TabIndex = 1;
this.labelPathTitle.Text = "Путь";
//
// labelImages
//
this.labelImages.AutoSize = true;
this.labelImages.Location = new System.Drawing.Point(12, 75);
this.labelImages.Name = "labelImages";
this.labelImages.Size = new System.Drawing.Size(75, 20);
this.labelImages.TabIndex = 2;
this.labelImages.Text = "Картинки";
//
// buttonTakePath
//
this.buttonTakePath.Location = new System.Drawing.Point(12, 8);
this.buttonTakePath.Name = "buttonTakePath";
this.buttonTakePath.Size = new System.Drawing.Size(121, 29);
this.buttonTakePath.TabIndex = 3;
this.buttonTakePath.Text = "ВыбратьПуть";
this.buttonTakePath.UseVisualStyleBackColor = true;
this.buttonTakePath.Click += new System.EventHandler(this.buttonTakePath_Click);
//
// openFileDialogPath
//
this.openFileDialogPath.FileName = "openFileDialogPath";
//
// labelPath
//
this.labelPath.AutoSize = true;
this.labelPath.Location = new System.Drawing.Point(59, 40);
this.labelPath.Name = "labelPath";
this.labelPath.Size = new System.Drawing.Size(0, 20);
this.labelPath.TabIndex = 4;
//
// textBoxTitle
//
this.textBoxTitle.Location = new System.Drawing.Point(337, 42);
this.textBoxTitle.Name = "textBoxTitle";
this.textBoxTitle.Size = new System.Drawing.Size(125, 27);
this.textBoxTitle.TabIndex = 5;
this.textBoxTitle.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// labelTitle
//
this.labelTitle.AutoSize = true;
this.labelTitle.Location = new System.Drawing.Point(254, 45);
this.labelTitle.Name = "labelTitle";
this.labelTitle.Size = new System.Drawing.Size(81, 20);
this.labelTitle.TabIndex = 6;
this.labelTitle.Text = "Заголовок";
//
// buttonTakeImage
//
this.buttonTakeImage.Location = new System.Drawing.Point(12, 98);
this.buttonTakeImage.Name = "buttonTakeImage";
this.buttonTakeImage.Size = new System.Drawing.Size(121, 29);
this.buttonTakeImage.TabIndex = 7;
this.buttonTakeImage.Text = "ВыбратьФото";
this.buttonTakeImage.UseVisualStyleBackColor = true;
this.buttonTakeImage.Click += new System.EventHandler(this.buttonTakeImage_Click);
//
// labelTakenImages
//
this.labelTakenImages.AutoSize = true;
this.labelTakenImages.Location = new System.Drawing.Point(93, 75);
this.labelTakenImages.Name = "labelTakenImages";
this.labelTakenImages.Size = new System.Drawing.Size(0, 20);
this.labelTakenImages.TabIndex = 8;
//
// buttonHead
//
this.buttonHead.Location = new System.Drawing.Point(12, 189);
this.buttonHead.Name = "buttonHead";
this.buttonHead.Size = new System.Drawing.Size(94, 29);
this.buttonHead.TabIndex = 9;
this.buttonHead.Text = "Go";
this.buttonHead.UseVisualStyleBackColor = true;
this.buttonHead.Click += new System.EventHandler(this.buttonHead_Click);
//
// buttonPaint
//
this.buttonPaint.Location = new System.Drawing.Point(12, 280);
this.buttonPaint.Name = "buttonPaint";
this.buttonPaint.Size = new System.Drawing.Size(94, 29);
this.buttonPaint.TabIndex = 10;
this.buttonPaint.Text = "Paint";
this.buttonPaint.UseVisualStyleBackColor = true;
this.buttonPaint.Click += new System.EventHandler(this.buttonPaint_Click);
//
// Lab2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.buttonPaint);
this.Controls.Add(this.buttonHead);
this.Controls.Add(this.labelTakenImages);
this.Controls.Add(this.buttonTakeImage);
this.Controls.Add(this.labelTitle);
this.Controls.Add(this.textBoxTitle);
this.Controls.Add(this.labelPath);
this.Controls.Add(this.buttonTakePath);
this.Controls.Add(this.labelImages);
this.Controls.Add(this.labelPathTitle);
this.Controls.Add(this.buttonOne);
this.Name = "Lab2";
this.Text = "Lab2";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private UnvisableComponents.ImageExcel imageExcel1;
private Button buttonOne;
private Label labelPathTitle;
private Label labelImages;
private Button buttonTakePath;
private OpenFileDialog openFileDialogPath;
private Label labelPath;
private TextBox textBoxTitle;
private Label labelTitle;
private Button buttonTakeImage;
private Label labelTakenImages;
private SaveFileDialog saveFileDialog1;
private UnvisableComponents.ExcelHead excelHead1;
private Button buttonHead;
private UnvisableComponents.ExcelChart excelChart1;
private Button buttonPaint;
}
}

110
VisEl/TestForm/Lab2.cs Normal file
View File

@ -0,0 +1,110 @@
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 TestLib;
using UnvisableComponents;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace TestForm
{
public partial class Lab2 : Form
{
ImageInfo info;
List<string> files;
string[] names = { "Vova M", "Sasha A", "Dima D", "Danila L" };
string[] sports = { "Run", "Swim", "Cycle", "Race", "Box" };
string[] cities = { "Moskow", "Samara", "Piter", "Kazan", "Kyrsk" };
string[] countries = { "Russia", "Spain", "China", "India", "Brazil" };
string[] rewards = { "#1", "#2", "KMS", "Olymp", "MS" };
List<Sportsmen> sportsmens = new List<Sportsmen>();
public Lab2()
{
InitializeComponent();
info = new ImageInfo();
files = new List<string>();
}
private void buttonOne_Click(object sender, EventArgs e)
{
info.Files = files;
imageExcel1.Load(info);
}
private void buttonTakePath_Click(object sender, EventArgs e)
{
if (saveFileDialog1.ShowDialog() == DialogResult.Cancel)
return;
string filename = saveFileDialog1.FileName;
labelPath.Text = filename;
info.Path = filename;
MessageBox.Show("Файл открыт");
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
info.Title = textBoxTitle.Text;
}
private void buttonTakeImage_Click(object sender, EventArgs e)
{
if (openFileDialogPath.ShowDialog() == DialogResult.Cancel)
return;
string filename = openFileDialogPath.FileName;
files.Add(filename);
labelTakenImages.Text +=" " + openFileDialogPath.FileName;
MessageBox.Show("Файл открыт");
}
private void buttonHead_Click(object sender, EventArgs e)
{
string path = @"C:\Users\Вова\Documents\WriteToExcel2.xlsx";
string title = "title";
ExcelInfo<Sportsmen> ei = new ExcelInfo<Sportsmen>();
ei.Title = title;
ei.Path = path;
ei.Dates = new List<Sportsmen>();
Dictionary<string, int> aloneFields = new Dictionary<string, int>();
ei.addDictionary("Personal", "name", 10);
ei.addDictionaryAlone("awards", 15);
ei.addDictionary("Personal", "city", 20);
ei.addDictionary("Proffesion", "Region", 30);
ei.addDictionary("Proffesion", "sport", 70);
sportsmens.Clear();
Random rn = new Random();
for (int i = 0; i < 10; i++)
{
Sportsmen sm = new Sportsmen(names[rn.Next(0, 4)], sports[rn.Next(0, 5)], cities[rn.Next(0, 5)], countries[rn.Next(0, 5)], rewards[rn.Next(0, 5)]);
sportsmens.Add(sm);
}
ei.Dates = sportsmens;
excelHead1.Load(ei);
}
private void buttonPaint_Click(object sender, EventArgs e)
{
string path = @"C:\Users\Вова\Documents\WriteToExcel2.xlsx";
string title = "title";
ChartInfo ci = new ChartInfo();
ci.Title = title;
ci.Path = path;
List<(string, int)> dates = new List<(string,int)>();
ci.DiagrammTitle = "CHARTTOP";
Random rn = new Random();
for (int i = 0; i < 5; i++)
{
dates.Add((names[rn.Next(0, 4)],rn.Next(1,10)));
}
ci.Dates = dates;
excelChart1.Load(ci);
}
}
}

75
VisEl/TestForm/Lab2.resx Normal file
View File

@ -0,0 +1,75 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="imageExcel1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>206, 17</value>
</metadata>
<metadata name="openFileDialogPath.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>343, 17</value>
</metadata>
<metadata name="excelHead1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>505, 17</value>
</metadata>
<metadata name="excelChart1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>636, 17</value>
</metadata>
</root>

17
VisEl/TestForm/Program.cs Normal file
View File

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

View File

@ -22,5 +22,10 @@ namespace TestLib
this.country = country;
this.awards = awards;
}
public Sportsmen() { }
public override string ToString()
{
return country + " " + city + " " + name + " " + sport + " " + awards;
}
}
}

View File

@ -0,0 +1,25 @@
<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="..\UnvisableComponents\UnvisableComponents.csproj" />
<ProjectReference Include="..\VisableComponents\VisableComponents.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Lab2.cs">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
</Project>

View File

@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace TestLib
{
public class Car
{
string model;
string Model { get { return model; } set { model = value; } }
string year;
string color;
public Car(string model, string year, string color)
{
this.model = model;
this.year = year;
this.color = color;
}
}
}

View File

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestLib
{
public class Employer
{
string name;
string proffesion;
string office;
public Employer(string name, string proffesion, string office)
{
this.name = name;
this.proffesion = proffesion;
this.office = office;
}
}
}

View File

@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TestLib
{
public class Sportsmen
{
string name;
string sport;
string city;
string country;
string Region { get { return city; } set { city = value; } }
int awards;
public Sportsmen(string name, string sport, string city, string country, int awards)
{
this.name = name;
this.sport = sport;
this.city = city;
this.country = country;
this.awards = awards;
}
}
}

View File

@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

Binary file not shown.

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UnvisableComponents
{
public class ChartInfo
{
private string path;
private string title;
private string diagrammTitle;
private List<(string,int)> dates = new List<(string, int)>();
private DirectionLegend dir = 0;
public string Path { get { return path; } set { path = value; } }
public string Title { get { return title; } set { title = value; } }
public string DiagrammTitle { get { return diagrammTitle; } set { diagrammTitle = value; } }
public DirectionLegend DirLegend { get { return dir; } set { dir = value; } }
public List<(string, int)> Dates { get { return dates; } set { dates = value; } }
public ChartInfo() { }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UnvisableComponents
{
public enum DirectionLegend
{
Up,
Left,
Right,
Bottom,
}
}

View File

@ -0,0 +1,36 @@
namespace UnvisableComponents
{
partial class ExcelChart
{
/// <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()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@ -0,0 +1,76 @@
using OfficeOpenXml.Style;
using OfficeOpenXml;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LicenseContext = OfficeOpenXml.LicenseContext;
using OfficeOpenXml.Drawing.Chart;
namespace UnvisableComponents
{
public partial class ExcelChart : Component
{
public ExcelChart()
{
InitializeComponent();
}
public ExcelChart(IContainer container)
{
container.Add(this);
InitializeComponent();
}
public void Load(ChartInfo info)
{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
Check(info);
List<string> fields = new List<string>();
using (ExcelPackage excelPackage = new ExcelPackage())
{
excelPackage.Workbook.Properties.Author = "Qawithexperts";
excelPackage.Workbook.Properties.Title = "test Excel";
excelPackage.Workbook.Properties.Subject = "Write in Excel";
excelPackage.Workbook.Properties.Created = DateTime.Now;
ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets.Add("Sheet 1");
worksheet.Cells["A1"].Value = info.Title;
int posString = 2;
int endColumn = 1;
int startColumn = 1;
foreach(var step in info.Dates)
{
worksheet.Cells[posString,endColumn].Value = step.Item1;
worksheet.Cells[posString+1, endColumn].Value = step.Item2;
endColumn++;
}
ExcelPieChart pieChart = worksheet.Drawings.AddChart("pieChart", eChartType.Pie3D) as ExcelPieChart;
pieChart.Title.Text = info.DiagrammTitle;
pieChart.Series.Add(ExcelRange.GetAddress(posString+1, startColumn, posString + 1, endColumn-1), ExcelRange.GetAddress(posString, startColumn, posString, endColumn-1));
pieChart.Legend.Position = (eLegendPosition)(int)info.DirLegend;
pieChart.DataLabel.ShowPercent = true;
pieChart.SetPosition(1, 0, 0, 0);
FileInfo fi = new FileInfo(info.Path);
excelPackage.SaveAs(fi);
}
}
public void Check(ChartInfo info)
{
if (string.IsNullOrEmpty(info.Title))
throw new Exception("Забыли заглавие");
if (string.IsNullOrEmpty(info.Path))
throw new Exception("Забыли путь");
if (!info.Path.EndsWith(".xlsx"))
info.Path += ".xlsx";
if (info.Dates.Count == 0)
throw new Exception("забыли данные");
}
}
}

View File

@ -0,0 +1,36 @@
namespace UnvisableComponents
{
partial class ExcelHead
{
/// <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()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@ -0,0 +1,145 @@
using OfficeOpenXml.Drawing;
using OfficeOpenXml;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LicenseContext = OfficeOpenXml.LicenseContext;
using System.Reflection;
using System.Xml.Linq;
using OfficeOpenXml.Style;
using System.Data.Common;
namespace UnvisableComponents
{
public partial class ExcelHead : Component
{
public ExcelHead()
{
InitializeComponent();
}
public ExcelHead(IContainer container)
{
container.Add(this);
InitializeComponent();
}
public void Load<T>(ExcelInfo<T> info) where T:class
{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
Check<T>(info);
List<string> fields = new List<string>();
using (ExcelPackage excelPackage = new ExcelPackage())
{
excelPackage.Workbook.Properties.Author = "Qawithexperts";
excelPackage.Workbook.Properties.Title = "test Excel";
excelPackage.Workbook.Properties.Subject = "Write in Excel";
excelPackage.Workbook.Properties.Created = DateTime.Now;
ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets.Add("Sheet 1");
worksheet.Cells["A1"].Value = info.Title;
int posString = 2;
int posColumn = 1;
foreach(var step in info.Filds)
{
if(step.Value.Item1.Count == 1)
{
worksheet.Cells[posString, posColumn, posString, posColumn+1].Merge = true;
worksheet.Cells[posString, posColumn].Value = step.Key;
worksheet.Cells[posString, posColumn].Style.Fill.PatternType = ExcelFillStyle.Solid;
worksheet.Cells[posString, posColumn].Style.Fill.BackgroundColor.SetColor(Color.LightGreen);
fields.Add(step.Key);
posString++;
continue;
}
worksheet.Cells[posString, posColumn, posString + step.Value.Item1.Count-1, posColumn].Merge = true;
worksheet.Cells[posString, posColumn].Value = step.Key;
worksheet.Cells[posString, posColumn].Style.TextRotation = 180;
worksheet.Cells[posString, posColumn].Style.Fill.PatternType = ExcelFillStyle.Solid;
worksheet.Cells[posString, posColumn].Style.Fill.BackgroundColor.SetColor(Color.AliceBlue);
worksheet.Column(posColumn).BestFit = true;
posColumn++;
foreach(var field in step.Value.Item1)
{
int id = step.Value.Item1.IndexOf(field);
worksheet.Cells[posString, posColumn].Value = field;
worksheet.Cells[posString, posColumn].Style.Fill.PatternType = ExcelFillStyle.Solid;
worksheet.Cells[posString, posColumn].Style.Fill.BackgroundColor.SetColor(Color.AliceBlue);
worksheet.Row(posString).Height = step.Value.Item2[id];
fields.Add(field);
posString++;
}
posColumn--;
}
posColumn = 3;
foreach (var step in info.Dates)
{
posString = 2;
var type = step.GetType();
foreach(var field in fields)
{
worksheet.Cells[posString, posColumn].Value =
type.GetField(field) == null ? type.GetProperty(field).GetValue(step) : type.GetField(field).GetValue(step);
posString++;
}
posColumn++;
}
CheckTable(worksheet, fields.Count, info.Dates.Count);
FileInfo fi = new FileInfo(info.Path);
excelPackage.SaveAs(fi);
}
}
public void Check<T>(ExcelInfo<T> info) where T : class
{
if (string.IsNullOrEmpty(info.Title))
throw new Exception("Забыли заглавие");
if (string.IsNullOrEmpty(info.Path))
throw new Exception("Забыли путь");
if (!info.Path.EndsWith(".xlsx"))
info.Path += ".xlsx";
if (info.Dates.Count == 0)
throw new Exception("забыли данные");
}
public void CheckTable(ExcelWorksheet worksheet, int rows, int columns)
{
int posString = 2;
int posColumn = 1;
rows += posString;
columns += posColumn;
while(posString < rows)
{
while (posColumn < columns)
{
if (worksheet.Cells[posString, posColumn].Value == null && !worksheet.Cells[posString, posColumn - 1 ,posString, posColumn].Merge)
throw new Exception("Пустая ячейка");
posColumn++;
}
posString++;
}
posString = 2;
posColumn = 3 + columns;
while(posString < rows )
{
if (worksheet.Cells[posString, posColumn].Value != null)
throw new Exception("Выход за границы");
posString++;
}
posString = 2 + rows;
posColumn = 1;
while (posColumn < columns)
{
if (worksheet.Cells[posString, posColumn].Value != null)
throw new Exception("Выход за границы");
posColumn++;
}
}
}
}

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace UnvisableComponents
{
public class ExcelInfo<T> where T: class
{
private string path;
private string title;
private List<T> dates;
private Dictionary<string, (List<string>, List<int>)> fields = new Dictionary<string, (List<string>, List<int>)>();
public string Path { get { return path; } set { path = value; } }
public string Title { get { return title; } set { title = value; } }
public List<T> Dates { get { return dates; } set { dates = value; } }
public Dictionary<string, (List<string>, List<int>)> Filds { get { return fields; } }
public void addDictionary(string name, string field, int height)
{
if (fields.ContainsKey(name))
{
fields[name].Item1.Add(field);
fields[name].Item2.Add(height);
}
else
{
fields.Add(name, (new List<string>(), new List<int>()));
fields[name].Item1.Add(field);
fields[name].Item2.Add(height);
}
}
public void addDictionaryAlone(string field, int height)
{
fields.Add(field, (new List<string>(), new List<int>()));
fields[field].Item1.Add(field);
fields[field].Item2.Add(height);
}
public ExcelInfo() { }
}
}

View File

@ -0,0 +1,36 @@
namespace UnvisableComponents
{
partial class ImageExcel
{
/// <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()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@ -0,0 +1,76 @@
using OfficeOpenXml;
using OfficeOpenXml.Drawing;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing.Design;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LicenseContext = OfficeOpenXml.LicenseContext;
namespace UnvisableComponents
{
public partial class ImageExcel : Component
{
public ImageExcel()
{
InitializeComponent();
}
public ImageExcel(IContainer container)
{
container.Add(this);
InitializeComponent();
}
public void Load(ImageInfo info)
{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
Check(info);
using (ExcelPackage excelPackage = new ExcelPackage())
{
excelPackage.Workbook.Properties.Author = "Qawithexperts";
excelPackage.Workbook.Properties.Title = "test Excel";
excelPackage.Workbook.Properties.Subject = "Write in Excel";
excelPackage.Workbook.Properties.Created = DateTime.Now;
ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets.Add("Sheet 1");
worksheet.Cells["A1"].Value = info.Title ;
int posString = 1;
int posColumn = 0;
int i = 1;
foreach(var image in info.Files)
{
ExcelPicture excelImage = null;
excelImage = worksheet.Drawings.AddPicture("image" + i, image);
excelImage.SetPosition(posString, 0, posColumn, 0);
excelImage.SetSize(100, 100);
i++;
posString += 10;
}
FileInfo fi = new FileInfo(info.Path);
excelPackage.SaveAs(fi);
}
}
public void Check(ImageInfo info)
{
if (string.IsNullOrEmpty(info.Title))
throw new Exception("Забыли заглавие");
if(string.IsNullOrEmpty(info.Path))
throw new Exception("Забыли путь");
if (!info.Path.EndsWith(".xlsx"))
info.Path += ".xlsx";
if (info.Files.Count == 0)
throw new Exception("забыли фото");
}
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UnvisableComponents
{
public class ImageInfo
{
private string path;
private string title;
private List<string> files;
public string Path { get { return path; } set { path = value; } }
public string Title { get { return title; } set { title = value; } }
public List<string> Files { get { return files; } set { files = value; } }
public ImageInfo() { }
}
}

View File

@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<None Remove="appSettings.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="appSettings.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EPPlus" Version="6.2.9" />
</ItemGroup>
<ItemGroup>
<Compile Update="ImageExcel.cs">
<SubType>Component</SubType>
</Compile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,9 @@
{
{
"EPPlus": {
"ExcelPackage": {
"LicenseContext": "NonCommercial" //The license context used
}
}
}
}

View File

@ -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);
}
}
}

View File

@ -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;

View File

@ -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; }
public DateTime? DateMaximum {
get { return DateMax ; }
set {
DateMax = value;
labelMax.Text = DateMax.ToString();
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);
}
}
}

View File

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

View File

@ -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" />

View File

@ -0,0 +1,65 @@
using System.Drawing;
namespace VisableComponents
{
partial class MyCheckList
{
/// <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.checkedList = new System.Windows.Forms.CheckedListBox();
this.SuspendLayout();
//
// checkedList
//
this.checkedList.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(123)))), ((int)(((byte)(200)))), ((int)(((byte)(246)))));
this.checkedList.FormattingEnabled = true;
this.checkedList.HorizontalScrollbar = true;
this.checkedList.Location = new System.Drawing.Point(3, 3);
this.checkedList.Name = "checkedList";
this.checkedList.Size = new System.Drawing.Size(279, 242);
this.checkedList.TabIndex = 0;
this.checkedList.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.checkedList_ItemCheck);
//
// MyCheckList
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.BackColor = Color.FromArgb(0,0,0);
this.Controls.Add(this.checkedList);
this.Name = "MyCheckList";
this.Size = new System.Drawing.Size(285, 248);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.CheckedListBox checkedList;
}
}

View File

@ -0,0 +1,61 @@
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 VisableComponents
{
public partial class MyCheckList : UserControl
{
private EventHandler onValueChanged;
public event EventHandler ValueChanged
{
add
{
onValueChanged += value;
}
remove
{
onValueChanged -= value;
}
}
public MyCheckList()
{
InitializeComponent();
}
public void LoadValues(List<string> Values)
{
checkedList.Items.AddRange(Values.ToArray());
}
public void RemoveAll()
{
checkedList.Items.Clear();
}
public string selectedValue {
get
{
if(checkedList.SelectedItem is null)
return "";
else
return checkedList.SelectedItem.ToString();
}
set {
if (checkedList.SelectedItem is null)
return;
checkedList.Items[checkedList.SelectedIndex] = value;
}
}
private void checkedList_ItemCheck(object sender, ItemCheckEventArgs e)
{
Random rn = new Random();
checkedList.BackColor = Color.FromArgb(rn.Next(0,255), rn.Next(0, 255), rn.Next(0, 255));
onValueChanged?.Invoke(this,e);
}
}
}

View File

@ -0,0 +1,96 @@
namespace VisableComponents
{
partial class MyTextBoxDate
{
/// <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.dateTimePicker = new System.Windows.Forms.DateTimePicker();
this.labelMin = new System.Windows.Forms.Label();
this.labelMax = new System.Windows.Forms.Label();
this.panel = new System.Windows.Forms.Panel();
this.panel.SuspendLayout();
this.SuspendLayout();
//
// dateTimePicker
//
this.dateTimePicker.Location = new System.Drawing.Point(12, 22);
this.dateTimePicker.MaxDate = new System.DateTime(9998, 12, 3, 0, 0, 0, 0);
this.dateTimePicker.MinDate = new System.DateTime(1753, 1, 2, 0, 0, 0, 0);
this.dateTimePicker.Name = "dateTimePicker";
this.dateTimePicker.Size = new System.Drawing.Size(200, 22);
this.dateTimePicker.TabIndex = 0;
this.dateTimePicker.ValueChanged += new System.EventHandler(this.dateTimePicker_ValueChanged);
//
// labelMin
//
this.labelMin.AutoSize = true;
this.labelMin.Location = new System.Drawing.Point(27, 0);
this.labelMin.Name = "labelMin";
this.labelMin.Size = new System.Drawing.Size(28, 16);
this.labelMin.TabIndex = 2;
this.labelMin.Text = "Min";
//
// labelMax
//
this.labelMax.AutoSize = true;
this.labelMax.Location = new System.Drawing.Point(186, 0);
this.labelMax.Name = "labelMax";
this.labelMax.Size = new System.Drawing.Size(32, 16);
this.labelMax.TabIndex = 3;
this.labelMax.Text = "Max";
//
// panel
//
this.panel.Controls.Add(this.dateTimePicker);
this.panel.Location = new System.Drawing.Point(30, 19);
this.panel.Name = "panel";
this.panel.Size = new System.Drawing.Size(226, 72);
this.panel.TabIndex = 4;
//
// MyTextBoxDate
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.panel);
this.Controls.Add(this.labelMax);
this.Controls.Add(this.labelMin);
this.Name = "MyTextBoxDate";
this.Size = new System.Drawing.Size(316, 150);
this.panel.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.DateTimePicker dateTimePicker;
private System.Windows.Forms.Label labelMin;
private System.Windows.Forms.Label labelMax;
private System.Windows.Forms.Panel panel;
}
}

View File

@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace VisableComponents
{
public partial class MyTextBoxDate : UserControl
{
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();
}
public DateTime? DateMaximum {
get { return DateMax ; }
set {
DateMax = value;
}
}
public DateTime? DateMinimum
{
get { return DateMin; }
set
{
DateMin = value;
}
}
public DateTime? Value
{
get
{
if(DateMin is null || DateMax is null) {
Err = "Ошибка: НЕТ диапазона";
return null;
}
if (dateTimePicker.Value > DateMax || dateTimePicker.Value < DateMin)
{
Err = "Ошибка: Выход за допустимые пределы!!!";
return null;
}
return dateTimePicker.Value;
}
set
{
if (value == null) return;
if (value > DateMax || value < DateMin) return;
dateTimePicker.Value = (DateTime)value;
}
}
private void dateTimePicker_ValueChanged(object sender, EventArgs e)
{
if (dateTimePicker.Value >= DateMinimum && dateTimePicker.Value <= DateMaximum) panel.BackColor = Color.LightBlue;
else panel.BackColor = Color.Red;
onValueChanged?.Invoke(this,e);
}
}
}

View File

@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -60,6 +60,7 @@
: 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">
@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<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">
@ -85,9 +87,10 @@
<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" msdata:Ordinal="1" />
<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">
@ -109,9 +112,9 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,59 @@
namespace VisableComponents
{
partial class MyTreeView
{
/// <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(3, 3);
this.treeView.Name = "treeView";
this.treeView.Size = new System.Drawing.Size(421, 397);
this.treeView.TabIndex = 0;
//
// MyTreeView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.BackColor = System.Drawing.SystemColors.ControlDark;
this.Controls.Add(this.treeView);
this.Name = "MyTreeView";
this.Size = new System.Drawing.Size(427, 403);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TreeView treeView;
}
}

View File

@ -0,0 +1,118 @@
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;
using System.Xml.Linq;
namespace VisableComponents
{
public partial class MyTreeView : UserControl
{
List<string> hierarchy = new List<string>();
public MyTreeView()
{
InitializeComponent();
}
public void addToHierarchy(List<string> list) { hierarchy = list; }
public int GetId
{
get {
if(treeView.SelectedNode.FirstNode == null)
return treeView.SelectedNode.Index;
return -1;
}
}
public object GetNode<T>(T nodeClass) where T: Type
{
if (hierarchy == null || hierarchy.Count == 0)
{
throw new Exception("Не задана иерархия");
}
if (treeView.SelectedNode?.FirstNode != null)
{
throw new Exception("Выбран не крайний элемент");
}
var res = Activator.CreateInstance(nodeClass);
T child;
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;
}
public void LoadTree<T>(List<T> nodes)
{
if(hierarchy == null || hierarchy.Count == 0)
{
throw new Exception("Не задана иерархия");
}
treeView.Nodes.Clear();
foreach (T node in nodes)
{
TreeNode parent = null;
Type type = node.GetType();
foreach(string step in hierarchy)
{
var aa = type.GetFields();
if (type.GetField(step) != null || type.GetProperty(step) != null)
{
var value = type.GetField(step) == null ? type.GetProperty(step).GetValue(node) : type.GetField(step).GetValue(node);
TreeNode[] nodesLevel;
if (parent == null)
{
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;
treeView.Nodes.Add(newNode);
parent = newNode;
}else
{
parent = currentNode;
continue;
}
}
else
{
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;
parent.Nodes.Add(newNode);
parent = newNode;
}else
{
parent = currentNode;
continue;
}
}
}
else break;
}
}
}
}
}

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,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Compile Update="MyCheckList.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Update="MyTextBoxDate.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Update="MyTreeView.cs">
<SubType>UserControl</SubType>
</Compile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,24 @@
<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="..\VisEl\VisEl.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Lab2.cs">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
</Project>