Compare commits
No commits in common. "lab2" and "main" have entirely different histories.
@ -3,9 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.7.34031.279
|
VisualStudioVersion = 17.7.34031.279
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinForms", "WinForms\WinForms.csproj", "{237F8689-B952-4E4B-AA51-71F3021838BF}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinForms", "WinForms\WinForms.csproj", "{237F8689-B952-4E4B-AA51-71F3021838BF}"
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualCompLib", "VisualCompLib\VisualCompLib.csproj", "{FC1CFC63-5739-4519-B689-E8B614A9D106}"
|
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -17,10 +15,6 @@ Global
|
|||||||
{237F8689-B952-4E4B-AA51-71F3021838BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{237F8689-B952-4E4B-AA51-71F3021838BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{237F8689-B952-4E4B-AA51-71F3021838BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{237F8689-B952-4E4B-AA51-71F3021838BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{237F8689-B952-4E4B-AA51-71F3021838BF}.Release|Any CPU.Build.0 = Release|Any CPU
|
{237F8689-B952-4E4B-AA51-71F3021838BF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{FC1CFC63-5739-4519-B689-E8B614A9D106}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{FC1CFC63-5739-4519-B689-E8B614A9D106}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{FC1CFC63-5739-4519-B689-E8B614A9D106}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{FC1CFC63-5739-4519-B689-E8B614A9D106}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
namespace VisualCompLib.Components.SupportClasses
|
|
||||||
{
|
|
||||||
public class BigTable<T>
|
|
||||||
{
|
|
||||||
public string FilePath = string.Empty;
|
|
||||||
|
|
||||||
public string DocumentTitle = string.Empty;
|
|
||||||
|
|
||||||
public List<ColumnDefinition> ColumnDefinitions;
|
|
||||||
public List<ColumnDefinition> ColumnDefinitions2;
|
|
||||||
|
|
||||||
public List<T> Data;
|
|
||||||
|
|
||||||
public List<int[]> MergedColumns;
|
|
||||||
public BigTable(string filePath, string documentTitle, List<ColumnDefinition> columnDefinitions, List<ColumnDefinition> columnDefinitions2, List<T> data, List<int[]> mergedColumns)
|
|
||||||
{
|
|
||||||
FilePath = filePath;
|
|
||||||
DocumentTitle = documentTitle;
|
|
||||||
ColumnDefinitions = columnDefinitions;
|
|
||||||
Data = data;
|
|
||||||
MergedColumns = mergedColumns;
|
|
||||||
ColumnDefinitions2 = columnDefinitions2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
namespace VisualCompLib.Components.SupportClasses
|
|
||||||
{
|
|
||||||
public class ColumnDefinition
|
|
||||||
{
|
|
||||||
public string Header;
|
|
||||||
public string PropertyName;
|
|
||||||
public double Weight;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
namespace VisualCompLib.Components.SupportClasses
|
|
||||||
{
|
|
||||||
public class DataLineChart
|
|
||||||
{
|
|
||||||
public string NameSeries { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public string[] NameData { get; set; }
|
|
||||||
|
|
||||||
public double[] Data { get; set; }
|
|
||||||
|
|
||||||
public DataLineChart(string nameSeries, string[] nameData, double[] data)
|
|
||||||
{
|
|
||||||
NameSeries = nameSeries;
|
|
||||||
NameData = nameData;
|
|
||||||
Data = data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
namespace VisualCompLib.Components.SupportClasses.Enums
|
|
||||||
{
|
|
||||||
public enum EnumAreaLegend
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
|
|
||||||
Left,
|
|
||||||
|
|
||||||
Top,
|
|
||||||
|
|
||||||
Right,
|
|
||||||
|
|
||||||
Bottom,
|
|
||||||
|
|
||||||
TopRight
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace VisualCompLib.Components.SupportClasses
|
|
||||||
{
|
|
||||||
public class LargeText
|
|
||||||
{
|
|
||||||
public string FilePath = string.Empty;
|
|
||||||
|
|
||||||
public string DocumentTitle = string.Empty;
|
|
||||||
|
|
||||||
public string[] TextData;
|
|
||||||
|
|
||||||
public LargeText(string filePath, string documentTitle, string[] textData)
|
|
||||||
{
|
|
||||||
FilePath = filePath;
|
|
||||||
DocumentTitle = documentTitle;
|
|
||||||
TextData = textData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
using VisualCompLib.Components.SupportClasses.Enums;
|
|
||||||
|
|
||||||
namespace VisualCompLib.Components.SupportClasses
|
|
||||||
{
|
|
||||||
public class SimpleLineChart
|
|
||||||
{
|
|
||||||
public string FilePath = string.Empty;
|
|
||||||
|
|
||||||
public string FileHeader = string.Empty;
|
|
||||||
|
|
||||||
public string LineChartName = string.Empty;
|
|
||||||
|
|
||||||
public EnumAreaLegend AreaLegend;
|
|
||||||
|
|
||||||
public List<DataLineChart> DataList = new();
|
|
||||||
|
|
||||||
public SimpleLineChart(string filePath, string fileHeader, string lineChartName, EnumAreaLegend areaLegend, List<DataLineChart> dataList)
|
|
||||||
{
|
|
||||||
FilePath = filePath;
|
|
||||||
FileHeader = fileHeader;
|
|
||||||
LineChartName = lineChartName;
|
|
||||||
AreaLegend = areaLegend;
|
|
||||||
DataList = dataList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
namespace VisualCompLib.Components
|
|
||||||
{
|
|
||||||
partial class WordLineChart
|
|
||||||
{
|
|
||||||
/// <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
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
using Aspose.Words;
|
|
||||||
using Aspose.Words.Drawing;
|
|
||||||
using Aspose.Words.Drawing.Charts;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using VisualCompLib.Components.SupportClasses;
|
|
||||||
|
|
||||||
namespace VisualCompLib.Components
|
|
||||||
{
|
|
||||||
public partial class WordLineChart : Component
|
|
||||||
{
|
|
||||||
public WordLineChart()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public WordLineChart(IContainer container)
|
|
||||||
{
|
|
||||||
container.Add(this);
|
|
||||||
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddLineChart(SimpleLineChart simpleLineChart)
|
|
||||||
{
|
|
||||||
if (!CheckData(simpleLineChart.DataList))
|
|
||||||
{
|
|
||||||
throw new Exception("Не данные заполнены");
|
|
||||||
}
|
|
||||||
Document doc = new Document();
|
|
||||||
DocumentBuilder builder = new DocumentBuilder(doc);
|
|
||||||
|
|
||||||
Aspose.Words.Font font = builder.Font;
|
|
||||||
font.Size = 24;
|
|
||||||
font.Bold = true;
|
|
||||||
font.Color = Color.Black;
|
|
||||||
font.Name = "Times New Roman";
|
|
||||||
|
|
||||||
ParagraphFormat paragraphFormat = builder.ParagraphFormat;
|
|
||||||
paragraphFormat.FirstLineIndent = 8;
|
|
||||||
paragraphFormat.SpaceAfter = 24;
|
|
||||||
paragraphFormat.Alignment = ParagraphAlignment.Center;
|
|
||||||
paragraphFormat.KeepTogether = true;
|
|
||||||
|
|
||||||
builder.Writeln(simpleLineChart.FileHeader);
|
|
||||||
|
|
||||||
Shape shape = builder.InsertChart(ChartType.Line, 500, 270);
|
|
||||||
|
|
||||||
Chart chart = shape.Chart;
|
|
||||||
|
|
||||||
chart.Title.Text = simpleLineChart.LineChartName;
|
|
||||||
|
|
||||||
ChartSeriesCollection seriesColl = chart.Series;
|
|
||||||
|
|
||||||
Console.WriteLine(seriesColl.Count);
|
|
||||||
|
|
||||||
seriesColl.Clear();
|
|
||||||
|
|
||||||
foreach (var data in simpleLineChart.DataList)
|
|
||||||
{
|
|
||||||
seriesColl.Add(data.NameSeries, data.NameData, data.Data );
|
|
||||||
}
|
|
||||||
|
|
||||||
ChartLegend legend = chart.Legend;
|
|
||||||
|
|
||||||
legend.Position = (LegendPosition)simpleLineChart.AreaLegend;
|
|
||||||
|
|
||||||
legend.Overlay = true;
|
|
||||||
|
|
||||||
doc.Save(simpleLineChart.FilePath);
|
|
||||||
}
|
|
||||||
static bool CheckData(List<DataLineChart> data)
|
|
||||||
{
|
|
||||||
foreach (var _data in data)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(_data.NameSeries) || string.IsNullOrEmpty(_data.NameData.ToString()) || string.IsNullOrEmpty(_data.Data.ToString()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
36
COP/VisualCompLib/Components/WordTable.Designer.cs
generated
36
COP/VisualCompLib/Components/WordTable.Designer.cs
generated
@ -1,36 +0,0 @@
|
|||||||
namespace VisualCompLib.Components
|
|
||||||
{
|
|
||||||
partial class WordTable
|
|
||||||
{
|
|
||||||
/// <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
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,128 +0,0 @@
|
|||||||
using System.ComponentModel;
|
|
||||||
using VisualCompLib.Components.SupportClasses;
|
|
||||||
using Aspose.Words;
|
|
||||||
using Aspose.Words.Tables;
|
|
||||||
|
|
||||||
namespace VisualCompLib.Components
|
|
||||||
{
|
|
||||||
public partial class WordTable : Component
|
|
||||||
{
|
|
||||||
public WordTable()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public WordTable(IContainer container)
|
|
||||||
{
|
|
||||||
container.Add(this);
|
|
||||||
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CreateTable<T>(BigTable<T> bigTable)
|
|
||||||
{
|
|
||||||
if (bigTable.Data == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Не заданы все данные");
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var columnDefinition in bigTable.ColumnDefinitions)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(columnDefinition.PropertyName))
|
|
||||||
{
|
|
||||||
throw new ArgumentException($"Не задано свойство столбца: {columnDefinition.Header}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Document document = new Document();
|
|
||||||
DocumentBuilder builder = new DocumentBuilder(document);
|
|
||||||
|
|
||||||
Style titleStyle = builder.Document.Styles.Add(StyleType.Paragraph, "Title");
|
|
||||||
titleStyle.Font.Size = 16;
|
|
||||||
titleStyle.Font.Bold = true;
|
|
||||||
|
|
||||||
builder.ParagraphFormat.Style = titleStyle;
|
|
||||||
builder.Writeln(bigTable.DocumentTitle);
|
|
||||||
|
|
||||||
Table table = builder.StartTable();
|
|
||||||
|
|
||||||
|
|
||||||
foreach (var columnDefinition in bigTable.ColumnDefinitions)
|
|
||||||
{
|
|
||||||
builder.InsertCell();
|
|
||||||
builder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(columnDefinition.Weight);
|
|
||||||
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
|
|
||||||
builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;
|
|
||||||
builder.Write(columnDefinition.Header);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var mergedColumn in bigTable.MergedColumns)
|
|
||||||
{
|
|
||||||
int startCellIndex = mergedColumn[0];
|
|
||||||
int endCellIndex = mergedColumn[mergedColumn.Length - 1];
|
|
||||||
|
|
||||||
for (int i = startCellIndex; i <= endCellIndex; i++)
|
|
||||||
{
|
|
||||||
table.Rows[0].Cells[i].CellFormat.HorizontalMerge = CellMerge.First;
|
|
||||||
table.Rows[0].Cells[i].CellFormat.VerticalMerge = CellMerge.First;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = startCellIndex + 1; i <= endCellIndex; i++)
|
|
||||||
{
|
|
||||||
table.Rows[0].Cells[i].CellFormat.HorizontalMerge = CellMerge.Previous;
|
|
||||||
table.Rows[0].Cells[i].CellFormat.VerticalMerge = CellMerge.First;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
builder.EndRow();
|
|
||||||
|
|
||||||
foreach (var columnDefinition2 in bigTable.ColumnDefinitions2)
|
|
||||||
{
|
|
||||||
builder.InsertCell();
|
|
||||||
builder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(columnDefinition2.Weight);
|
|
||||||
builder.Write(columnDefinition2.Header);
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.EndRow();
|
|
||||||
|
|
||||||
int columnIndex;
|
|
||||||
foreach (var columnDefinition in bigTable.ColumnDefinitions)
|
|
||||||
{
|
|
||||||
string currentPropertyName = columnDefinition.PropertyName;
|
|
||||||
columnIndex = 0;
|
|
||||||
foreach (var columnDefinition2 in bigTable.ColumnDefinitions2)
|
|
||||||
{
|
|
||||||
string currentPropertyName1 = columnDefinition2.PropertyName;
|
|
||||||
|
|
||||||
if (currentPropertyName == currentPropertyName1)
|
|
||||||
{
|
|
||||||
table.Rows[0].Cells[columnIndex].CellFormat.VerticalMerge = CellMerge.First;
|
|
||||||
table.Rows[1].Cells[columnIndex].CellFormat.VerticalMerge = CellMerge.Previous;
|
|
||||||
|
|
||||||
}
|
|
||||||
columnIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var item in bigTable.Data)
|
|
||||||
{
|
|
||||||
foreach (var columnDefinition2 in bigTable.ColumnDefinitions2)
|
|
||||||
{
|
|
||||||
builder.InsertCell();
|
|
||||||
var propertyValue = item.GetType()
|
|
||||||
.GetProperty(columnDefinition2.PropertyName)?
|
|
||||||
.GetValue(item)?.ToString();
|
|
||||||
|
|
||||||
builder.Write(propertyValue ?? "");
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.EndRow();
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.EndTable();
|
|
||||||
|
|
||||||
document.Save(bigTable.FilePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
36
COP/VisualCompLib/Components/WordText.Designer.cs
generated
36
COP/VisualCompLib/Components/WordText.Designer.cs
generated
@ -1,36 +0,0 @@
|
|||||||
namespace VisualCompLib.Components
|
|
||||||
{
|
|
||||||
partial class WordText
|
|
||||||
{
|
|
||||||
/// <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
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,133 +0,0 @@
|
|||||||
using DocumentFormat.OpenXml.Packaging;
|
|
||||||
using DocumentFormat.OpenXml.Wordprocessing;
|
|
||||||
using DocumentFormat.OpenXml;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using VisualCompLib.Components.SupportClasses;
|
|
||||||
|
|
||||||
namespace VisualCompLib.Components
|
|
||||||
{
|
|
||||||
public partial class WordText : Component
|
|
||||||
{
|
|
||||||
private WordprocessingDocument? _wordDocument;
|
|
||||||
|
|
||||||
private Body? _docBody;
|
|
||||||
public WordText()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public WordText(IContainer container)
|
|
||||||
{
|
|
||||||
container.Add(this);
|
|
||||||
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CreateWordText(LargeText largeText)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(largeText.FilePath) || string.IsNullOrEmpty(largeText.DocumentTitle) || !CheckData(largeText.TextData))
|
|
||||||
{
|
|
||||||
throw new Exception("Не все данные заполнены");
|
|
||||||
}
|
|
||||||
_wordDocument = WordprocessingDocument.Create(largeText.FilePath, WordprocessingDocumentType.Document);
|
|
||||||
|
|
||||||
//вытаскиваем главную часть из вордовского документа
|
|
||||||
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
|
||||||
|
|
||||||
mainPart.Document = new Document();
|
|
||||||
|
|
||||||
//генерируем тело основной части документа
|
|
||||||
_docBody = mainPart.Document.AppendChild(new Body());
|
|
||||||
|
|
||||||
_wordDocument.Close();
|
|
||||||
|
|
||||||
AddText(largeText);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddText(LargeText largeText)
|
|
||||||
{
|
|
||||||
using (var document = WordprocessingDocument.Open(largeText.FilePath, true))
|
|
||||||
{
|
|
||||||
var doc = document.MainDocumentPart.Document;
|
|
||||||
|
|
||||||
#region Создание заголовка
|
|
||||||
|
|
||||||
ParagraphProperties paragraphProperties = new();
|
|
||||||
|
|
||||||
paragraphProperties.AppendChild(new Justification
|
|
||||||
{
|
|
||||||
Val = JustificationValues.Center
|
|
||||||
});
|
|
||||||
|
|
||||||
paragraphProperties.AppendChild(new Indentation());
|
|
||||||
|
|
||||||
Paragraph header = new();
|
|
||||||
|
|
||||||
header.AppendChild(paragraphProperties);
|
|
||||||
|
|
||||||
var docRun = new Run();
|
|
||||||
|
|
||||||
var properties = new RunProperties();
|
|
||||||
|
|
||||||
properties.AppendChild(new FontSize
|
|
||||||
{
|
|
||||||
Val = "48"
|
|
||||||
});
|
|
||||||
|
|
||||||
properties.AppendChild(new Bold());
|
|
||||||
|
|
||||||
docRun.AppendChild(properties);
|
|
||||||
|
|
||||||
docRun.AppendChild(new Text(largeText.DocumentTitle));
|
|
||||||
|
|
||||||
header.AppendChild(docRun);
|
|
||||||
doc.Body.Append(header);
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Создание текста
|
|
||||||
for (int i = 0; i < largeText.TextData.Length; i++)
|
|
||||||
{
|
|
||||||
ParagraphProperties paragraphProperties2 = new();
|
|
||||||
|
|
||||||
paragraphProperties2.AppendChild(new Justification
|
|
||||||
{
|
|
||||||
Val = JustificationValues.Both
|
|
||||||
});
|
|
||||||
|
|
||||||
paragraphProperties2.AppendChild(new Indentation());
|
|
||||||
|
|
||||||
Paragraph text = new();
|
|
||||||
|
|
||||||
text.AppendChild(paragraphProperties2);
|
|
||||||
|
|
||||||
var docRun2 = new Run();
|
|
||||||
|
|
||||||
var properties2 = new RunProperties();
|
|
||||||
|
|
||||||
properties2.AppendChild(new FontSize
|
|
||||||
{
|
|
||||||
Val = "24"
|
|
||||||
});
|
|
||||||
|
|
||||||
docRun2.AppendChild(properties2);
|
|
||||||
docRun2.AppendChild(new Text(largeText.TextData[i]));
|
|
||||||
|
|
||||||
text.AppendChild(docRun2);
|
|
||||||
doc.Body.Append(text);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
doc.Save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CheckData(string[] data)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < data.Length; i++)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(data[i])) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
59
COP/VisualCompLib/MyDropDownList.Designer.cs
generated
59
COP/VisualCompLib/MyDropDownList.Designer.cs
generated
@ -1,59 +0,0 @@
|
|||||||
namespace VisualCompLib
|
|
||||||
{
|
|
||||||
partial class MyDropDownList
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Обязательная переменная конструктора.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Освободить все используемые ресурсы.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Код, автоматически созданный конструктором компонентов
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
|
||||||
/// содержимое этого метода с помощью редактора кода.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.dropDownList = new System.Windows.Forms.ComboBox();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// dropDownList
|
|
||||||
//
|
|
||||||
this.dropDownList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
||||||
this.dropDownList.FormattingEnabled = true;
|
|
||||||
this.dropDownList.Location = new System.Drawing.Point(3, 3);
|
|
||||||
this.dropDownList.Name = "dropDownList";
|
|
||||||
this.dropDownList.Size = new System.Drawing.Size(187, 24);
|
|
||||||
this.dropDownList.TabIndex = 0;
|
|
||||||
this.dropDownList.SelectedValueChanged += new System.EventHandler(this.comboBox_SelectedValueChanged);
|
|
||||||
//
|
|
||||||
// MyDropDownList
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.Controls.Add(this.dropDownList);
|
|
||||||
this.Name = "MyDropDownList";
|
|
||||||
this.Size = new System.Drawing.Size(193, 30);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private System.Windows.Forms.ComboBox dropDownList;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace VisualCompLib
|
|
||||||
{
|
|
||||||
public partial class MyDropDownList: UserControl
|
|
||||||
{
|
|
||||||
public MyDropDownList()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadValues(List<string> Values)
|
|
||||||
{
|
|
||||||
if (Values.Count == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
dropDownList.Items.AddRange(Values.ToArray());
|
|
||||||
}
|
|
||||||
public void Clear()
|
|
||||||
{
|
|
||||||
dropDownList.Items.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string SelectedValue
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (dropDownList.Items.Count == 0)
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if (dropDownList.SelectedItem == null)
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return dropDownList.SelectedItem.ToString();
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (dropDownList.Items.Contains(value))
|
|
||||||
{
|
|
||||||
dropDownList.SelectedItem = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private EventHandler onValueChanged;
|
|
||||||
public event EventHandler ValueChanged
|
|
||||||
{
|
|
||||||
add
|
|
||||||
{
|
|
||||||
onValueChanged += value;
|
|
||||||
}
|
|
||||||
remove
|
|
||||||
{
|
|
||||||
onValueChanged -= value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void comboBox_SelectedValueChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
onValueChanged?.Invoke(sender, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
59
COP/VisualCompLib/MyEmailTextBox.Designer.cs
generated
59
COP/VisualCompLib/MyEmailTextBox.Designer.cs
generated
@ -1,59 +0,0 @@
|
|||||||
namespace VisualCompLib
|
|
||||||
{
|
|
||||||
partial class MyEmailTextBox
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Обязательная переменная конструктора.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Освободить все используемые ресурсы.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Код, автоматически созданный конструктором компонентов
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
|
||||||
/// содержимое этого метода с помощью редактора кода.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.emailTextBox = new System.Windows.Forms.TextBox();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// emailTextBox
|
|
||||||
//
|
|
||||||
this.emailTextBox.Location = new System.Drawing.Point(3, 3);
|
|
||||||
this.emailTextBox.Name = "emailTextBox";
|
|
||||||
this.emailTextBox.Size = new System.Drawing.Size(170, 22);
|
|
||||||
this.emailTextBox.TabIndex = 0;
|
|
||||||
this.emailTextBox.TextChanged += new System.EventHandler(this.textBox_TextChanged);
|
|
||||||
this.emailTextBox.Enter += new System.EventHandler(this.textBox_Enter);
|
|
||||||
//
|
|
||||||
// MyEmailTextBox
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.Controls.Add(this.emailTextBox);
|
|
||||||
this.Name = "MyEmailTextBox";
|
|
||||||
this.Size = new System.Drawing.Size(177, 30);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private System.Windows.Forms.TextBox emailTextBox;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,93 +0,0 @@
|
|||||||
using System;
|
|
||||||
using ToolTip = System.Windows.Forms.ToolTip;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Drawing;
|
|
||||||
|
|
||||||
namespace VisualCompLib
|
|
||||||
{
|
|
||||||
public partial class MyEmailTextBox : UserControl
|
|
||||||
{
|
|
||||||
//Шаблон для textbox
|
|
||||||
private string pattern;
|
|
||||||
//Пример ввода
|
|
||||||
private string example = "ti@gmail.com";
|
|
||||||
public MyEmailTextBox()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
public string Pattern
|
|
||||||
{
|
|
||||||
get { return pattern; }
|
|
||||||
set { pattern = value; }
|
|
||||||
}
|
|
||||||
public string TextBoxValue
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
Regex rg = new Regex(Pattern);
|
|
||||||
bool address = rg.IsMatch(emailTextBox.Text);
|
|
||||||
if (address)
|
|
||||||
{
|
|
||||||
return emailTextBox.Text;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Error = "Некорректный ввод";
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
Regex rg = new Regex(Pattern);
|
|
||||||
bool address = rg.IsMatch(value);
|
|
||||||
if (address)
|
|
||||||
{
|
|
||||||
emailTextBox.Text = value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Error = "Некорректный ввод";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public string Error
|
|
||||||
{
|
|
||||||
get; private set;
|
|
||||||
}
|
|
||||||
public void setExample(string str)
|
|
||||||
{
|
|
||||||
Regex rg = new Regex(Pattern);
|
|
||||||
bool address = rg.IsMatch(str);
|
|
||||||
if (address)
|
|
||||||
{
|
|
||||||
example = str;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
private void textBox_Enter(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
int VisibleTime = 2000; //ms
|
|
||||||
ToolTip tooltip = new ToolTip();
|
|
||||||
tooltip.Show(example, emailTextBox, 30, -20, VisibleTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
private EventHandler onValueChanged;
|
|
||||||
public event EventHandler ValueChanged
|
|
||||||
{
|
|
||||||
add
|
|
||||||
{
|
|
||||||
onValueChanged += value;
|
|
||||||
}
|
|
||||||
remove
|
|
||||||
{
|
|
||||||
onValueChanged -= value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void textBox_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
onValueChanged?.Invoke(sender, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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>
|
|
59
COP/VisualCompLib/MyListBoxObjects.Designer.cs
generated
59
COP/VisualCompLib/MyListBoxObjects.Designer.cs
generated
@ -1,59 +0,0 @@
|
|||||||
namespace VisualCompLib
|
|
||||||
{
|
|
||||||
partial class MyListBoxObjects
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Обязательная переменная конструктора.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Освободить все используемые ресурсы.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Код, автоматически созданный конструктором компонентов
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
|
||||||
/// содержимое этого метода с помощью редактора кода.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.listBoxObj = new System.Windows.Forms.ListBox();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// listBoxObj
|
|
||||||
//
|
|
||||||
this.listBoxObj.FormattingEnabled = true;
|
|
||||||
this.listBoxObj.HorizontalScrollbar = true;
|
|
||||||
this.listBoxObj.ItemHeight = 16;
|
|
||||||
this.listBoxObj.Location = new System.Drawing.Point(3, 3);
|
|
||||||
this.listBoxObj.Name = "listBoxObj";
|
|
||||||
this.listBoxObj.Size = new System.Drawing.Size(353, 116);
|
|
||||||
this.listBoxObj.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// MyListBoxObjects
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.Controls.Add(this.listBoxObj);
|
|
||||||
this.Name = "MyListBoxObjects";
|
|
||||||
this.Size = new System.Drawing.Size(359, 133);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private System.Windows.Forms.ListBox listBoxObj;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,104 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace VisualCompLib
|
|
||||||
{
|
|
||||||
public partial class MyListBoxObjects : UserControl
|
|
||||||
{
|
|
||||||
//Макетная строка
|
|
||||||
private string layoutString;
|
|
||||||
//начальный символ для обнаружения свойств/полей
|
|
||||||
private string startSymbol;
|
|
||||||
//конечный символ для обнаружения свойств/полей
|
|
||||||
private string endSymbol;
|
|
||||||
public MyListBoxObjects()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
//Метод для установки информации о макетной строке и символах (начального и конечного)
|
|
||||||
public void SetLayoutInfo(string layout, string startS, string endS)
|
|
||||||
{
|
|
||||||
if (layout == null || startS == null || endS == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
layoutString = layout;
|
|
||||||
startSymbol = startS;
|
|
||||||
endSymbol = endS;
|
|
||||||
}
|
|
||||||
|
|
||||||
//свойство для получения и заполнения индекса выбранного элемента
|
|
||||||
public int SelectedIndex
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (listBoxObj.SelectedIndex == -1)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return listBoxObj.SelectedIndex;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (listBoxObj.SelectedItems.Count != 0)
|
|
||||||
{
|
|
||||||
listBoxObj.SelectedIndex = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Публичный параметризованный метод для получения объекта из выбранной строки(создать объект и через рефлексию заполнить свойства его).
|
|
||||||
public T GetObjectFromStr<T>() where T : class, new()
|
|
||||||
{
|
|
||||||
string selStr = "";
|
|
||||||
if (listBoxObj.SelectedIndex != -1)
|
|
||||||
{
|
|
||||||
selStr = listBoxObj.SelectedItem.ToString();
|
|
||||||
}
|
|
||||||
T curObject = new T();
|
|
||||||
foreach (var pr in typeof(T).GetProperties())
|
|
||||||
{
|
|
||||||
if (!pr.CanWrite)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int borderOne = selStr.IndexOf(startSymbol);
|
|
||||||
StringBuilder sb = new StringBuilder(selStr);
|
|
||||||
sb[borderOne] = 'z';
|
|
||||||
selStr = sb.ToString();
|
|
||||||
int borderTwo = selStr.IndexOf(endSymbol);
|
|
||||||
if (borderOne == -1 || borderTwo == -1) break;
|
|
||||||
string propertyValue = selStr.Substring(borderOne + 1, borderTwo - borderOne - 1);
|
|
||||||
selStr = selStr.Substring(borderTwo + 1);
|
|
||||||
pr.SetValue(curObject, Convert.ChangeType(propertyValue, pr.PropertyType));
|
|
||||||
}
|
|
||||||
return curObject;
|
|
||||||
}
|
|
||||||
//параметризованный метод, у которого в передаваемых параметрах идет список объектов некого класса и через этот список идет заполнение ListBox;
|
|
||||||
public void AddInListBox<T>(List<T> objects)
|
|
||||||
{
|
|
||||||
if (layoutString == null || startSymbol == null || endSymbol == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("заполните информацию о макетной строке");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!layoutString.Contains(startSymbol) || !layoutString.Contains(endSymbol))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Макетная строка не содержит нужные элементы");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
foreach (var item in objects)
|
|
||||||
{
|
|
||||||
string str = layoutString;
|
|
||||||
foreach (var prop in item.GetType().GetProperties())
|
|
||||||
{
|
|
||||||
string str1 = $"{startSymbol}" + $"{prop.Name}" + $"{endSymbol}";
|
|
||||||
str = str.Replace(str1, $"{startSymbol}" + prop.GetValue(item).ToString() + $"{endSymbol}");
|
|
||||||
}
|
|
||||||
listBoxObj.Items.Add(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,27 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace VisualCompLib.Object
|
|
||||||
{
|
|
||||||
public class Student
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
public string Group { get; set; }
|
|
||||||
public string Faculty { get; set; }
|
|
||||||
public int Course { get; set; }
|
|
||||||
|
|
||||||
public Student(string name, string group, string faculty, int course)
|
|
||||||
{
|
|
||||||
Name = name;
|
|
||||||
Group = group;
|
|
||||||
Faculty = faculty;
|
|
||||||
Course = course;
|
|
||||||
}
|
|
||||||
public Student()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Aspose.Words" Version="23.10.0" />
|
|
||||||
<PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
|
|
||||||
<PackageReference Include="FreeSpire.Doc" Version="11.6.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Update="MyDropDownList.cs">
|
|
||||||
<SubType>UserControl</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="MyEmailTextBox.cs">
|
|
||||||
<SubType>UserControl</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="MyListBoxObjects.cs">
|
|
||||||
<SubType>UserControl</SubType>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
39
COP/WinForms/Form1.Designer.cs
generated
Normal file
39
COP/WinForms/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace WinForms
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
10
COP/WinForms/Form1.cs
Normal file
10
COP/WinForms/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace WinForms
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
231
COP/WinForms/FormForComponents.Designer.cs
generated
231
COP/WinForms/FormForComponents.Designer.cs
generated
@ -1,231 +0,0 @@
|
|||||||
namespace WinForms
|
|
||||||
{
|
|
||||||
partial class FormForComponents
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
dropDownList = new VisualCompLib.MyDropDownList();
|
|
||||||
buttonAdd = new Button();
|
|
||||||
buttonInfo = new Button();
|
|
||||||
labelInfo = new Label();
|
|
||||||
buttonClear = new Button();
|
|
||||||
emailTextBox = new VisualCompLib.MyEmailTextBox();
|
|
||||||
labelShow = new Label();
|
|
||||||
buttonShow = new Button();
|
|
||||||
buttonSetExample = new Button();
|
|
||||||
labelExample = new Label();
|
|
||||||
textBoxExample = new TextBox();
|
|
||||||
listBoxObj = new VisualCompLib.MyListBoxObjects();
|
|
||||||
buttonAddObjects = new Button();
|
|
||||||
buttonShowItem = new Button();
|
|
||||||
labelShowInput = new Label();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// dropDownList
|
|
||||||
//
|
|
||||||
dropDownList.Location = new Point(3, 3);
|
|
||||||
dropDownList.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
dropDownList.Name = "dropDownList";
|
|
||||||
dropDownList.SelectedValue = "";
|
|
||||||
dropDownList.Size = new Size(196, 36);
|
|
||||||
dropDownList.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
buttonAdd.Location = new Point(3, 46);
|
|
||||||
buttonAdd.Name = "buttonAdd";
|
|
||||||
buttonAdd.Size = new Size(92, 29);
|
|
||||||
buttonAdd.TabIndex = 1;
|
|
||||||
buttonAdd.Text = "добавить";
|
|
||||||
buttonAdd.UseVisualStyleBackColor = true;
|
|
||||||
buttonAdd.Click += buttonAdd_Click;
|
|
||||||
//
|
|
||||||
// buttonInfo
|
|
||||||
//
|
|
||||||
buttonInfo.Location = new Point(211, 46);
|
|
||||||
buttonInfo.Name = "buttonInfo";
|
|
||||||
buttonInfo.Size = new Size(94, 29);
|
|
||||||
buttonInfo.TabIndex = 2;
|
|
||||||
buttonInfo.Text = "показать";
|
|
||||||
buttonInfo.UseVisualStyleBackColor = true;
|
|
||||||
buttonInfo.Click += buttonInfo_Click;
|
|
||||||
//
|
|
||||||
// labelInfo
|
|
||||||
//
|
|
||||||
labelInfo.AutoSize = true;
|
|
||||||
labelInfo.Location = new Point(205, 9);
|
|
||||||
labelInfo.Name = "labelInfo";
|
|
||||||
labelInfo.Size = new Size(154, 20);
|
|
||||||
labelInfo.TabIndex = 3;
|
|
||||||
labelInfo.Text = "Выбранный элемент";
|
|
||||||
//
|
|
||||||
// buttonClear
|
|
||||||
//
|
|
||||||
buttonClear.Location = new Point(101, 46);
|
|
||||||
buttonClear.Name = "buttonClear";
|
|
||||||
buttonClear.Size = new Size(94, 29);
|
|
||||||
buttonClear.TabIndex = 4;
|
|
||||||
buttonClear.Text = "очистить";
|
|
||||||
buttonClear.UseVisualStyleBackColor = true;
|
|
||||||
buttonClear.Click += buttonClear_Click;
|
|
||||||
//
|
|
||||||
// emailTextBox
|
|
||||||
//
|
|
||||||
emailTextBox.Location = new Point(12, 132);
|
|
||||||
emailTextBox.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
emailTextBox.Name = "emailTextBox";
|
|
||||||
emailTextBox.Pattern = null;
|
|
||||||
emailTextBox.Size = new Size(179, 34);
|
|
||||||
emailTextBox.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// labelShow
|
|
||||||
//
|
|
||||||
labelShow.AutoSize = true;
|
|
||||||
labelShow.Location = new Point(12, 170);
|
|
||||||
labelShow.Name = "labelShow";
|
|
||||||
labelShow.Size = new Size(76, 20);
|
|
||||||
labelShow.TabIndex = 10;
|
|
||||||
labelShow.Text = "проверка";
|
|
||||||
//
|
|
||||||
// buttonShow
|
|
||||||
//
|
|
||||||
buttonShow.Location = new Point(12, 196);
|
|
||||||
buttonShow.Name = "buttonShow";
|
|
||||||
buttonShow.Size = new Size(94, 29);
|
|
||||||
buttonShow.TabIndex = 9;
|
|
||||||
buttonShow.Text = "Проверка";
|
|
||||||
buttonShow.UseVisualStyleBackColor = true;
|
|
||||||
buttonShow.Click += buttonShow_Click;
|
|
||||||
//
|
|
||||||
// buttonSetExample
|
|
||||||
//
|
|
||||||
buttonSetExample.Location = new Point(12, 328);
|
|
||||||
buttonSetExample.Name = "buttonSetExample";
|
|
||||||
buttonSetExample.Size = new Size(188, 29);
|
|
||||||
buttonSetExample.TabIndex = 8;
|
|
||||||
buttonSetExample.Text = "Поменять пример";
|
|
||||||
buttonSetExample.UseVisualStyleBackColor = true;
|
|
||||||
buttonSetExample.Click += buttonSetExample_Click;
|
|
||||||
//
|
|
||||||
// labelExample
|
|
||||||
//
|
|
||||||
labelExample.AutoSize = true;
|
|
||||||
labelExample.Location = new Point(12, 263);
|
|
||||||
labelExample.Name = "labelExample";
|
|
||||||
labelExample.Size = new Size(147, 20);
|
|
||||||
labelExample.TabIndex = 7;
|
|
||||||
labelExample.Text = "Для ввода примера";
|
|
||||||
//
|
|
||||||
// textBoxExample
|
|
||||||
//
|
|
||||||
textBoxExample.Location = new Point(12, 295);
|
|
||||||
textBoxExample.Name = "textBoxExample";
|
|
||||||
textBoxExample.Size = new Size(188, 27);
|
|
||||||
textBoxExample.TabIndex = 6;
|
|
||||||
//
|
|
||||||
// listBoxObj
|
|
||||||
//
|
|
||||||
listBoxObj.Location = new Point(388, 13);
|
|
||||||
listBoxObj.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
listBoxObj.Name = "listBoxObj";
|
|
||||||
listBoxObj.SelectedIndex = -1;
|
|
||||||
listBoxObj.Size = new Size(368, 159);
|
|
||||||
listBoxObj.TabIndex = 11;
|
|
||||||
//
|
|
||||||
// buttonAddObjects
|
|
||||||
//
|
|
||||||
buttonAddObjects.Location = new Point(388, 179);
|
|
||||||
buttonAddObjects.Name = "buttonAddObjects";
|
|
||||||
buttonAddObjects.Size = new Size(380, 29);
|
|
||||||
buttonAddObjects.TabIndex = 12;
|
|
||||||
buttonAddObjects.Text = "Добавить";
|
|
||||||
buttonAddObjects.UseVisualStyleBackColor = true;
|
|
||||||
buttonAddObjects.Click += buttonAddObjects_Click;
|
|
||||||
//
|
|
||||||
// buttonShowItem
|
|
||||||
//
|
|
||||||
buttonShowItem.Location = new Point(388, 310);
|
|
||||||
buttonShowItem.Name = "buttonShowItem";
|
|
||||||
buttonShowItem.Size = new Size(380, 29);
|
|
||||||
buttonShowItem.TabIndex = 13;
|
|
||||||
buttonShowItem.Text = "Получить";
|
|
||||||
buttonShowItem.UseVisualStyleBackColor = true;
|
|
||||||
buttonShowItem.Click += buttonShowItem_Click;
|
|
||||||
//
|
|
||||||
// labelShowInput
|
|
||||||
//
|
|
||||||
labelShowInput.AutoSize = true;
|
|
||||||
labelShowInput.Location = new Point(388, 273);
|
|
||||||
labelShowInput.Name = "labelShowInput";
|
|
||||||
labelShowInput.Size = new Size(54, 20);
|
|
||||||
labelShowInput.TabIndex = 14;
|
|
||||||
labelShowInput.Text = "Вывод";
|
|
||||||
//
|
|
||||||
// FormForComponents
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(800, 450);
|
|
||||||
Controls.Add(dropDownList);
|
|
||||||
Controls.Add(buttonAdd);
|
|
||||||
Controls.Add(buttonInfo);
|
|
||||||
Controls.Add(labelInfo);
|
|
||||||
Controls.Add(buttonClear);
|
|
||||||
Controls.Add(emailTextBox);
|
|
||||||
Controls.Add(textBoxExample);
|
|
||||||
Controls.Add(labelExample);
|
|
||||||
Controls.Add(buttonSetExample);
|
|
||||||
Controls.Add(labelShow);
|
|
||||||
Controls.Add(buttonShow);
|
|
||||||
Controls.Add(listBoxObj);
|
|
||||||
Controls.Add(buttonAddObjects);
|
|
||||||
Controls.Add(buttonShowItem);
|
|
||||||
Controls.Add(labelShowInput);
|
|
||||||
Name = "FormForComponents";
|
|
||||||
Text = "Form1";
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
private VisualCompLib.MyDropDownList dropDownList;
|
|
||||||
private Button buttonAdd;
|
|
||||||
private Button buttonInfo;
|
|
||||||
private Label labelInfo;
|
|
||||||
private Button buttonClear;
|
|
||||||
private VisualCompLib.MyEmailTextBox emailTextBox;
|
|
||||||
private TextBox textBoxExample;
|
|
||||||
private Label labelExample;
|
|
||||||
private Button buttonSetExample;
|
|
||||||
private Label labelShow;
|
|
||||||
private Button buttonShow;
|
|
||||||
private VisualCompLib.MyListBoxObjects listBoxObj;
|
|
||||||
private Button buttonAddObjects;
|
|
||||||
private Button buttonShowItem;
|
|
||||||
private Label labelShowInput;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,79 +0,0 @@
|
|||||||
using VisualCompLib.Object;
|
|
||||||
|
|
||||||
namespace WinForms
|
|
||||||
{
|
|
||||||
public partial class FormForComponents : Form
|
|
||||||
{
|
|
||||||
List<string> list = new List<string>();
|
|
||||||
List<Student> students = new List<Student>();
|
|
||||||
public FormForComponents()
|
|
||||||
{
|
|
||||||
list = new List<string>();
|
|
||||||
list.AddRange(new string[] { "õëåá", "ìîëîêî", "êîëáàñà" });
|
|
||||||
Student student1 = new Student("Âàñèëüåâ", "ÏÈáä-32", "ÔÈÑÒ", 3);
|
|
||||||
Student student2 = new Student("Èâàíîâ", "ÐÒáä-11", "ÐÒÔ", 1);
|
|
||||||
Student student3 = new Student("Ñìèðíîâà", "ËÌÊÊáä-41", "ÃÔ", 4);
|
|
||||||
students.Add(student1);
|
|
||||||
students.Add(student2);
|
|
||||||
students.Add(student3);
|
|
||||||
InitializeComponent();
|
|
||||||
dropDownList.LoadValues(new List<string>() { "ñîê", "ÿáëîêî", "ëóê" });
|
|
||||||
emailTextBox.Pattern = @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$";
|
|
||||||
listBoxObj.SetLayoutInfo("Ôàìèëèÿ *Name* Ãðóïïà *Group* Ôàêóëüòåò *Faculty* Êóðñ *Course*", "*", "*");
|
|
||||||
dropDownList.ValueChanged += CustomEventHandler;
|
|
||||||
}
|
|
||||||
private void CustomEventHandler(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Âûáðàííûé ýëåìåíò èçìåíåí");
|
|
||||||
}
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
dropDownList.LoadValues(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonInfo_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
labelInfo.Text = dropDownList.SelectedValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonClear_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
dropDownList.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonSetExample_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (textBoxExample.Text == String.Empty)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
emailTextBox.setExample(textBoxExample.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonShow_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (emailTextBox.TextBoxValue != null)
|
|
||||||
{
|
|
||||||
labelShow.Text = "ïîäõîäèò";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonAddObjects_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
listBoxObj.AddInListBox<Student>(students);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonShowItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string str = listBoxObj.GetObjectFromStr<Student>().Name + " " + listBoxObj.GetObjectFromStr<Student>().Group + " " + listBoxObj.GetObjectFromStr<Student>().Faculty + " " + listBoxObj.GetObjectFromStr<Student>().Course;
|
|
||||||
labelShowInput.Text = str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?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>
|
|
134
COP/WinForms/FormWord.Designer.cs
generated
134
COP/WinForms/FormWord.Designer.cs
generated
@ -1,134 +0,0 @@
|
|||||||
namespace WinForms
|
|
||||||
{
|
|
||||||
partial class FormWord
|
|
||||||
{
|
|
||||||
/// <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();
|
|
||||||
wordText = new VisualCompLib.Components.WordText(components);
|
|
||||||
groupBox1 = new GroupBox();
|
|
||||||
button1 = new Button();
|
|
||||||
wordLineChart = new VisualCompLib.Components.WordLineChart(components);
|
|
||||||
groupBox3 = new GroupBox();
|
|
||||||
button3 = new Button();
|
|
||||||
groupBox2 = new GroupBox();
|
|
||||||
button2 = new Button();
|
|
||||||
wordTable = new VisualCompLib.Components.WordTable(components);
|
|
||||||
groupBox1.SuspendLayout();
|
|
||||||
groupBox3.SuspendLayout();
|
|
||||||
groupBox2.SuspendLayout();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// groupBox1
|
|
||||||
//
|
|
||||||
groupBox1.Controls.Add(button1);
|
|
||||||
groupBox1.Location = new Point(12, 12);
|
|
||||||
groupBox1.Name = "groupBox1";
|
|
||||||
groupBox1.Size = new Size(120, 80);
|
|
||||||
groupBox1.TabIndex = 0;
|
|
||||||
groupBox1.TabStop = false;
|
|
||||||
groupBox1.Text = "Большой текст";
|
|
||||||
//
|
|
||||||
// button1
|
|
||||||
//
|
|
||||||
button1.Location = new Point(6, 45);
|
|
||||||
button1.Name = "button1";
|
|
||||||
button1.Size = new Size(94, 29);
|
|
||||||
button1.TabIndex = 0;
|
|
||||||
button1.Text = "Создать";
|
|
||||||
button1.UseVisualStyleBackColor = true;
|
|
||||||
button1.Click += button1_Click;
|
|
||||||
//
|
|
||||||
// groupBox3
|
|
||||||
//
|
|
||||||
groupBox3.Controls.Add(button3);
|
|
||||||
groupBox3.Location = new Point(331, 12);
|
|
||||||
groupBox3.Name = "groupBox3";
|
|
||||||
groupBox3.Size = new Size(120, 80);
|
|
||||||
groupBox3.TabIndex = 1;
|
|
||||||
groupBox3.TabStop = false;
|
|
||||||
groupBox3.Text = "Линейная диаграмма";
|
|
||||||
//
|
|
||||||
// button3
|
|
||||||
//
|
|
||||||
button3.Location = new Point(6, 45);
|
|
||||||
button3.Name = "button3";
|
|
||||||
button3.Size = new Size(94, 29);
|
|
||||||
button3.TabIndex = 0;
|
|
||||||
button3.Text = "Создать";
|
|
||||||
button3.UseVisualStyleBackColor = true;
|
|
||||||
button3.Click += button3_Click;
|
|
||||||
//
|
|
||||||
// groupBox2
|
|
||||||
//
|
|
||||||
groupBox2.Controls.Add(button2);
|
|
||||||
groupBox2.Location = new Point(171, 12);
|
|
||||||
groupBox2.Name = "groupBox2";
|
|
||||||
groupBox2.Size = new Size(120, 80);
|
|
||||||
groupBox2.TabIndex = 1;
|
|
||||||
groupBox2.TabStop = false;
|
|
||||||
groupBox2.Text = "Таблица";
|
|
||||||
//
|
|
||||||
// button2
|
|
||||||
//
|
|
||||||
button2.Location = new Point(6, 45);
|
|
||||||
button2.Name = "button2";
|
|
||||||
button2.Size = new Size(94, 29);
|
|
||||||
button2.TabIndex = 0;
|
|
||||||
button2.Text = "Создать";
|
|
||||||
button2.UseVisualStyleBackColor = true;
|
|
||||||
button2.Click += button2_Click;
|
|
||||||
//
|
|
||||||
// FormWord
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(463, 114);
|
|
||||||
Controls.Add(groupBox2);
|
|
||||||
Controls.Add(groupBox3);
|
|
||||||
Controls.Add(groupBox1);
|
|
||||||
Name = "FormWord";
|
|
||||||
Text = "Невизуальные компоненты";
|
|
||||||
groupBox1.ResumeLayout(false);
|
|
||||||
groupBox3.ResumeLayout(false);
|
|
||||||
groupBox2.ResumeLayout(false);
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private VisualCompLib.Components.WordText wordText;
|
|
||||||
private GroupBox groupBox1;
|
|
||||||
private Button button1;
|
|
||||||
private VisualCompLib.Components.WordLineChart wordLineChart;
|
|
||||||
private GroupBox groupBox3;
|
|
||||||
private Button button3;
|
|
||||||
private GroupBox groupBox2;
|
|
||||||
private Button button2;
|
|
||||||
private VisualCompLib.Components.WordTable wordTable;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,122 +0,0 @@
|
|||||||
using DocumentFormat.OpenXml.Wordprocessing;
|
|
||||||
using VisualCompLib.Components;
|
|
||||||
using VisualCompLib.Components.SupportClasses;
|
|
||||||
using VisualCompLib.Components.SupportClasses.Enums;
|
|
||||||
using VisualCompLib.Object;
|
|
||||||
|
|
||||||
namespace WinForms
|
|
||||||
{
|
|
||||||
public partial class FormWord : Form
|
|
||||||
{
|
|
||||||
string[] testArray = { "Зайцев. Да и вонь же тут у вас, сеньор! Не продохнешь! Воняет сургучом, кислятиной какой-то, клопами... Пфуй!", "Смотритель. Без запаха нельзя.", "Зайцев. Завтра разбудите меня в шесть часов... И чтоб тройка была готова... Мне нужно к девяти часам в город поспеть.", "Смотритель. Ладно...", "Зайцев. Который теперь час?" };
|
|
||||||
public FormWord()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void button1_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
//фильтрация файлов для диалогового окна
|
|
||||||
using var dialog = new SaveFileDialog
|
|
||||||
{
|
|
||||||
Filter = "docx|*.docx"
|
|
||||||
};
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LargeText largeText = new(dialog.FileName, "Ночь перед судом", testArray);
|
|
||||||
wordText.CreateWordText(largeText);
|
|
||||||
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void button2_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
List<int[]> mergedColumns = new()
|
|
||||||
{
|
|
||||||
new int[] { 0, 1, 2 }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<ColumnDefinition> columnDefinitions = new List<ColumnDefinition>
|
|
||||||
{
|
|
||||||
new ColumnDefinition { Header = "Образование", PropertyName = "Eduction", Weight = 35 },
|
|
||||||
new ColumnDefinition { Header = "", PropertyName = "Education1", Weight = 35 },
|
|
||||||
new ColumnDefinition { Header = "", PropertyName = "Education2", Weight = 10 },
|
|
||||||
new ColumnDefinition { Header = "Фамилия", PropertyName = "Name", Weight = 20 }
|
|
||||||
};
|
|
||||||
|
|
||||||
List<ColumnDefinition> columnDefinitions2 = new List<ColumnDefinition>
|
|
||||||
{
|
|
||||||
new ColumnDefinition { Header = "Группа", PropertyName = "Group", Weight = 35 },
|
|
||||||
new ColumnDefinition { Header = "Факультатив", PropertyName = "Faculty", Weight = 35 },
|
|
||||||
new ColumnDefinition { Header = "Курс", PropertyName = "Course", Weight = 10 },
|
|
||||||
new ColumnDefinition { Header = "Фамилия", PropertyName = "Name", Weight = 20 }
|
|
||||||
};
|
|
||||||
|
|
||||||
List<Student> data = new List<Student>
|
|
||||||
{
|
|
||||||
new Student { Group = "ПИбд-32", Faculty = "ФИСТ", Course = 3, Name = "Васильев" },
|
|
||||||
new Student { Group = "РТбд-11", Faculty = "РТФ", Course = 1, Name = "Иванов" },
|
|
||||||
new Student { Group = "ЛМККбд-41", Faculty = "ГФ", Course = 4, Name = "Смирнова" }
|
|
||||||
};
|
|
||||||
|
|
||||||
using var dialog = new SaveFileDialog
|
|
||||||
{
|
|
||||||
Filter = "docx|*.docx"
|
|
||||||
};
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
BigTable<Student> bigTable = new(dialog.FileName, "Задание 2", columnDefinitions, columnDefinitions2, data, mergedColumns);
|
|
||||||
wordTable.CreateTable(bigTable);
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void button3_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
//фильтрация файлов для диалогового окна
|
|
||||||
using var dialog = new SaveFileDialog
|
|
||||||
{
|
|
||||||
Filter = "docx|*.docx"
|
|
||||||
};
|
|
||||||
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string[] month = { "Январь", "Февраль", "Март" };
|
|
||||||
double[] profit1 = { 300, 440, 270 };
|
|
||||||
double[] profit2 = { 500, 620, 310 };
|
|
||||||
double[] profit3 = { 420, 189, 430 };
|
|
||||||
SimpleLineChart lineChart = new(dialog.FileName, "Третье задание", "График прибыли", EnumAreaLegend.Right, new List<DataLineChart> {
|
|
||||||
new DataLineChart("Компания 1", month, profit1), new DataLineChart("Компания 2", month, profit2), new DataLineChart("Компания 3", month, profit3),
|
|
||||||
});
|
|
||||||
|
|
||||||
wordLineChart.AddLineChart(lineChart);
|
|
||||||
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,129 +0,0 @@
|
|||||||
<?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="wordText.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="wordLineChart.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>134, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="wordTable.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>286, 17</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
@ -11,7 +11,7 @@ namespace WinForms
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new FormWord());
|
Application.Run(new Form1());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,12 +8,4 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Aspose.Words" Version="23.10.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\VisualCompLib\VisualCompLib.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user