Compare commits

..

14 Commits
main ... Lab2

37 changed files with 3923 additions and 58 deletions

36
COP_25/Forms/Forms.csproj Normal file
View File

@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CreateVisualComponent" Version="1.0.0" />
<PackageReference Include="CustomComponentsTest" Version="1.0.0" />
<PackageReference Include="NotVisualComponent" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Controls\Controls.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -1,6 +0,0 @@
namespace Controls
{
public class Class1
{
}
}

View File

@ -1,10 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net6.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CreateVisualComponent" Version="1.0.0" />
<PackageReference Include="CustomComponentsTest" Version="1.0.0" />
<PackageReference Include="NotVisualComponent" Version="1.0.0" />
<PackageReference Include="PDFsharp-MigraDoc-GDI" Version="6.1.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="docs\" />
<Folder Include="NuGetTeam\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,56 @@
namespace Controls
{
partial class CustomComboBox
{
/// <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()
{
comboBoxMain = new ComboBox();
SuspendLayout();
//
// comboBoxMain
//
comboBoxMain.FormattingEnabled = true;
comboBoxMain.Location = new Point(18, 62);
comboBoxMain.Name = "comboBoxMain";
comboBoxMain.Size = new Size(230, 28);
comboBoxMain.TabIndex = 0;
//
// CustomComboBox
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(comboBoxMain);
Name = "CustomComboBox";
Size = new Size(262, 150);
ResumeLayout(false);
}
#endregion
private ComboBox comboBoxMain;
}
}

View File

@ -0,0 +1,95 @@
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 Controls
{
public partial class CustomComboBox : UserControl
{
/// <summary>
/// Конструктор
/// </summary>
public CustomComboBox()
{
InitializeComponent();
}
/// <summary>
/// Очищение списка
/// </summary>
public void ComboBoxClear()
{
comboBoxMain.Items.Clear();
comboBoxMain.SelectedItem = null;
}
/// <summary>
/// Выбранный элемент
/// </summary>
public string SelectedItem
{
get
{
if (comboBoxMain.Items.Count == 0)
{
return " ";
}
if (comboBoxMain.SelectedItem == null)
{
return " ";
}
return comboBoxMain.SelectedItem.ToString()!;
}
set
{
if (comboBoxMain.Items.Contains(value))
{
comboBoxMain.SelectedItem = value;
}
}
}
/// <summary>
/// Публичное свойство
/// </summary>
public ComboBox.ObjectCollection ComboBoxItems
{
get { return comboBoxMain.Items; }
}
/// <summary>
/// Событие, вызываемое при смене значения
/// </summary>
private EventHandler _onValueChangedEvent;
/// <summary>
/// Событие, вызываемое при смене значения
/// </summary>
public event EventHandler ValueChanged
{
add
{
_onValueChangedEvent += value;
}
remove
{
_onValueChangedEvent -= value;
}
}
/// <summary>
/// Смена значения
/// </summary>
private void CustomComboBox_SelectedValueChanged(object sender, EventArgs e)
{
_onValueChangedEvent?.Invoke(sender, e);
}
}
}

View File

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

View File

@ -0,0 +1,58 @@
namespace Controls
{
partial class CustomListBox
{
/// <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()
{
listBoxMain = new ListBox();
SuspendLayout();
//
// listBoxMain
//
listBoxMain.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
listBoxMain.FormattingEnabled = true;
listBoxMain.ItemHeight = 20;
listBoxMain.Location = new Point(3, 3);
listBoxMain.Name = "listBoxMain";
listBoxMain.Size = new Size(270, 184);
listBoxMain.TabIndex = 0;
//
// CustomListBox
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(listBoxMain);
Name = "CustomListBox";
Size = new Size(276, 212);
ResumeLayout(false);
}
#endregion
private ListBox listBoxMain;
}
}

View File

