diff --git a/WinFormsLibrary1/WinFormsApp1/Form1.Designer.cs b/WinFormsLibrary1/WinFormsApp1/Form1.Designer.cs index e168305..6735c30 100644 --- a/WinFormsLibrary1/WinFormsApp1/Form1.Designer.cs +++ b/WinFormsLibrary1/WinFormsApp1/Form1.Designer.cs @@ -1,5 +1,4 @@ -using System.Windows.Forms; -using WinFormsLibrary1; +using WinFormsLibrary1; namespace WinFormsApp1 { @@ -41,7 +40,6 @@ namespace WinFormsApp1 // // dateInputControl1 // - dateInputControl1.Date = ""; dateInputControl1.Location = new Point(13, 107); dateInputControl1.Margin = new Padding(4, 5, 4, 5); dateInputControl1.Name = "dateInputControl1"; diff --git a/WinFormsLibrary1/WinFormsApp1/Form2.Designer.cs b/WinFormsLibrary1/WinFormsApp1/Form2.Designer.cs new file mode 100644 index 0000000..2add409 --- /dev/null +++ b/WinFormsLibrary1/WinFormsApp1/Form2.Designer.cs @@ -0,0 +1,81 @@ +using WinFormsLibrary1; + +namespace WinFormsApp1 +{ + partial class Form2 + { + private System.ComponentModel.IContainer components = null; + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + buttonCreateTextDocument = new Button(); + buttonCreateTableDocument = new Button(); + buttonCreateDiagramDocument = new Button(); + bigTextComponent1 = new ComponentWithBigText(components); + tableComponent1 = new ComponentTable(components); + diagramComponent1 = new ComponentDiagram(components); + SuspendLayout(); + // + // buttonCreateTextDocument + // + buttonCreateTextDocument.Location = new Point(12, 30); + buttonCreateTextDocument.Name = "buttonCreateTextDocument"; + buttonCreateTextDocument.Size = new Size(125, 50); + buttonCreateTextDocument.TabIndex = 0; + buttonCreateTextDocument.Text = "Создать документ с текстом"; + buttonCreateTextDocument.UseVisualStyleBackColor = true; + buttonCreateTextDocument.Click += buttonCreateTextDocument_Click; + // + // buttonCreateTableDocument + // + buttonCreateTableDocument.Location = new Point(180, 30); + buttonCreateTableDocument.Name = "buttonCreateTableDocument"; + buttonCreateTableDocument.Size = new Size(125, 50); + buttonCreateTableDocument.TabIndex = 1; + buttonCreateTableDocument.Text = "Создать документ с таблицей"; + buttonCreateTableDocument.UseVisualStyleBackColor = true; + buttonCreateTableDocument.Click += buttonCreateTableDocument_Click; + // + // buttonCreateDiagramDocument + // + buttonCreateDiagramDocument.Location = new Point(347, 30); + buttonCreateDiagramDocument.Name = "buttonCreateDiagramDocument"; + buttonCreateDiagramDocument.Size = new Size(125, 50); + buttonCreateDiagramDocument.TabIndex = 2; + buttonCreateDiagramDocument.Text = "Создать документ с диаграммой"; + buttonCreateDiagramDocument.UseVisualStyleBackColor = true; + buttonCreateDiagramDocument.Click += buttonCreateDiagramDocument_Click; + // + // FormNonVisualComponents + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(484, 111); + Controls.Add(buttonCreateDiagramDocument); + Controls.Add(buttonCreateTableDocument); + Controls.Add(buttonCreateTextDocument); + Name = "FormNonVisualComponents"; + Text = "Не визуальные компоненты"; + ResumeLayout(false); + } + + #endregion + + private Button buttonCreateTextDocument; + private Button buttonCreateTableDocument; + private Button buttonCreateDiagramDocument; + private ComponentWithBigText bigTextComponent1; + private ComponentTable tableComponent1; + private ComponentDiagram diagramComponent1; + } +} \ No newline at end of file diff --git a/WinFormsLibrary1/WinFormsApp1/Form2.cs b/WinFormsLibrary1/WinFormsApp1/Form2.cs new file mode 100644 index 0000000..981cfb4 --- /dev/null +++ b/WinFormsLibrary1/WinFormsApp1/Form2.cs @@ -0,0 +1,94 @@ +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 WinFormsLibrary1.Models; + +namespace WinFormsApp1 +{ + public partial class Form2: Form + { + public Form2() + { + InitializeComponent(); + } + private void buttonCreateTextDocument_Click(object sender, EventArgs e) + { + string filepath = "C:\\Users\\Владимир\\Desktop\\BigTextDocumentExcel.xlsx"; + string title = "Документ с большим текстом"; + + string[] rows = + { + "Строка1", + "Строка2", + "Строка3", + "Строка4" + }; + + bigTextComponent1.CreateDocument(filepath, title, rows); + } + private void buttonCreateTableDocument_Click(object sender, EventArgs e) + { + string filepath = "C:\\Users\\Владимир\\Desktop\\TableDocumentExcel.xlsx"; + string title = "Документ с таблицей"; + + List mergeCells = new List() + { + new MergeCell("Личные данные", new int[] { 2, 3, 4 }), + }; + List columns = new List() + { + new Column("Id", "Id", 10), + new Column("Status", "Статус", 10), + new Column("Name", "Имя", 20), + new Column("Familia", "Фамилия", 20), + new Column("Age", "Возраст", 20), + new Column("Department", "Подразделение", 30), + new Column("Salary", "зарплата", 10) + }; + + List data = new List() + { + new User(1, "нет", "Владимир", "Строев", 34, "Департамент 1", 2000.1), + new User(2, "нет", "Михаил", "Патрушев", 23, "Департамент 2", 192.9), + new User(3, "да", "Евгений", "Борисов", 19, "Департамент 4", 566), + new User(4, "да", "Иван", "Иванов", 41, "Департамент 5", 3990.5), + new User(5, "нет", "Владимир", "Строев", 39, "Департамент 3", 1596.0), + }; + + tableComponent1.CreateDocument(filepath, title, + mergeCells, columns, + data); + } + private void buttonCreateDiagramDocument_Click(object sender, EventArgs e) + { + LineChartConfig config = new LineChartConfig(); + config.Filepath = "C:\\Users\\Владимир\\Desktop\\DiagramDocumentExcel.xlsx"; + config.Header = "Документ с диаграммой"; + config.ChartTitle = "Моя диаграмма"; + string[] charts = { "График 1", "График 2" }; + + var data = new Dictionary>(); + for (int i = 0; i < 2; i++) + { + var row = new List(); + for (var j = 0; j < 5; j++) + { + row.Add(5 * i + j + 1); + } + + data.Add(charts[i], row); + } + config.Values = data; + + config.LegendPosition = LegendPosition.Bottom; + + diagramComponent1.CreateDocument(config); + } + } +} diff --git a/WinFormsLibrary1/WinFormsApp1/Form2.resx b/WinFormsLibrary1/WinFormsApp1/Form2.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/WinFormsLibrary1/WinFormsApp1/Form2.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WinFormsLibrary1/WinFormsApp1/Program.cs b/WinFormsLibrary1/WinFormsApp1/Program.cs index 1e39c2a..a0e4848 100644 --- a/WinFormsLibrary1/WinFormsApp1/Program.cs +++ b/WinFormsLibrary1/WinFormsApp1/Program.cs @@ -11,7 +11,7 @@ namespace WinFormsApp1 // 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 Form2()); } } } \ No newline at end of file diff --git a/WinFormsLibrary1/WinFormsApp1/User.cs b/WinFormsLibrary1/WinFormsApp1/User.cs new file mode 100644 index 0000000..de798ab --- /dev/null +++ b/WinFormsLibrary1/WinFormsApp1/User.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WinFormsApp1 +{ + internal class User + { + public int Id { get; set; } + public string Status { get; set; } + public string Name { get; set; } + public string Familia { get; set; } + public int Age { get; set; } + public string Department { get; set; } + public double Salary { get; set; } + public User() { } + + public User(int id, string status, string name, string familia, int age, string department, double salary) + { + Id = id; + Status = status; + Name = name; + Familia = familia; + Age = age; + Department = department; + Salary = salary; + } + + } +} diff --git a/WinFormsLibrary1/WinFormsLibrary1/ComponentDiagram.Designer.cs b/WinFormsLibrary1/WinFormsLibrary1/ComponentDiagram.Designer.cs new file mode 100644 index 0000000..2669328 --- /dev/null +++ b/WinFormsLibrary1/WinFormsLibrary1/ComponentDiagram.Designer.cs @@ -0,0 +1,36 @@ +namespace WinFormsLibrary1 +{ + partial class ComponentDiagram + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/WinFormsLibrary1/WinFormsLibrary1/ComponentDiagram.cs b/WinFormsLibrary1/WinFormsLibrary1/ComponentDiagram.cs new file mode 100644 index 0000000..e65a7a4 --- /dev/null +++ b/WinFormsLibrary1/WinFormsLibrary1/ComponentDiagram.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using WinFormsLibrary1.Models; +using Excel = Microsoft.Office.Interop.Excel; + +namespace WinFormsLibrary1 +{ + public partial class ComponentDiagram: Component + { + public ComponentDiagram() + { + InitializeComponent(); + } + public ComponentDiagram(IContainer container) + { + container.Add(this); + + InitializeComponent(); + } + public void CreateDocument(LineChartConfig config) + { + if (config == null) + { + throw new ArgumentNullException("Не задана конфигурация для построения линйеной диаграммы!"); + } + if (string.IsNullOrEmpty(config.Filepath)) + { + throw new ArgumentNullException("Не указан путь к файлу!"); + } + if (string.IsNullOrEmpty(config.Header)) + { + throw new ArgumentNullException("Не указан заголовок документа!"); + } + if (string.IsNullOrEmpty(config.ChartTitle)) + { + throw new ArgumentNullException("Не указано название диаграммы!"); + } + if (config.Values == null || config.Values.Count == 0) + { + throw new ArgumentNullException("Не заданы значения для отображения на диаграмме!"); + } + + Excel.Application excelApp = new Excel.Application(); + Excel.Workbook workbook = excelApp.Workbooks.Add(); + Excel.Worksheet worksheet = (Excel.Worksheet)workbook.Sheets[1]; + + worksheet.Cells[1, 1] = config.Header; + + // Создание диаграммы + Excel.ChartObjects chartObjs = (Excel.ChartObjects)worksheet.ChartObjects(); + Excel.ChartObject chartObj = chartObjs.Add(5, 50, 300, 300); + Excel.Chart excelChart = chartObj.Chart; + excelChart.ChartType = Excel.XlChartType.xlLine; + + // Запись данных + Excel.Range[] valuesRange = new Excel.Range[config.Values.Count]; + int leftTopI = 2, leftTopJ = 1; + for (int i = 0; i < config.Values.Count; i++) + { + string key = config.Values.Keys.ToList()[i]; + for (int j = 0; j < config.Values[key].Count; j++) + { + worksheet.Cells[leftTopI + i, leftTopJ + j] = config.Values[key][j]; + } + + valuesRange[i] = worksheet.Range + [worksheet.Cells[leftTopI + i, leftTopJ], + worksheet.Cells[leftTopI + i, leftTopJ + config.Values[key].Count - 1]]; + } + + // Задание данных + Excel.SeriesCollection seriesCollection = (Excel.SeriesCollection)excelChart.SeriesCollection(); + for (int i = 0; i < config.Values.Keys.Count; i++) + { + Excel.Series series = seriesCollection.NewSeries(); + series.Name = config.Values.Keys.ToList()[i]; + series.Values = valuesRange[i]; + } + + // Задание заголовка + excelChart.HasTitle = true; + excelChart.ChartTitle.Text = config.ChartTitle; + + // Задание легенды + excelChart.HasLegend = true; + switch (config.LegendPosition) + { + case LegendPosition.Top: + excelChart.Legend.Position = Excel.XlLegendPosition.xlLegendPositionTop; + break; + case LegendPosition.Right: + excelChart.Legend.Position = Excel.XlLegendPosition.xlLegendPositionRight; + break; + case LegendPosition.Bottom: + excelChart.Legend.Position = Excel.XlLegendPosition.xlLegendPositionBottom; + break; + case LegendPosition.Left: + excelChart.Legend.Position = Excel.XlLegendPosition.xlLegendPositionLeft; + break; + default: + excelChart.Legend.Position = Excel.XlLegendPosition.xlLegendPositionBottom; + break; + } + + if (File.Exists(config.Filepath)) + { + File.Delete(config.Filepath); + } + + excelApp.Application.ActiveWorkbook.SaveAs(config.Filepath); + workbook.Close(true); + excelApp.Quit(); + + Marshal.ReleaseComObject(excelApp); + } + } +} diff --git a/WinFormsLibrary1/WinFormsLibrary1/ComponentTable.Designer.cs b/WinFormsLibrary1/WinFormsLibrary1/ComponentTable.Designer.cs new file mode 100644 index 0000000..2bb4d42 --- /dev/null +++ b/WinFormsLibrary1/WinFormsLibrary1/ComponentTable.Designer.cs @@ -0,0 +1,36 @@ +namespace WinFormsLibrary1 +{ + partial class ComponentTable + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/WinFormsLibrary1/WinFormsLibrary1/ComponentTable.cs b/WinFormsLibrary1/WinFormsLibrary1/ComponentTable.cs new file mode 100644 index 0000000..23643a4 --- /dev/null +++ b/WinFormsLibrary1/WinFormsLibrary1/ComponentTable.cs @@ -0,0 +1,162 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using WinFormsLibrary1.Models; +using Excel = Microsoft.Office.Interop.Excel; + +namespace WinFormsLibrary1 +{ + public partial class ComponentTable : Component + { + private char[] _columnIndexes = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }; + public ComponentTable() + { + InitializeComponent(); + } + public ComponentTable(IContainer container) + { + container.Add(this); + + InitializeComponent(); + } + public void CreateDocument(string filepath, string title, + List mergeCells, List columns, + List data) where T : class, new() + { + if (string.IsNullOrEmpty(filepath)) + { + throw new ArgumentNullException("Не указан путь к файлу!"); + } + if (string.IsNullOrEmpty(title)) + { + throw new ArgumentNullException("Не указан заголовок документа!"); + } + if (mergeCells == null || mergeCells.Count == 0 || columns == null || columns.Count == 0) + { + throw new ArgumentNullException("Не заполнена информация по колонкам!"); + } + if (data == null) + { + throw new ArgumentNullException("Данные не заполнены!"); + } + + Excel.Application excelApp = new Excel.Application(); + Excel.Workbook workbook = excelApp.Workbooks.Add(); + Excel.Worksheet worksheet = (Excel.Worksheet)workbook.Sheets[1]; + + worksheet.Cells[1, 1] = title; + + // Заголовки таблицы + for (int i = 1; i <= columns.Count; i++) + { + if (string.IsNullOrEmpty(columns[i - 1].Header)) + { + throw new Exception("Заголовок не имеет данных!"); + } + + worksheet.Cells[2, i] = columns[i - 1].Header; + + Excel.Range column = (Excel.Range)worksheet.Columns[i]; + column.ColumnWidth = columns[i - 1].Width; + + Excel.Range cell = (Excel.Range)worksheet.Cells[2, i]; + cell.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; + cell.VerticalAlignment = Excel.XlHAlign.xlHAlignGeneral; + cell.Font.Bold = true; + } + + // Объединение ячеек по столбцам + List mergeIndexes = new List(); + foreach (var merge in mergeCells) + { + mergeIndexes.AddRange(merge.CellIndexes); + + Excel.Range rangeToCopy = worksheet.get_Range($"{_columnIndexes[merge.CellIndexes[0]]}2", $"{_columnIndexes[merge.CellIndexes[merge.CellIndexes.Length - 1]]}2").Cells; + Excel.Range rangeToInsert = worksheet.get_Range($"{_columnIndexes[merge.CellIndexes[0]]}3", $"{_columnIndexes[merge.CellIndexes[merge.CellIndexes.Length - 1]]}3").Cells; + rangeToInsert.Insert(Excel.XlInsertShiftDirection.xlShiftToRight, rangeToCopy.Cut()); + + Excel.Range rangeMerge = worksheet.get_Range($"{_columnIndexes[merge.CellIndexes[0]]}2", $"{_columnIndexes[merge.CellIndexes[merge.CellIndexes.Length - 1]]}2").Cells; + rangeMerge.Merge(); + worksheet.Cells[2, merge.CellIndexes[0] + 1] = merge.Header; + Excel.Range cell = (Excel.Range)worksheet.Cells[2, merge.CellIndexes[0] + 1]; + cell.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; + cell.VerticalAlignment = Excel.XlHAlign.xlHAlignCenter; + cell.Font.Bold = true; + } + + // Объединение ячеек по строкам, которые не объединяются по столбцам + for (int i = 1; i <= columns.Count; i++) + { + if (!mergeIndexes.Contains(i - 1)) + { + Excel.Range range = worksheet.get_Range($"{_columnIndexes[i - 1]}2", $"{_columnIndexes[i - 1]}3").Cells; + range.Merge(); + } + } + + // Заполнение данных + int row = 4; + foreach (var item in data) + { + var properties = item.GetType().GetProperties(); + if (properties.Count() != columns.Count) + { + throw new Exception("Количество полей объекта не соответствует количеству столбцов в таблице!"); + } + + for (int i = 0; i < properties.Count(); i++) + { + int columnIndex = 0; + var property = properties[i]; + var propertyValue = property.GetValue(item); + if (propertyValue == null) + { + throw new Exception("Поле имеет пустое значение!"); + } + + foreach (var column in columns) + { + if (column.FieldName == property.Name) + { + columnIndex = columns.IndexOf(column) + 1; + break; + } + } + + if (columnIndex != 0) + { + worksheet.Cells[row, columnIndex] = propertyValue; + } + } + + row++; + } + + // Границы таблицы + for (int i = 2; i <= (data.Count() + 3); i++) + { + for (int j = 1; j <= columns.Count(); j++) + { + Excel.Range cell = (Excel.Range)worksheet.Cells[i, j]; + cell.BorderAround(true); + } + } + + if (File.Exists(filepath)) + { + File.Delete(filepath); + } + + excelApp.Application.ActiveWorkbook.SaveAs(filepath); + workbook.Close(true); + excelApp.Quit(); + + Marshal.ReleaseComObject(excelApp); + } + } +} diff --git a/WinFormsLibrary1/WinFormsLibrary1/ComponentWithBigText.Designer.cs b/WinFormsLibrary1/WinFormsLibrary1/ComponentWithBigText.Designer.cs new file mode 100644 index 0000000..4dca646 --- /dev/null +++ b/WinFormsLibrary1/WinFormsLibrary1/ComponentWithBigText.Designer.cs @@ -0,0 +1,24 @@ +namespace WinFormsLibrary1 +{ + partial class ComponentWithBigText + { + private System.ComponentModel.IContainer components = null; + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + } + + #endregion + } +} diff --git a/WinFormsLibrary1/WinFormsLibrary1/ComponentWithBigText.cs b/WinFormsLibrary1/WinFormsLibrary1/ComponentWithBigText.cs new file mode 100644 index 0000000..67da898 --- /dev/null +++ b/WinFormsLibrary1/WinFormsLibrary1/ComponentWithBigText.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using Excel = Microsoft.Office.Interop.Excel; + +namespace WinFormsLibrary1 +{ + public partial class ComponentWithBigText : Component + { + public ComponentWithBigText() + { + InitializeComponent(); + } + + /// + /// Конструктор + /// + /// + public ComponentWithBigText(IContainer container) + { + container.Add(this); + + InitializeComponent(); + } + + /// + /// Создать документ + /// + /// + /// + /// + /// + public void CreateDocument(string filepath, string title, string[] rows) + { + if (string.IsNullOrEmpty(filepath)) + { + throw new ArgumentNullException("Не указан путь к файлу!"); + } + if (string.IsNullOrEmpty(title)) + { + throw new ArgumentNullException("Не указан заголовок документа!"); + } + if (rows == null || rows.Length == 0) + { + throw new ArgumentNullException("Массив с текстом не заполнен!"); + } + + Excel.Application excelApp = new Excel.Application(); + Excel.Workbook workbook = excelApp.Workbooks.Add(); + Excel.Worksheet worksheet = (Excel.Worksheet)workbook.Sheets[1]; + + worksheet.Cells[1, 1] = title; + for (int index = 0; index < rows.Length; index++) + { + worksheet.Cells[index + 3, 1] = rows[index]; + } + + if (File.Exists(filepath)) + { + File.Delete(filepath); + } + + excelApp.Application.ActiveWorkbook.SaveAs(filepath); + workbook.Close(true); + excelApp.Quit(); + + Marshal.ReleaseComObject(excelApp); + } + } +} diff --git a/WinFormsLibrary1/WinFormsLibrary1/ListBox.Designer.cs b/WinFormsLibrary1/WinFormsLibrary1/ListBox.Designer.cs index 2d5e613..5331df7 100644 --- a/WinFormsLibrary1/WinFormsLibrary1/ListBox.Designer.cs +++ b/WinFormsLibrary1/WinFormsLibrary1/ListBox.Designer.cs @@ -25,7 +25,7 @@ this.listBox.Name = "listBox"; this.listBox.Size = new System.Drawing.Size(120, 95); this.listBox.TabIndex = 0; - this.listBox.SelectedIndexChanged += new System.EventHandler(this.listBox_SelectedIndexChanged); + //this.listBox.SelectedIndexChanged += new System.EventHandler(this.listBox_SelectedIndexChanged); // // ListBoxUserControl // diff --git a/WinFormsLibrary1/WinFormsLibrary1/Models/Column.cs b/WinFormsLibrary1/WinFormsLibrary1/Models/Column.cs new file mode 100644 index 0000000..4dff8b8 --- /dev/null +++ b/WinFormsLibrary1/WinFormsLibrary1/Models/Column.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WinFormsLibrary1.Models +{ + public class Column + { + public string FieldName { get; set; } = string.Empty; + public string Header { get; set; } = string.Empty; + public int Width { get; set; } + public Column(string fieldName, string header, int width) + { + FieldName = fieldName; + Header = header; + Width = width; + } + } +} diff --git a/WinFormsLibrary1/WinFormsLibrary1/Models/LegendPosition.cs b/WinFormsLibrary1/WinFormsLibrary1/Models/LegendPosition.cs new file mode 100644 index 0000000..741df5f --- /dev/null +++ b/WinFormsLibrary1/WinFormsLibrary1/Models/LegendPosition.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WinFormsLibrary1.Models +{ + public enum LegendPosition + { + Top, + + Right, + + Bottom, + + Left, + } +} diff --git a/WinFormsLibrary1/WinFormsLibrary1/Models/LineChartConfig.cs b/WinFormsLibrary1/WinFormsLibrary1/Models/LineChartConfig.cs new file mode 100644 index 0000000..b41e062 --- /dev/null +++ b/WinFormsLibrary1/WinFormsLibrary1/Models/LineChartConfig.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WinFormsLibrary1.Models +{ + public class LineChartConfig + { + public string Filepath { get; set; } = string.Empty; + public string Header { get; set; } = string.Empty; + public string ChartTitle { get; set; } = string.Empty; + public Dictionary> Values { get; set; } = new(); + public LegendPosition LegendPosition { get; set; } + } +} diff --git a/WinFormsLibrary1/WinFormsLibrary1/Models/MergeCell.cs b/WinFormsLibrary1/WinFormsLibrary1/Models/MergeCell.cs new file mode 100644 index 0000000..d523583 --- /dev/null +++ b/WinFormsLibrary1/WinFormsLibrary1/Models/MergeCell.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WinFormsLibrary1.Models +{ + public class MergeCell + { + public string Header; + public int[] CellIndexes; + public MergeCell(string header, int[] cellIndexes) + { + Header = header; + CellIndexes = cellIndexes; + } + } +} diff --git a/WinFormsLibrary1/WinFormsLibrary1/WinFormsLibrary1.csproj b/WinFormsLibrary1/WinFormsLibrary1/WinFormsLibrary1.csproj index 3e210aa..ea36566 100644 --- a/WinFormsLibrary1/WinFormsLibrary1/WinFormsLibrary1.csproj +++ b/WinFormsLibrary1/WinFormsLibrary1/WinFormsLibrary1.csproj @@ -7,4 +7,8 @@ enable + + + +