diff --git a/VisEl/KOP.sln b/VisEl/KOP.sln index 9b57c0c..992dd22 100644 --- a/VisEl/KOP.sln +++ b/VisEl/KOP.sln @@ -3,11 +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}") = "UnvisualComponents", "UnvisualComponents\UnvisualComponents.csproj", "{1AFA08FF-CCF8-46DE-8980-D5C42B313267}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisableComponents", "VisableComponents\VisableComponents.csproj", "{B0E42147-22BB-4B22-AB76-3C7DB2BF5353}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,18 +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 - {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 + {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 diff --git a/VisEl/Test/App.config b/VisEl/Test/App.config deleted file mode 100644 index 56efbc7..0000000 --- a/VisEl/Test/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/VisEl/Test/Lab2.Designer.cs b/VisEl/Test/Lab2.Designer.cs deleted file mode 100644 index fcc7616..0000000 --- a/VisEl/Test/Lab2.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace Test -{ - partial class Lab2 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - 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 - } -} \ No newline at end of file diff --git a/VisEl/Test/Lab2.cs b/VisEl/Test/Lab2.cs deleted file mode 100644 index 9da8b84..0000000 --- a/VisEl/Test/Lab2.cs +++ /dev/null @@ -1,20 +0,0 @@ -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(); - } - } -} diff --git a/VisEl/Test/Program.cs b/VisEl/Test/Program.cs deleted file mode 100644 index 1ef7000..0000000 --- a/VisEl/Test/Program.cs +++ /dev/null @@ -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 - { - /// - /// Главная точка входа для приложения. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); - } - } -} diff --git a/VisEl/Test/Properties/AssemblyInfo.cs b/VisEl/Test/Properties/AssemblyInfo.cs deleted file mode 100644 index badfe69..0000000 --- a/VisEl/Test/Properties/AssemblyInfo.cs +++ /dev/null @@ -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")] diff --git a/VisEl/Test/Properties/Resources.Designer.cs b/VisEl/Test/Properties/Resources.Designer.cs deleted file mode 100644 index fd90ad5..0000000 --- a/VisEl/Test/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// Этот код создан программным средством. -// Версия среды выполнения: 4.0.30319.42000 -// -// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если -// код создан повторно. -// -//------------------------------------------------------------------------------ - -namespace Test.Properties -{ - - - /// - /// Класс ресурсов со строгим типом для поиска локализованных строк и пр. - /// - // Этот класс был автоматически создан при помощи 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() - { - } - - /// - /// Возврат кэшированного экземпляра ResourceManager, используемого этим классом. - /// - [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; - } - } - - /// - /// Переопределяет свойство CurrentUICulture текущего потока для всех - /// подстановки ресурсов с помощью этого класса ресурсов со строгим типом. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/VisEl/Test/Properties/Settings.Designer.cs b/VisEl/Test/Properties/Settings.Designer.cs deleted file mode 100644 index a8cf573..0000000 --- a/VisEl/Test/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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. -// -//------------------------------------------------------------------------------ - -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; - } - } - } -} diff --git a/VisEl/Test/Properties/Settings.settings b/VisEl/Test/Properties/Settings.settings deleted file mode 100644 index 3964565..0000000 --- a/VisEl/Test/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/VisEl/Test/Test.csproj b/VisEl/Test/Test.csproj deleted file mode 100644 index 04cfae6..0000000 --- a/VisEl/Test/Test.csproj +++ /dev/null @@ -1,99 +0,0 @@ - - - - - Debug - AnyCPU - {D173D582-D0AE-45DF-88FC-0DE0A8183E82} - WinExe - Test - Test - v4.7.2 - 512 - true - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - Form - - - Form1.cs - - - Form - - - Lab2.cs - - - - - - Form1.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - {471DE73A-592F-45F0-8249-9F6DD539682C} - VisEl - - - - - - - \ No newline at end of file diff --git a/VisEl/Test/Form1.Designer.cs b/VisEl/TestForm/Form1.Designer.cs similarity index 85% rename from VisEl/Test/Form1.Designer.cs rename to VisEl/TestForm/Form1.Designer.cs index acdfd5c..eec0b6b 100644 --- a/VisEl/Test/Form1.Designer.cs +++ b/VisEl/TestForm/Form1.Designer.cs @@ -1,4 +1,4 @@ -namespace Test +namespace TestForm { partial class Form1 { @@ -55,50 +55,52 @@ 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.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; @@ -106,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; @@ -116,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; @@ -126,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; @@ -143,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; @@ -153,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; @@ -170,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; @@ -181,25 +191,26 @@ // labelTitle // this.labelTitle.AutoSize = true; - this.labelTitle.Location = new System.Drawing.Point(394, 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; @@ -208,16 +219,18 @@ // comboBox1 // this.comboBox1.FormattingEnabled = true; - this.comboBox1.Location = new System.Drawing.Point(517, 432); + 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; // // 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; @@ -226,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; @@ -252,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; @@ -263,9 +279,9 @@ // 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 @@ -290,17 +306,17 @@ // this.labelChange.AutoSize = true; this.labelChange.ForeColor = System.Drawing.Color.Red; - this.labelChange.Location = new System.Drawing.Point(336, 128); + this.labelChange.Location = new System.Drawing.Point(336, 160); this.labelChange.Name = "labelChange"; - this.labelChange.Size = new System.Drawing.Size(0, 16); + 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, 419); + this.labelDateChange.Location = new System.Drawing.Point(22, 524); this.labelDateChange.Name = "labelDateChange"; - this.labelDateChange.Size = new System.Drawing.Size(0, 16); + this.labelDateChange.Size = new System.Drawing.Size(0, 20); this.labelDateChange.TabIndex = 28; // // myTreeView1 @@ -308,9 +324,10 @@ 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.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, 403); + this.myTreeView1.Size = new System.Drawing.Size(427, 503); this.myTreeView1.TabIndex = 17; // // newCheckList1 @@ -318,27 +335,29 @@ 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.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, 248); + 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, 286); + 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, 95); + 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); @@ -369,6 +388,7 @@ 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); @@ -380,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; @@ -396,7 +416,7 @@ 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; @@ -409,7 +429,7 @@ private System.Windows.Forms.ToolStripMenuItem lab2ToolStripMenuItem; private System.Windows.Forms.Label labelChange; private System.Windows.Forms.Label labelDateChange; - private VisEl.MyTextBoxDate myTextBoxDate; + private VisableComponents.MyTextBoxDate myTextBoxDate; } } diff --git a/VisEl/Test/Form1.cs b/VisEl/TestForm/Form1.cs similarity index 97% rename from VisEl/Test/Form1.cs rename to VisEl/TestForm/Form1.cs index dad6497..673b415 100644 --- a/VisEl/Test/Form1.cs +++ b/VisEl/TestForm/Form1.cs @@ -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 { @@ -38,7 +37,7 @@ namespace Test } private void CustomEvent_Handler(object sender, EventArgs e) { - labelChange.Text = "oп оп я поменялся"; + MessageBox.Show("Данные поменялись"); } private void CustomEvent_HandlerDate(object sender, EventArgs e) { diff --git a/VisEl/TestForm/Form1.resx b/VisEl/TestForm/Form1.resx new file mode 100644 index 0000000..938108a --- /dev/null +++ b/VisEl/TestForm/Form1.resx @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/VisEl/TestForm/Lab2.Designer.cs b/VisEl/TestForm/Lab2.Designer.cs new file mode 100644 index 0000000..513b310 --- /dev/null +++ b/VisEl/TestForm/Lab2.Designer.cs @@ -0,0 +1,197 @@ +namespace TestForm +{ + partial class Lab2 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/VisEl/TestForm/Lab2.cs b/VisEl/TestForm/Lab2.cs new file mode 100644 index 0000000..184219b --- /dev/null +++ b/VisEl/TestForm/Lab2.cs @@ -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 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 sportsmens = new List(); + public Lab2() + { + InitializeComponent(); + info = new ImageInfo(); + files = new List(); + } + + 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 ei = new ExcelInfo(); + ei.Title = title; + ei.Path = path; + ei.Dates = new List(); + Dictionary aloneFields = new Dictionary(); + 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); + } + } +} diff --git a/VisEl/TestForm/Lab2.resx b/VisEl/TestForm/Lab2.resx new file mode 100644 index 0000000..97ede61 --- /dev/null +++ b/VisEl/TestForm/Lab2.resx @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 206, 17 + + + 17, 17 + + + 343, 17 + + + 505, 17 + + + 636, 17 + + \ No newline at end of file diff --git a/VisEl/TestForm/Program.cs b/VisEl/TestForm/Program.cs new file mode 100644 index 0000000..85edeba --- /dev/null +++ b/VisEl/TestForm/Program.cs @@ -0,0 +1,17 @@ +namespace TestForm +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [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()); + } + } +} \ No newline at end of file diff --git a/VisEl/Test/TestClasses/Sportsmen.cs b/VisEl/TestForm/TestClasses/Sportsmen.cs similarity index 100% rename from VisEl/Test/TestClasses/Sportsmen.cs rename to VisEl/TestForm/TestClasses/Sportsmen.cs diff --git a/VisEl/TestForm/TestForm.csproj b/VisEl/TestForm/TestForm.csproj new file mode 100644 index 0000000..0d231fd --- /dev/null +++ b/VisEl/TestForm/TestForm.csproj @@ -0,0 +1,25 @@ + + + + WinExe + net6.0-windows + enable + true + enable + + + + + + + + + + Form + + + Form + + + + \ No newline at end of file diff --git a/VisEl/TestLib/Car.cs b/VisEl/TestLib/Car.cs deleted file mode 100644 index a476ba9..0000000 --- a/VisEl/TestLib/Car.cs +++ /dev/null @@ -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; - } - } -} diff --git a/VisEl/TestLib/Employer.cs b/VisEl/TestLib/Employer.cs deleted file mode 100644 index d869b7d..0000000 --- a/VisEl/TestLib/Employer.cs +++ /dev/null @@ -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; - } - } -} diff --git a/VisEl/TestLib/Sportsmen.cs b/VisEl/TestLib/Sportsmen.cs deleted file mode 100644 index a358b76..0000000 --- a/VisEl/TestLib/Sportsmen.cs +++ /dev/null @@ -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; - } - } -} diff --git a/VisEl/TestLib/TestLib.csproj b/VisEl/TestLib/TestLib.csproj deleted file mode 100644 index 132c02c..0000000 --- a/VisEl/TestLib/TestLib.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - net6.0 - enable - enable - - - diff --git a/VisEl/UnvisableComponents.zip b/VisEl/UnvisableComponents.zip new file mode 100644 index 0000000..6823950 Binary files /dev/null and b/VisEl/UnvisableComponents.zip differ diff --git a/VisEl/UnvisableComponents/ChartInfo.cs b/VisEl/UnvisableComponents/ChartInfo.cs new file mode 100644 index 0000000..9ac1217 --- /dev/null +++ b/VisEl/UnvisableComponents/ChartInfo.cs @@ -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() { } + } +} diff --git a/VisEl/UnvisualComponents/ImageExcel.cs b/VisEl/UnvisableComponents/DirectionLegend.cs similarity index 53% rename from VisEl/UnvisualComponents/ImageExcel.cs rename to VisEl/UnvisableComponents/DirectionLegend.cs index 563890c..4de7cc0 100644 --- a/VisEl/UnvisualComponents/ImageExcel.cs +++ b/VisEl/UnvisableComponents/DirectionLegend.cs @@ -4,9 +4,13 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace UnvisualComponents +namespace UnvisableComponents { - public class ImageExcel + public enum DirectionLegend { + Up, + Left, + Right, + Bottom, } } diff --git a/VisEl/UnvisableComponents/ExcelChart.Designer.cs b/VisEl/UnvisableComponents/ExcelChart.Designer.cs new file mode 100644 index 0000000..ac95eda --- /dev/null +++ b/VisEl/UnvisableComponents/ExcelChart.Designer.cs @@ -0,0 +1,36 @@ +namespace UnvisableComponents +{ + partial class ExcelChart + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/VisEl/UnvisableComponents/ExcelChart.cs b/VisEl/UnvisableComponents/ExcelChart.cs new file mode 100644 index 0000000..b4a2a55 --- /dev/null +++ b/VisEl/UnvisableComponents/ExcelChart.cs @@ -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 fields = new List(); + 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("забыли данные"); + + + } + } +} diff --git a/VisEl/UnvisableComponents/ExcelHead.Designer.cs b/VisEl/UnvisableComponents/ExcelHead.Designer.cs new file mode 100644 index 0000000..45a5117 --- /dev/null +++ b/VisEl/UnvisableComponents/ExcelHead.Designer.cs @@ -0,0 +1,36 @@ +namespace UnvisableComponents +{ + partial class ExcelHead + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/VisEl/UnvisableComponents/ExcelHead.cs b/VisEl/UnvisableComponents/ExcelHead.cs new file mode 100644 index 0000000..583b007 --- /dev/null +++ b/VisEl/UnvisableComponents/ExcelHead.cs @@ -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(ExcelInfo info) where T:class + { + ExcelPackage.LicenseContext = LicenseContext.NonCommercial; + Check(info); + List fields = new List(); + 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(ExcelInfo 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++; + } + } + } +} diff --git a/VisEl/UnvisableComponents/ExcelInfo.cs b/VisEl/UnvisableComponents/ExcelInfo.cs new file mode 100644 index 0000000..2d7f5db --- /dev/null +++ b/VisEl/UnvisableComponents/ExcelInfo.cs @@ -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 where T: class + { + private string path; + private string title; + private List dates; + private Dictionary, List)> fields = new Dictionary, List)>(); + public string Path { get { return path; } set { path = value; } } + public string Title { get { return title; } set { title = value; } } + public List Dates { get { return dates; } set { dates = value; } } + public Dictionary, List)> 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(), new List())); + fields[name].Item1.Add(field); + fields[name].Item2.Add(height); + } + } + public void addDictionaryAlone(string field, int height) + { + + fields.Add(field, (new List(), new List())); + fields[field].Item1.Add(field); + fields[field].Item2.Add(height); + + } + public ExcelInfo() { } + } +} diff --git a/VisEl/UnvisableComponents/ImageExcel.Designer.cs b/VisEl/UnvisableComponents/ImageExcel.Designer.cs new file mode 100644 index 0000000..d77ba9c --- /dev/null +++ b/VisEl/UnvisableComponents/ImageExcel.Designer.cs @@ -0,0 +1,36 @@ +namespace UnvisableComponents +{ + partial class ImageExcel + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/VisEl/UnvisableComponents/ImageExcel.cs b/VisEl/UnvisableComponents/ImageExcel.cs new file mode 100644 index 0000000..b18cef6 --- /dev/null +++ b/VisEl/UnvisableComponents/ImageExcel.cs @@ -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("забыли фото"); + + + } + } +} diff --git a/VisEl/UnvisableComponents/ImageInfo.cs b/VisEl/UnvisableComponents/ImageInfo.cs new file mode 100644 index 0000000..ab9c28e --- /dev/null +++ b/VisEl/UnvisableComponents/ImageInfo.cs @@ -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 files; + public string Path { get { return path; } set { path = value; } } + public string Title { get { return title; } set { title = value; } } + public List Files { get { return files; } set { files = value; } } + public ImageInfo() { } + } +} diff --git a/VisEl/UnvisableComponents/UnvisableComponents.csproj b/VisEl/UnvisableComponents/UnvisableComponents.csproj new file mode 100644 index 0000000..c1bcc13 --- /dev/null +++ b/VisEl/UnvisableComponents/UnvisableComponents.csproj @@ -0,0 +1,28 @@ + + + + net6.0-windows + enable + true + enable + + + + + + + + + + + + + + + + + Component + + + + diff --git a/VisEl/UnvisableComponents/appSettings.json b/VisEl/UnvisableComponents/appSettings.json new file mode 100644 index 0000000..da7c7c9 --- /dev/null +++ b/VisEl/UnvisableComponents/appSettings.json @@ -0,0 +1,9 @@ +{ + { + "EPPlus": { + "ExcelPackage": { + "LicenseContext": "NonCommercial" //The license context used + } + } + } +} \ No newline at end of file diff --git a/VisEl/UnvisualComponents/UnvisualComponents.csproj b/VisEl/UnvisualComponents/UnvisualComponents.csproj deleted file mode 100644 index 132c02c..0000000 --- a/VisEl/UnvisualComponents/UnvisualComponents.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - net6.0 - enable - enable - - - diff --git a/VisEl/VisableComponents/MyCheckList.Designer.cs b/VisEl/VisableComponents/MyCheckList.Designer.cs new file mode 100644 index 0000000..feedcd0 --- /dev/null +++ b/VisEl/VisableComponents/MyCheckList.Designer.cs @@ -0,0 +1,65 @@ +using System.Drawing; + +namespace VisableComponents +{ + partial class MyCheckList + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + 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; + } +} diff --git a/VisEl/VisableComponents/MyCheckList.cs b/VisEl/VisableComponents/MyCheckList.cs new file mode 100644 index 0000000..8c071e6 --- /dev/null +++ b/VisEl/VisableComponents/MyCheckList.cs @@ -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 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); + } + } +} diff --git a/VisEl/Test/Form1.resx b/VisEl/VisableComponents/MyCheckList.resx similarity index 96% rename from VisEl/Test/Form1.resx rename to VisEl/VisableComponents/MyCheckList.resx index d5494e3..1af7de1 100644 --- a/VisEl/Test/Form1.resx +++ b/VisEl/VisableComponents/MyCheckList.resx @@ -117,7 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 - \ No newline at end of file diff --git a/VisEl/VisableComponents/MyTextBoxDate.Designer.cs b/VisEl/VisableComponents/MyTextBoxDate.Designer.cs new file mode 100644 index 0000000..cfa788d --- /dev/null +++ b/VisEl/VisableComponents/MyTextBoxDate.Designer.cs @@ -0,0 +1,96 @@ +namespace VisableComponents +{ + partial class MyTextBoxDate + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + 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; + } +} diff --git a/VisEl/VisableComponents/MyTextBoxDate.cs b/VisEl/VisableComponents/MyTextBoxDate.cs new file mode 100644 index 0000000..52ded76 --- /dev/null +++ b/VisEl/VisableComponents/MyTextBoxDate.cs @@ -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); + } + } +} diff --git a/VisEl/Test/Properties/Resources.resx b/VisEl/VisableComponents/MyTextBoxDate.resx similarity index 90% rename from VisEl/Test/Properties/Resources.resx rename to VisEl/VisableComponents/MyTextBoxDate.resx index af7dbeb..1af7de1 100644 --- a/VisEl/Test/Properties/Resources.resx +++ b/VisEl/VisableComponents/MyTextBoxDate.resx @@ -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. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,9 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/VisEl/VisableComponents/MyTreeView.Designer.cs b/VisEl/VisableComponents/MyTreeView.Designer.cs new file mode 100644 index 0000000..1fb9ca5 --- /dev/null +++ b/VisEl/VisableComponents/MyTreeView.Designer.cs @@ -0,0 +1,59 @@ +namespace VisableComponents +{ + partial class MyTreeView + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + 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; + } +} diff --git a/VisEl/VisableComponents/MyTreeView.cs b/VisEl/VisableComponents/MyTreeView.cs new file mode 100644 index 0000000..535faf8 --- /dev/null +++ b/VisEl/VisableComponents/MyTreeView.cs @@ -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 hierarchy = new List(); + public MyTreeView() + { + InitializeComponent(); + } + public void addToHierarchy(List list) { hierarchy = list; } + public int GetId + { + get { + if(treeView.SelectedNode.FirstNode == null) + return treeView.SelectedNode.Index; + return -1; + } + + } + public object GetNode(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(List 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; + + + } + } + } + } +} diff --git a/VisEl/VisableComponents/MyTreeView.resx b/VisEl/VisableComponents/MyTreeView.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/VisEl/VisableComponents/MyTreeView.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/VisEl/VisableComponents/VisableComponents.csproj b/VisEl/VisableComponents/VisableComponents.csproj new file mode 100644 index 0000000..13138fe --- /dev/null +++ b/VisEl/VisableComponents/VisableComponents.csproj @@ -0,0 +1,22 @@ + + + + net6.0-windows + enable + true + enable + + + + + UserControl + + + UserControl + + + UserControl + + + + diff --git a/VisEl/WinFormsApp1/TestForm.csproj b/VisEl/WinFormsApp1/TestForm.csproj new file mode 100644 index 0000000..c70eb07 --- /dev/null +++ b/VisEl/WinFormsApp1/TestForm.csproj @@ -0,0 +1,24 @@ + + + + WinExe + net6.0-windows + enable + true + enable + + + + + + + + + Form + + + Form + + + + \ No newline at end of file