@ -0,0 +1,150 @@
using Controls.Exceptions;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Controls
{
public partial class CustomListBox : UserControl
{
/// <summary>
/// Конструктор по умолчанию
/// </summary>
public CustomListBox()
{
InitializeComponent();
}
private string template;
private string start;
private string end;
public void setTemplate(string _template, string _start, string _end)
{
if (string.IsNullOrEmpty(_template) || string.IsNullOrEmpty(_start) || string.IsNullOrEmpty(_end))
{
throw new ArgumentNullException("Wrong template");
}
template = _template;
start = _start;
end = _end;
}
public int SelectedRow
{
get
{
return listBoxMain.SelectedIndex;
}
set
{
if (value < 0) return;
listBoxMain.SelectedIndex = value;
}
}
public T GetObjectFromStr<T>() where T : class, new()
{
if (listBoxMain.SelectedIndex < 0)
{
return null;
}
string row = listBoxMain.SelectedItem.ToString();
T curObject = new T();
StringBuilder sb = new StringBuilder(row);
//MessageBox.Show(sb.ToString());
string[] words = template.Split(new[] { char.Parse(start), char.Parse(end) });
// Дорогой дневник, мне не подобрать слов чтобы описать всю {Mood}, что я испытал сегодня; {Date}
// Дорогой дневник, мне не подобрать слов чтобы описать всю радость, что я испытал сегодня; 01.01.01
StringBuilder myrow = new StringBuilder(row);
List<string> flexPartsTemplate = new();
foreach (string word in words)
{
if (row.Contains(word) && !string.IsNullOrEmpty(word))
{
myrow.Replace(word, end);
}
else
{
flexPartsTemplate.Add(word);
}
}
string[] flexParts = myrow.ToString().Split(end);
int i = 1;
StringBuilder result = new StringBuilder(template);
foreach (string word in flexPartsTemplate)
{
if (!string.IsNullOrEmpty(word))
{
result.Replace(word, flexParts[i]);
i++;
}
}
sb = result;
foreach (var property in typeof(T).GetProperties())
{
if (!property.CanWrite)
{
continue;
}
//MessageBox.Show(property.Name);
int startBorder = sb.ToString().IndexOf(start);
if (startBorder == -1)
{
break;
}
int endBorder = sb.ToString().IndexOf(end, startBorder + 1);
if (endBorder == -1)
{
break;
}
string propertyValue = sb.ToString(startBorder + 1, endBorder - startBorder - 1);
sb.Remove(0, endBorder + 1);
property.SetValue(curObject, Convert.ChangeType(propertyValue, property.PropertyType));
}
return curObject;
}
public void FillProperty<T>(T dataObject, int rowIndex, string propertyName)
{
while (listBoxMain.Items.Count <= rowIndex)
{
listBoxMain.Items.Add(template);
}
string row = listBoxMain.Items[rowIndex].ToString();
PropertyInfo propertyInfo = dataObject.GetType().GetProperty(propertyName);
if (propertyInfo != null)
{
var propertyValue = propertyInfo.GetValue(dataObject);
row = row.Replace($"{start}{propertyName}{end}", propertyValue.ToString());
listBoxMain.Items[rowIndex] = row;
}
}
public int CountRows()
{
return listBoxMain.Items.Count;
}
}
}

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,62 @@
namespace Controls
{
partial class CustomTextBoxNumber
{
/// <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();
textBoxNumber = new TextBox();
toolTipNumber = new ToolTip(components);
SuspendLayout();
//
// textBoxNumber
//
textBoxNumber.Location = new Point(25, 61);
textBoxNumber.Name = "textBoxNumber";
textBoxNumber.Size = new Size(213, 27);
textBoxNumber.TabIndex = 0;
toolTipNumber.SetToolTip(textBoxNumber, "+79378811555");
textBoxNumber.Click += textBox_Enter;
textBoxNumber.Text = "+79991144333";
//
// CustomNumberBox
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(textBoxNumber);
Name = "CustomNumberBox";
Size = new Size(264, 150);
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox textBoxNumber;
private ToolTip toolTipNumber;
}
}

View File

@ -0,0 +1,111 @@
using Controls.Exceptions;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Controls
{
public partial class CustomTextBoxNumber : UserControl
{
/// <summary>
/// Конструктор
/// </summary>
public CustomTextBoxNumber()
{
InitializeComponent();
}
/// <summary>
/// Шаблон вводимого значения
/// </summary>
private string? _numberPattern;
/// <summary>
/// Шаблон вводимого значения
/// </summary>
public string? NumPattern
{
get { return _numberPattern; }
set { _numberPattern = value; }
}
/// <summary>
/// Введенное значение
/// </summary>
public string? TextBoxNumber
{
get
{
if (NumPattern == null)
{
throw new CustomNumberException("Шаблон не заполнен!");
}
Regex regex = new Regex(NumPattern);
if (regex.IsMatch(textBoxNumber.Text))
{
return textBoxNumber.Text;
}
else
{
throw new CustomNumberException(textBoxNumber.Text + " не соответствует шаблону!");
}
}
set
{
Regex regex = new Regex(NumPattern!);
if (regex.IsMatch(value))
{
textBoxNumber.Text = value;
}
}
}
/// <summary>
/// Событие, вызываемое при смене значения
/// </summary>
private EventHandler _onValueChangedEvent;
/// <summary>
/// Событие, вызываемое при смене значения
/// </summary>
public event EventHandler ValueChanged
{
add
{
_onValueChangedEvent += value;
}
remove
{
_onValueChangedEvent -= value;
}
}
/// <summary>
/// Смена значения
/// </summary>
private void CustomNumberBox_NumberChanged(object sender, EventArgs e)
{
_onValueChangedEvent?.Invoke(sender, e);
}
/// <summary>
/// Выведение подсказки на экран
/// </summary>
private void textBox_Enter(object sender, EventArgs e)
{
int visibleTime = 2000;
ToolTip tooltip = new ToolTip();
tooltip.Show("+79991144333", textBoxNumber, 30, -20, visibleTime);
}
}
}

View File

@ -0,0 +1,123 @@
<?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>
<metadata name="toolTipNumber.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,36 @@
namespace Controls
{
partial class DiagramComponent
{
/// <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,98 @@
using PdfSharp.Charting;
using PdfSharp.Drawing;
using PdfSharp.Pdf;
using PdfSharp;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Controls.Models;
namespace Controls
{
public partial class DiagramComponent : Component
{
public DiagramComponent()
{
InitializeComponent();
}
public DiagramComponent(IContainer container)
{
container.Add(this);
InitializeComponent();
}
public void CreateLineDiagram(string docPath, string title, string header, Dictionary<string, List<Double>> data, LegendAlign legendAlign = LegendAlign.top)
{
if (string.IsNullOrEmpty(docPath))
{
throw new ArgumentNullException("Введите путь до файла!");
}
if (string.IsNullOrEmpty(title))
{
throw new ArgumentNullException("Введите заголовок");
}
if (string.IsNullOrEmpty(header))
{
throw new ArgumentNullException("Введите заголовок для диаграммы");
}
if (data.Count == 0)
{
throw new ArgumentException("Нету данных");
}
Chart chart = new Chart(ChartType.Line);
chart.Legend.Docking = (DockingType)legendAlign;
chart.Legend.LineFormat.Visible = true;
foreach (var item in data)
{
Series series = chart.SeriesCollection.AddSeries();
series.Name = item.Key;
double[] vals = new double[item.Value.Count];
for (int i = 0; i < item.Value.Count; i++)
{
vals.SetValue(Convert.ToDouble(item.Value[i]), i);
}
series.Add(vals);
}
chart.XAxis.MajorTickMark = TickMarkType.Outside;
chart.YAxis.MajorTickMark = TickMarkType.Outside;
chart.YAxis.HasMajorGridlines = true;
chart.PlotArea.LineFormat.Color = XColors.DarkGray;
chart.PlotArea.LineFormat.Width = 1;
chart.PlotArea.LineFormat.Visible = true;
chart.Legend.LineFormat.Visible = true;
ChartFrame chartFrame = new ChartFrame();
chartFrame.Location = new XPoint(50, 70);
chartFrame.Size = new XSize(500, 400);
chartFrame.Add(chart);
PdfDocument document = new PdfDocument(docPath);
PdfPage page = document.AddPage();
page.Size = PageSize.A4;
XGraphics gfx = XGraphics.FromPdfPage(page);
XFont font = new XFont("Times New Roman", 14);
gfx.DrawString(title, font, XBrushes.Black, new XRect(20, 20, page.Width, page.Height), XStringFormats.TopLeft);
gfx.DrawString(header, font, XBrushes.Black, new XRect(20, 40, page.Width, page.Height), XStringFormats.TopCenter);
chartFrame.Draw(gfx);
document.Close();
}
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Controls.Exceptions
{
public class CustomNumberException : Exception
{
/// <summary>
/// Конструктор по умолчанию
/// </summary>
public CustomNumberException() { }
/// <summary>
/// Конструктор с сообщением ошибки
/// </summary>
public CustomNumberException(string message) : base(message)
{
}
}
}

View File

@ -0,0 +1,36 @@
namespace Controls
{
partial class LargeTextComponent
{
/// <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,67 @@
using MigraDoc.DocumentObjectModel;
using MigraDoc.Rendering;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Controls
{
public partial class LargeTextComponent : Component
{
private Document? _document;
private Section? _section;
public LargeTextComponent()
{
InitializeComponent();
}
public LargeTextComponent(IContainer container)
{
container.Add(this);
InitializeComponent();
}
public void CreateDocument(string docPath, string title, string[] rows)
{
if (string.IsNullOrEmpty(docPath))
{
throw new ArgumentNullException("Введите путь до файла!");
}
if (string.IsNullOrEmpty(title))
{
throw new ArgumentNullException("Введите заголовок");
}
if (rows.Length <= 0)
{
throw new ArgumentNullException("Нету данных для сохранения");
}
_document = new Document();
var style = _document.Styles["Normal"];
style.Font.Name = "Times New Roman";
style.Font.Size = 14;
_section = _document.AddSection();
var paragraph = _section.AddParagraph(title);
paragraph.Format.SpaceAfter = "0.1cm";
paragraph.Format.Font.Bold = true;
foreach (var row in rows)
{
_section.AddParagraph(row);
}
var renderer = new PdfDocumentRenderer(true);
renderer.Document = _document;
renderer.RenderDocument();
renderer.PdfDocument.Save(docPath);
}
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Controls.Models
{
public class ColumnInfo
{
public string PropertyName;
public string Header;
public int Width;
public ColumnInfo(string propertyName, string header, int width)
{
PropertyName = propertyName;
Header = header;
Width = width;
}
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Controls.Models
{
public enum LegendAlign
{
top,
bottom,
left,
right
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Controls.Models
{
public class MergeCells
{
public string Header;
public int[] Indexes;
public MergeCells(string header, int[] indexes)
{
Header = header;
Indexes = indexes;
}
}
}

View File

@ -0,0 +1,36 @@
namespace Controls
{
partial class TableComponent
{
/// <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,138 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Controls.Models;
using MigraDoc.DocumentObjectModel;
using MigraDoc.Rendering;
namespace Controls
{
public partial class TableComponent : Component
{
private Document? _document;
private Section? _section;
public TableComponent()
{
InitializeComponent();
}
public TableComponent(IContainer container)
{
container.Add(this);
InitializeComponent();
}
public void CreateTable<T>(string docPath, string title, List<MergeCells>? mergeCells, List<ColumnInfo> colInfo, List<T> data) where T : class, new()
{
if (string.IsNullOrEmpty(docPath))
{
throw new ArgumentNullException("Введите путь до файла!");
}
if (string.IsNullOrEmpty(title))
{
throw new ArgumentNullException("Введите заголовок");
}
if (colInfo == null)
{
throw new ArgumentNullException("Введите все заголовки");
}
if (data == null)
{
throw new ArgumentNullException("Нету информации для вывода");
}
_document = new Document();
var style = _document.Styles["Normal"];
style.Font.Name = "Times New Roman";
style.Font.Size = 14;
_section = _document.AddSection();
var paragraph = _section.AddParagraph(title);
paragraph.Format.SpaceAfter = "0.3cm";
var table = _section.AddTable();
table.Borders.Visible = true;
for (int i = 0; i < colInfo.Count; i++)
{
table.AddColumn(colInfo[i].Width);
}
if (mergeCells != null)
{
table.AddRow();
}
var row = table.AddRow();
for (int i = 0; i < colInfo.Count; i++)
{
row[i].AddParagraph(colInfo[i].Header);
}
List<int> MergeColls = new List<int>();
if (mergeCells != null)
{
foreach (var cell in mergeCells)
{
MergeColls.AddRange(cell.Indexes[1..]);
table.Rows[cell.Indexes[0]].Cells[cell.Indexes[1] - 1].MergeRight = cell.Indexes[2..].Length;
table.Rows[cell.Indexes[0]].Cells[cell.Indexes[1] - 1].AddParagraph(cell.Header);
}
}
int cellsCount = table.Rows[1].Cells.Count;
if (MergeColls.Count != 0)
{
for (int i = 0; i < cellsCount; i++)
{
var cell = table.Rows[0].Cells[i];
if (!MergeColls.Contains(i + 1))
{
cell.MergeDown = 1;
cell.AddParagraph(colInfo[i].Header);
}
}
}
int rowData = 2;
foreach (var item in data)
{
var properties = item.GetType().GetProperties();
if (properties.Count() != cellsCount)
{
throw new Exception("Кол-во полей объекта не совпадает с кол-вом колонок");
}
for (int i = 0; i < properties.Count(); i++)
{
var property = properties[i];
var propValue = property.GetValue(item);
if (propValue == null) throw new Exception("Пустое поле");
if (property.Name == colInfo[i].PropertyName)
{
if (table.Rows.Count <= rowData) table.AddRow();
table.Rows[rowData].Cells[i].AddParagraph(propValue.ToString()!);
continue;
}
}
rowData++;
}
var renderer = new PdfDocumentRenderer(true);
renderer.Document = _document;
renderer.RenderDocument();
renderer.PdfDocument.Save(docPath);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,39 +0,0 @@
namespace Forms
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Form1";
}
#endregion
}
}

View File

@ -1,10 +0,0 @@
namespace Forms
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

143
Cop_25/Forms/FormMain.Designer.cs generated Normal file
View File

@ -0,0 +1,143 @@
namespace Forms
{
partial class FormMain
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
toolTip = new ToolTip(components);
largeTextComponent1 = new Controls.LargeTextComponent(components);
buttonLargeText = new Button();
tableComponent1 = new Controls.TableComponent(components);
button1 = new Button();
diagramComponent1 = new Controls.DiagramComponent(components);
button2 = new Button();
pictureBox1 = new PictureBox();
textBox1 = new TextBox();
customListBox1 = new Controls.CustomListBox();
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
SuspendLayout();
//
// toolTip
//
toolTip.ToolTipTitle = "AAAA";
//
// buttonLargeText
//
buttonLargeText.Location = new Point(28, 21);
buttonLargeText.Name = "buttonLargeText";
buttonLargeText.Size = new Size(310, 51);
buttonLargeText.TabIndex = 9;
buttonLargeText.Text = "СОЗДАТЬ PDF ТЕКСТ";
buttonLargeText.UseVisualStyleBackColor = true;
buttonLargeText.Click += buttonLargeText_CLick;
//
// button1
//
button1.Location = new Point(28, 94);
button1.Name = "button1";
button1.Size = new Size(310, 66);
button1.TabIndex = 10;
button1.Text = "СОЗДАТЬ ТАБЛИЦУ PDF";
button1.UseVisualStyleBackColor = true;
button1.Click += buttonCreateTable_Click;
//
// button2
//
button2.Location = new Point(28, 185);
button2.Name = "button2";
button2.Size = new Size(310, 72);
button2.TabIndex = 11;
button2.Text = "СОЗДАТЬ ДИАГРАММУ PDF";
button2.UseVisualStyleBackColor = true;
button2.Click += buttonDiagram_Click;
//
// pictureBox1
//
pictureBox1.BackgroundImage = (Image)resources.GetObject("pictureBox1.BackgroundImage");
pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
pictureBox1.Location = new Point(359, 21);
pictureBox1.Name = "pictureBox1";
pictureBox1.Size = new Size(364, 348);
pictureBox1.TabIndex = 12;
pictureBox1.TabStop = false;
//
// textBox1
//
textBox1.Location = new Point(371, 314);
textBox1.Name = "textBox1";
textBox1.Size = new Size(336, 27);
textBox1.TabIndex = 13;
textBox1.Text = "НАЖМИТЕ НА КНОПКУ ЧТОБЫ СОЗДАТЬ";
textBox1.TextAlign = HorizontalAlignment.Center;
textBox1.TextChanged += textBox1_TextChanged;
//
// customListBox1
//
customListBox1.Location = new Point(378, 43);
customListBox1.Name = "customListBox1";
customListBox1.SelectedRow = -1;
customListBox1.Size = new Size(608, 265);
customListBox1.TabIndex = 14;
//
// FormMain
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1123, 381);
Controls.Add(customListBox1);
Controls.Add(textBox1);
Controls.Add(button2);
Controls.Add(buttonLargeText);
Controls.Add(button1);
Controls.Add(pictureBox1);
Name = "FormMain";
Text = "FormMain";
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
ResumeLayout(false);
PerformLayout();
}
private void ButtonLargeText_Click(object sender, EventArgs e)
{
throw new NotImplementedException();
}
#endregion
private ToolTip toolTip;
private Controls.LargeTextComponent largeTextComponent1;
private Button buttonLargeText;
private Controls.TableComponent tableComponent1;
private Button button1;
private Controls.DiagramComponent diagramComponent1;
private Button button2;
private PictureBox pictureBox1;
private TextBox textBox1;
private Controls.CustomListBox customListBox1;
}
}

95
Cop_25/Forms/FormMain.cs Normal file
View File

@ -0,0 +1,95 @@
using Controls;
using Controls.Exceptions;
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 Controls.Models;
using MigraDoc.DocumentObjectModel;
namespace Forms
{
public partial class FormMain : Form
{
public FormMain()
{
InitializeComponent();
List<Person> people = new List<Person>()
{
new Person("aboba", "not aboba", "19"),
new Person("aboba2", "not aboba2", "25"),
new Person("aboba3", "not aboba3", "20"),
};
customListBox1.setTemplate("Дорогой дневниов чтобы описать всю {FirstName} {LastName} возраста {Age}", "{", "}");
customListBox1.FillProperty(people[0], 0, "FirstName");
customListBox1.FillProperty(people[0], 0, "LastName");
customListBox1.FillProperty(people[0], 0, "Age");
customListBox1.FillProperty(people[1], 1, "FirstName");
customListBox1.FillProperty(people[1], 1, "LastName");
customListBox1.FillProperty(people[1], 1, "Age");
customListBox1.FillProperty(people[2], 2, "FirstName");
customListBox1.FillProperty(people[2], 2, "LastName");
customListBox1.FillProperty(people[2], 2, "Age");
}
private void buttonLargeText_CLick(object sender, EventArgs e)
{
string[] strings = new string[] { "aboba",
"тут я пишу супер много текста( ну или не супер много ) для сдачи",
"best aboba",
"гружу сюда супер большой тексттттт" };
largeTextComponent1.CreateDocument("C:\\Ulstu\\COP\\Cop_25\\Controls\\docs\\text.pdf",
"OMEGA LABA 2", strings);
}
private void buttonCreateTable_Click(object sender, EventArgs e)
{
List<ColumnInfo> columnInfos = new List<ColumnInfo>()
{
new ColumnInfo("FirstName","Имя",50),
new ColumnInfo("LastName","Фамилия",100),
new ColumnInfo("Age","Возраст",75),
};
List<MergeCells> mergeCells = new List<MergeCells>()
{
new MergeCells("Данные", new int[] {0,2,2})
};
List<Person> people = new List<Person>()
{
new Person("aboba", "not aboba", "19"),
new Person("aboba2", "not aboba2", "25"),
new Person("aboba3", "not aboba3", "20"),
};
tableComponent1.CreateTable("C:\\Ulstu\\COP\\Cop_25\\Controls\\docs\\table.pdf",
"TABLE LUTI", mergeCells, columnInfos, people);
}
private void buttonDiagram_Click(object sender, EventArgs e)
{
Dictionary<string, List<Double>> data = new Dictionary<string, List<Double>>();
data.Add("aboba1", new List<double> { 12, 1, 2, 5, 2 });
data.Add("aboba2", new List<double> { 3, 2, 1, 3, 6 });
data.Add("aboba3", new List<double> { 7, 3, 1, 2, 5 });
diagramComponent1.CreateLineDiagram("C:\\Ulstu\\COP\\Cop_25\\Controls\\docs\\diagram.pdf",
"ZAGOLOVOK", "LINEYNAYA", data, LegendAlign.bottom);
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}

2136
Cop_25/Forms/FormMain.resx Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,10 +2,35 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net6.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CreateVisualComponent" Version="1.0.0" />
<PackageReference Include="CustomComponentsTest" Version="1.0.0" />
<PackageReference Include="NotVisualComponent" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Controls\Controls.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

22
Cop_25/Forms/Person.cs Normal file
View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Forms
{
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Age { get; set; }
public Person(string fn, string ln, string ag)
{
FirstName = fn;
LastName = ln;
Age = ag;
}
public Person() { }
}
}

View File

@ -11,7 +11,7 @@ namespace Forms
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(new FormMain());
}
}
}

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Forms.Properties {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
// с помощью такого средства, как ResGen или Visual Studio.
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
// с параметром /str или перестройте свой проект VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.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 (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Forms.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;
}
}
}
}