Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
6f8592a884 | |||
cefc5fcbe3 | |||
afd75a94eb | |||
77764ab6fa | |||
016779550c | |||
6862daad73 | |||
c8777e4549 | |||
c23bc5c7c1 | |||
c73d358184 |
14
Components/BarsukovComponents.csproj
Normal file
14
Components/BarsukovComponents.csproj
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="PDFsharp-MigraDoc-GDI" Version="6.1.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
14
Components/Exceptions/CustomException.cs
Normal file
14
Components/Exceptions/CustomException.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BarsukovComponents.Exceptions
|
||||||
|
{
|
||||||
|
public class CustomException: Exception
|
||||||
|
{
|
||||||
|
public CustomException() { }
|
||||||
|
public CustomException(string message) : base(message) { }
|
||||||
|
}
|
||||||
|
}
|
22
Components/NotVisualComponents/Configs/ColumnInfo.cs
Normal file
22
Components/NotVisualComponents/Configs/ColumnInfo.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BarsukovComponents.NotVisualComponents.Configs
|
||||||
|
{
|
||||||
|
public class ColumnInfo
|
||||||
|
{
|
||||||
|
public string PropertyName;
|
||||||
|
public string Header;
|
||||||
|
public int Width;
|
||||||
|
|
||||||
|
public ColumnInfo(string propertyName, string header, int width)
|
||||||
|
{
|
||||||
|
PropertyName = propertyName;
|
||||||
|
Header = header;
|
||||||
|
Width = width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
13
Components/NotVisualComponents/Configs/LengendAlign.cs
Normal file
13
Components/NotVisualComponents/Configs/LengendAlign.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BarsukovComponents.NotVisualComponents.Configs
|
||||||
|
{
|
||||||
|
public enum LengendAlign
|
||||||
|
{
|
||||||
|
top, bottom, left, right
|
||||||
|
}
|
||||||
|
}
|
20
Components/NotVisualComponents/Configs/MergeCells.cs
Normal file
20
Components/NotVisualComponents/Configs/MergeCells.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BarsukovComponents.NotVisualComponents.Configs
|
||||||
|
{
|
||||||
|
public class MergeCells
|
||||||
|
{
|
||||||
|
public string Header;
|
||||||
|
public int[] Indexes;
|
||||||
|
|
||||||
|
public MergeCells(string header, int[] indexes)
|
||||||
|
{
|
||||||
|
Header=header;
|
||||||
|
Indexes=indexes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
Components/NotVisualComponents/Configs/TextPdfConf.cs
Normal file
15
Components/NotVisualComponents/Configs/TextPdfConf.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BarsukovComponents.NotVisualComponents.Configs
|
||||||
|
{
|
||||||
|
public class TextPdfConf
|
||||||
|
{
|
||||||
|
public string Filename { get; set; } = string.Empty;
|
||||||
|
public string Title { get; set; } = string.Empty;
|
||||||
|
public List<string> Rows { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
36
Components/NotVisualComponents/PdfDiagram.Designer.cs
generated
Normal file
36
Components/NotVisualComponents/PdfDiagram.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
namespace BarsukovComponents.NotVisualComponents
|
||||||
|
{
|
||||||
|
partial class PdfDiagram
|
||||||
|
{
|
||||||
|
/// <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
|
||||||
|
}
|
||||||
|
}
|
87
Components/NotVisualComponents/PdfDiagram.cs
Normal file
87
Components/NotVisualComponents/PdfDiagram.cs
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using BarsukovComponents.NotVisualComponents.Configs;
|
||||||
|
using PdfSharp.Charting;
|
||||||
|
using PdfSharp.Drawing;
|
||||||
|
using PdfSharp.Pdf;
|
||||||
|
|
||||||
|
namespace BarsukovComponents.NotVisualComponents
|
||||||
|
{
|
||||||
|
public partial class PdfDiagram : Component
|
||||||
|
{
|
||||||
|
public PdfDiagram()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PdfDiagram(IContainer container)
|
||||||
|
{
|
||||||
|
container.Add(this);
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateDiagram(string filename, string title, string diagramName, Dictionary<string, List<double>> data, LengendAlign legendAlign = LengendAlign.bottom)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(filename))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Enter filemale");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(title))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Enter title");
|
||||||
|
}
|
||||||
|
if (data.Count == 0)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Enter data");
|
||||||
|
}
|
||||||
|
|
||||||
|
Chart chart = new Chart(ChartType.Line);
|
||||||
|
|
||||||
|
chart.Legend.Docking = (DockingType)legendAlign;
|
||||||
|
chart.Legend.LineFormat.Visible = true;
|
||||||
|
|
||||||
|
foreach (var item in data)
|
||||||
|
{
|
||||||
|
Series series = chart.SeriesCollection.AddSeries();
|
||||||
|
series.Name = item.Key;
|
||||||
|
double[] values = new double[item.Value.Count];
|
||||||
|
for (int i = 0; i < item.Value.Count; i++)
|
||||||
|
{
|
||||||
|
values.SetValue(Convert.ToDouble(item.Value[i]), i);
|
||||||
|
}
|
||||||
|
series.Add(values);
|
||||||
|
}
|
||||||
|
|
||||||
|
chart.XAxis.MajorTickMark = TickMarkType.Outside;
|
||||||
|
chart.YAxis.MajorTickMark = TickMarkType.Cross;
|
||||||
|
|
||||||
|
chart.PlotArea.LineFormat.Color = XColors.Black;
|
||||||
|
chart.PlotArea.LineFormat.Visible = true;
|
||||||
|
chart.PlotArea.FillFormat.Color = XColors.White;
|
||||||
|
|
||||||
|
chart.Legend.LineFormat.Visible = true;
|
||||||
|
|
||||||
|
ChartFrame chartFrame = new ChartFrame();
|
||||||
|
chartFrame.Location = new XPoint(50, 70);
|
||||||
|
chartFrame.Size = new XSize(500, 400);
|
||||||
|
chartFrame.Add(chart);
|
||||||
|
|
||||||
|
PdfDocument document = new PdfDocument(filename);
|
||||||
|
PdfPage page = document.AddPage();
|
||||||
|
page.Size = PdfSharp.PageSize.A4;
|
||||||
|
|
||||||
|
XGraphics gfx = XGraphics.FromPdfPage(page);
|
||||||
|
gfx.DrawString(title, new XFont("Times new Roman", 20, XFontStyleEx.Bold), XBrushes.Black, new XRect(20, 20, page.Width, page.Height), XStringFormats.TopCenter);
|
||||||
|
gfx.DrawString(diagramName, new XFont("Times new Roman", 14), XBrushes.Black, new XRect(20, 40, page.Width, page.Height), XStringFormats.TopCenter);
|
||||||
|
|
||||||
|
chartFrame.DrawChart(gfx);
|
||||||
|
document.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
36
Components/NotVisualComponents/PdfHugeText.Designer.cs
generated
Normal file
36
Components/NotVisualComponents/PdfHugeText.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
namespace BarsukovComponents.NotVisualComponents
|
||||||
|
{
|
||||||
|
partial class PdfHugeText
|
||||||
|
{
|
||||||
|
/// <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
|
||||||
|
}
|
||||||
|
}
|
56
Components/NotVisualComponents/PdfHugeText.cs
Normal file
56
Components/NotVisualComponents/PdfHugeText.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
using BarsukovComponents.NotVisualComponents.Configs;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using MigraDoc;
|
||||||
|
using MigraDoc.DocumentObjectModel;
|
||||||
|
using PdfSharp.Pdf;
|
||||||
|
using MigraDoc.Rendering;
|
||||||
|
using BarsukovComponents.Exceptions;
|
||||||
|
|
||||||
|
namespace BarsukovComponents.NotVisualComponents
|
||||||
|
{
|
||||||
|
public partial class PdfHugeText : Component
|
||||||
|
{
|
||||||
|
public PdfHugeText()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PdfHugeText(IContainer container)
|
||||||
|
{
|
||||||
|
container.Add(this);
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
public void CreatePdf(TextPdfConf conf)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(conf.Filename) || string.IsNullOrEmpty(conf.Title) || conf.Rows.Count == 0)
|
||||||
|
{
|
||||||
|
throw new CustomException("Путь до файла, заголовок или текст пусты");
|
||||||
|
}
|
||||||
|
|
||||||
|
Document document = new Document();
|
||||||
|
|
||||||
|
Section section = document.AddSection();
|
||||||
|
Paragraph paragraphTitle = section.AddParagraph();
|
||||||
|
paragraphTitle.AddText(conf.Title);
|
||||||
|
paragraphTitle.Format.Font.Bold = true;
|
||||||
|
paragraphTitle.Format.Font.Size = 20;
|
||||||
|
paragraphTitle.Format.SpaceAfter = "0.3cm";
|
||||||
|
|
||||||
|
Paragraph paragraph = section.AddParagraph();
|
||||||
|
paragraph.Format.Font.Size = 14;
|
||||||
|
foreach (var row in conf.Rows)
|
||||||
|
{
|
||||||
|
paragraph.AddText(row + '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
var renderer = new PdfDocumentRenderer(true);
|
||||||
|
renderer.Document = document;
|
||||||
|
renderer.RenderDocument();
|
||||||
|
|
||||||
|
renderer.PdfDocument.Save(conf.Filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
36
Components/NotVisualComponents/PdfTable.Designer.cs
generated
Normal file
36
Components/NotVisualComponents/PdfTable.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
namespace BarsukovComponents.NotVisualComponents
|
||||||
|
{
|
||||||
|
partial class PdfTable
|
||||||
|
{
|
||||||
|
/// <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
|
||||||
|
}
|
||||||
|
}
|
150
Components/NotVisualComponents/PdfTable.cs
Normal file
150
Components/NotVisualComponents/PdfTable.cs
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
using BarsukovComponents.NotVisualComponents.Configs;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using MigraDoc;
|
||||||
|
using MigraDoc.DocumentObjectModel;
|
||||||
|
using PdfSharp.Pdf;
|
||||||
|
using MigraDoc.Rendering;
|
||||||
|
using BarsukovComponents.Exceptions;
|
||||||
|
|
||||||
|
|
||||||
|
namespace BarsukovComponents.NotVisualComponents
|
||||||
|
{
|
||||||
|
public partial class PdfTable : Component
|
||||||
|
{
|
||||||
|
public PdfTable()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PdfTable(IContainer container)
|
||||||
|
{
|
||||||
|
container.Add(this);
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateTable<T>(string docPath, string title, List<MergeCells>? mergeCells, List<ColumnInfo> colInfo, List<T> data) where T : class, new()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(docPath))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Введите путь до файла!");
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(title))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Введите заголовок");
|
||||||
|
}
|
||||||
|
if (colInfo == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Введите все заголовки");
|
||||||
|
}
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Нету информации для вывода");
|
||||||
|
}
|
||||||
|
|
||||||
|
Document _document = new Document();
|
||||||
|
var style = _document.Styles["Normal"];
|
||||||
|
style.Font.Name = "Times New Roman";
|
||||||
|
style.Font.Size = 14;
|
||||||
|
|
||||||
|
Section _section = _document.AddSection();
|
||||||
|
|
||||||
|
//Заголовок
|
||||||
|
var paragraph = _section.AddParagraph(title);
|
||||||
|
paragraph.Format.SpaceAfter = "0.3cm";
|
||||||
|
paragraph.Format.Font.Size = "16";
|
||||||
|
paragraph.Format.Font.Bold = true;
|
||||||
|
paragraph.Format.Alignment = ParagraphAlignment.Center;
|
||||||
|
|
||||||
|
//Создание таблицы
|
||||||
|
var table = _section.AddTable();
|
||||||
|
table.Borders.Visible = true;
|
||||||
|
|
||||||
|
//Создание колонок
|
||||||
|
for (int i = 0; i < colInfo.Count; i++)
|
||||||
|
{
|
||||||
|
table.AddColumn(colInfo[i].Width);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Создание строк
|
||||||
|
if (mergeCells != null)
|
||||||
|
{
|
||||||
|
table.AddRow();
|
||||||
|
}
|
||||||
|
var row = table.AddRow();
|
||||||
|
|
||||||
|
for (int i = 0; i < colInfo.Count; i++)
|
||||||
|
{
|
||||||
|
row[i].AddParagraph(colInfo[i].Header);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<int> MergeColls = new List<int>();
|
||||||
|
|
||||||
|
//Объединение ячеек в строке
|
||||||
|
if (mergeCells != null)
|
||||||
|
{
|
||||||
|
foreach (var cell in mergeCells)
|
||||||
|
{
|
||||||
|
MergeColls.AddRange(cell.Indexes[0..]);
|
||||||
|
table.Rows[0].Cells[cell.Indexes[0]].MergeRight = cell.Indexes[1..].Length;
|
||||||
|
table.Rows[0].Cells[cell.Indexes[0]].AddParagraph(cell.Header);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int cellsCount = table.Rows[1].Cells.Count;
|
||||||
|
|
||||||
|
//Объединение ячеек в столбце
|
||||||
|
if (MergeColls.Count != 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < cellsCount; i++)
|
||||||
|
{
|
||||||
|
var cell = table.Rows[0].Cells[i];
|
||||||
|
if (!MergeColls.Contains(i))
|
||||||
|
{
|
||||||
|
cell.MergeDown = 1;
|
||||||
|
cell.AddParagraph(colInfo[i].Header);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Вывод данных
|
||||||
|
|
||||||
|
int rowData = 2;
|
||||||
|
foreach (var item in data)
|
||||||
|
{
|
||||||
|
var properties = item.GetType().GetProperties();
|
||||||
|
//if (properties.Count() != cellsCount)
|
||||||
|
//{
|
||||||
|
// throw new Exception("Кол-во полей объекта не совпадает с кол-вом колонок");
|
||||||
|
//}
|
||||||
|
|
||||||
|
for (int i = 0; i < cellsCount; i++)
|
||||||
|
{
|
||||||
|
var property = properties.FirstOrDefault(p => p.Name == colInfo[i].PropertyName);
|
||||||
|
if (property != null)
|
||||||
|
{
|
||||||
|
var propValue = property.GetValue(item);
|
||||||
|
if (propValue == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Пустое поле");
|
||||||
|
}
|
||||||
|
if (table.Rows.Count <= rowData)
|
||||||
|
{
|
||||||
|
table.AddRow();
|
||||||
|
}
|
||||||
|
table.Rows[rowData].Cells[i].AddParagraph(propValue.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rowData++;
|
||||||
|
}
|
||||||
|
|
||||||
|
var renderer = new PdfDocumentRenderer(true);
|
||||||
|
renderer.Document = _document;
|
||||||
|
renderer.RenderDocument();
|
||||||
|
|
||||||
|
renderer.PdfDocument.Save(docPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
70
Components/VisualComponents/CustomComboBox.Designer.cs
generated
Normal file
70
Components/VisualComponents/CustomComboBox.Designer.cs
generated
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
namespace BarsukovComponents.VisualComponents
|
||||||
|
{
|
||||||
|
partial class CustomComboBox
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Обязательная переменная конструктора.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Освободить все используемые ресурсы.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Код, автоматически созданный конструктором компонентов
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||||
|
/// содержимое этого метода с помощью редактора кода.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
comboBox = new ComboBox();
|
||||||
|
textBox1 = new TextBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// comboBox
|
||||||
|
//
|
||||||
|
comboBox.FormattingEnabled = true;
|
||||||
|
comboBox.Location = new Point(10, 36);
|
||||||
|
comboBox.Name = "comboBox";
|
||||||
|
comboBox.Size = new Size(230, 28);
|
||||||
|
comboBox.TabIndex = 0;
|
||||||
|
comboBox.SelectedIndexChanged += CustomComboBox_SelectedValueChanged;
|
||||||
|
//
|
||||||
|
// textBox1
|
||||||
|
//
|
||||||
|
textBox1.Location = new Point(10, 3);
|
||||||
|
textBox1.Name = "textBox1";
|
||||||
|
textBox1.Size = new Size(230, 27);
|
||||||
|
textBox1.TabIndex = 1;
|
||||||
|
textBox1.Text = "Выпадающий список";
|
||||||
|
//
|
||||||
|
// CustomComboBox
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
Controls.Add(textBox1);
|
||||||
|
Controls.Add(comboBox);
|
||||||
|
Name = "CustomComboBox";
|
||||||
|
Size = new Size(248, 73);
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ComboBox comboBox;
|
||||||
|
private TextBox textBox1;
|
||||||
|
}
|
||||||
|
}
|
60
Components/VisualComponents/CustomComboBox.cs
Normal file
60
Components/VisualComponents/CustomComboBox.cs
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace BarsukovComponents.VisualComponents
|
||||||
|
{
|
||||||
|
public partial class CustomComboBox : UserControl
|
||||||
|
{
|
||||||
|
public CustomComboBox()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearComboBox()
|
||||||
|
{
|
||||||
|
comboBox.Items.Clear();
|
||||||
|
comboBox.SelectedItem = null;
|
||||||
|
comboBox.Text = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SelectedItem
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return comboBox.SelectedItem?.ToString() ?? string.Empty; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
comboBox.SelectedItem = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ComboBox.ObjectCollection ComboBoxItems
|
||||||
|
{
|
||||||
|
get { return comboBox.Items; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private EventHandler _onValueChangedEvent;
|
||||||
|
public event EventHandler ValueChangedEvent
|
||||||
|
{
|
||||||
|
add
|
||||||
|
{
|
||||||
|
_onValueChangedEvent += value;
|
||||||
|
}
|
||||||
|
remove
|
||||||
|
{
|
||||||
|
_onValueChangedEvent -= value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void CustomComboBox_SelectedValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_onValueChangedEvent?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
Components/VisualComponents/CustomComboBox.resx
Normal file
120
Components/VisualComponents/CustomComboBox.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
57
Components/VisualComponents/CustomListBox.Designer.cs
generated
Normal file
57
Components/VisualComponents/CustomListBox.Designer.cs
generated
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
namespace BarsukovComponents.VisualComponents
|
||||||
|
{
|
||||||
|
partial class CustomListBox
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Обязательная переменная конструктора.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Освободить все используемые ресурсы.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Код, автоматически созданный конструктором компонентов
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||||
|
/// содержимое этого метода с помощью редактора кода.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
listBox = new ListBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// listBox
|
||||||
|
//
|
||||||
|
listBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
listBox.FormattingEnabled = true;
|
||||||
|
listBox.Location = new Point(9, 5);
|
||||||
|
listBox.Name = "listBox";
|
||||||
|
listBox.Size = new Size(814, 384);
|
||||||
|
listBox.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// CustomListBox
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(listBox);
|
||||||
|
Name = "CustomListBox";
|
||||||
|
Size = new Size(828, 410);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ListBox listBox;
|
||||||
|
}
|
||||||
|
}
|
147
Components/VisualComponents/CustomListBox.cs
Normal file
147
Components/VisualComponents/CustomListBox.cs
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace BarsukovComponents.VisualComponents
|
||||||
|
{
|
||||||
|
public partial class CustomListBox : UserControl
|
||||||
|
{
|
||||||
|
public CustomListBox()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private string template;
|
||||||
|
private string start;
|
||||||
|
private string end;
|
||||||
|
|
||||||
|
public void setTemplate(string _template, string _start, string _end)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(_template) || string.IsNullOrEmpty(_start) || string.IsNullOrEmpty(_end))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Wrong template");
|
||||||
|
}
|
||||||
|
template = _template;
|
||||||
|
start = _start;
|
||||||
|
end = _end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int SelectedRow
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return listBox.SelectedIndex;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value < 0) return;
|
||||||
|
listBox.SelectedIndex = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public T GetObjectFromStr<T>() where T : class, new()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (listBox.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
string row = listBox.SelectedItem.ToString();
|
||||||
|
T curObject = new T();
|
||||||
|
StringBuilder sb = new StringBuilder(row);
|
||||||
|
|
||||||
|
//MessageBox.Show(sb.ToString());
|
||||||
|
|
||||||
|
string[] words = template.Split(new[] { char.Parse(start), char.Parse(end) });
|
||||||
|
|
||||||
|
// Дорогой дневник, мне не подобрать слов чтобы описать всю {Mood}, что я испытал сегодня; {Date}
|
||||||
|
// Дорогой дневник, мне не подобрать слов чтобы описать всю радость, что я испытал сегодня; 01.01.01
|
||||||
|
|
||||||
|
StringBuilder myrow = new StringBuilder(row);
|
||||||
|
List<string> flexPartsTemplate = new();
|
||||||
|
foreach (string word in words)
|
||||||
|
{
|
||||||
|
if (row.Contains(word) && !string.IsNullOrEmpty(word))
|
||||||
|
{
|
||||||
|
myrow.Replace(word, end);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flexPartsTemplate.Add(word);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string[] flexParts = myrow.ToString().Split(end);
|
||||||
|
int i = 1;
|
||||||
|
StringBuilder result = new StringBuilder(template);
|
||||||
|
foreach (string word in flexPartsTemplate)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(word))
|
||||||
|
{
|
||||||
|
result.Replace(word, flexParts[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sb = result;
|
||||||
|
|
||||||
|
foreach (var property in typeof(T).GetProperties())
|
||||||
|
{
|
||||||
|
if (!property.CanWrite)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//MessageBox.Show(property.Name);
|
||||||
|
|
||||||
|
int startBorder = sb.ToString().IndexOf(start);
|
||||||
|
if (startBorder == -1)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int endBorder = sb.ToString().IndexOf(end, startBorder + 1);
|
||||||
|
if (endBorder == -1)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
string propertyValue = sb.ToString(startBorder + 1, endBorder - startBorder - 1);
|
||||||
|
sb.Remove(0, endBorder + 1);
|
||||||
|
property.SetValue(curObject, Convert.ChangeType(propertyValue, property.PropertyType));
|
||||||
|
}
|
||||||
|
return curObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FillProperty<T>(T dataObject, int rowIndex, string propertyName)
|
||||||
|
{
|
||||||
|
while (listBox.Items.Count <= rowIndex)
|
||||||
|
{
|
||||||
|
listBox.Items.Add(template);
|
||||||
|
}
|
||||||
|
|
||||||
|
string row = listBox.Items[rowIndex].ToString();
|
||||||
|
PropertyInfo propertyInfo = dataObject.GetType().GetProperty(propertyName);
|
||||||
|
|
||||||
|
if (propertyInfo != null)
|
||||||
|
{
|
||||||
|
var propertyValue = propertyInfo.GetValue(dataObject);
|
||||||
|
row = row.Replace($"{start}{propertyName}{end}", propertyValue.ToString());
|
||||||
|
listBox.Items[rowIndex] = row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int CountRows()
|
||||||
|
{
|
||||||
|
return listBox.Items.Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
Components/VisualComponents/CustomListBox.resx
Normal file
120
Components/VisualComponents/CustomListBox.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
70
Components/VisualComponents/CustomTextBox.Designer.cs
generated
Normal file
70
Components/VisualComponents/CustomTextBox.Designer.cs
generated
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
namespace BarsukovComponents.VisualComponents
|
||||||
|
{
|
||||||
|
partial class CustomTextBox
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
textBox = new TextBox();
|
||||||
|
textBox1 = new TextBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// textBox
|
||||||
|
//
|
||||||
|
textBox.Location = new Point(3, 40);
|
||||||
|
textBox.Name = "textBox";
|
||||||
|
textBox.Size = new Size(249, 27);
|
||||||
|
textBox.TabIndex = 0;
|
||||||
|
textBox.Click += showToolTip;
|
||||||
|
textBox.Leave += CustomTextBox_TextChanged;
|
||||||
|
//
|
||||||
|
// textBox1
|
||||||
|
//
|
||||||
|
textBox1.Location = new Point(3, 7);
|
||||||
|
textBox1.Name = "textBox1";
|
||||||
|
textBox1.Size = new Size(249, 27);
|
||||||
|
textBox1.TabIndex = 2;
|
||||||
|
textBox1.Text = "Поле для ввода номера телефона";
|
||||||
|
//
|
||||||
|
// CustomTextBox
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
Controls.Add(textBox1);
|
||||||
|
Controls.Add(textBox);
|
||||||
|
Name = "CustomTextBox";
|
||||||
|
Size = new Size(259, 68);
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private TextBox textBox;
|
||||||
|
private TextBox textBox1;
|
||||||
|
}
|
||||||
|
}
|
95
Components/VisualComponents/CustomTextBox.cs
Normal file
95
Components/VisualComponents/CustomTextBox.cs
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
using BarsukovComponents.Exceptions;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace BarsukovComponents.VisualComponents
|
||||||
|
{
|
||||||
|
public partial class CustomTextBox : UserControl
|
||||||
|
{
|
||||||
|
public CustomTextBox()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _numberPattern;
|
||||||
|
public string numberPattern
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _numberPattern;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_numberPattern = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string textBoxNumber
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_numberPattern == null)
|
||||||
|
{
|
||||||
|
throw new CustomException("there is no pattern");
|
||||||
|
}
|
||||||
|
Regex regex = new(_numberPattern);
|
||||||
|
if (regex.IsMatch(textBox.Text))
|
||||||
|
{
|
||||||
|
return textBox.Text;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new CustomException("there is wrong pattern");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(_numberPattern))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Regex regex = new(_numberPattern);
|
||||||
|
if (regex.IsMatch(value))
|
||||||
|
{
|
||||||
|
textBox.Text = value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
textBox.Text = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showToolTip(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ToolTip tt = new ToolTip();
|
||||||
|
tt.Show("+X XXX XXX XX XX" , textBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
private EventHandler _onValueChangedEvent;
|
||||||
|
|
||||||
|
public event EventHandler ValueChangedEvent
|
||||||
|
{
|
||||||
|
add
|
||||||
|
{
|
||||||
|
_onValueChangedEvent += value;
|
||||||
|
}
|
||||||
|
remove
|
||||||
|
{
|
||||||
|
_onValueChangedEvent -= value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void CustomTextBox_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_onValueChangedEvent?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
Components/VisualComponents/CustomTextBox.resx
Normal file
120
Components/VisualComponents/CustomTextBox.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
31
CustomComboBox/CustomComboBox.sln
Normal file
31
CustomComboBox/CustomComboBox.sln
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.11.35222.181
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BarsukovComponents", "..\Components\BarsukovComponents.csproj", "{52A015B2-0077-47D3-9BC8-F378C3BCF965}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp", "TestApp\TestApp.csproj", "{BF4A0F84-CD73-443C-A480-B54A9A0B7867}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{52A015B2-0077-47D3-9BC8-F378C3BCF965}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{52A015B2-0077-47D3-9BC8-F378C3BCF965}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{52A015B2-0077-47D3-9BC8-F378C3BCF965}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{52A015B2-0077-47D3-9BC8-F378C3BCF965}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{BF4A0F84-CD73-443C-A480-B54A9A0B7867}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{BF4A0F84-CD73-443C-A480-B54A9A0B7867}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{BF4A0F84-CD73-443C-A480-B54A9A0B7867}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{BF4A0F84-CD73-443C-A480-B54A9A0B7867}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {F37036A6-D640-4CD0-8488-B7A0518B4EB8}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
6
CustomComboBox/CustomComboBox/Class1.cs
Normal file
6
CustomComboBox/CustomComboBox/Class1.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace CustomComboBox
|
||||||
|
{
|
||||||
|
public class Class1
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
10
CustomComboBox/CustomComboBox/CustomComboBox.csproj
Normal file
10
CustomComboBox/CustomComboBox/CustomComboBox.csproj
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
20
CustomComboBox/TestApp/Day.cs
Normal file
20
CustomComboBox/TestApp/Day.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace TestApp
|
||||||
|
{
|
||||||
|
public class Day
|
||||||
|
{
|
||||||
|
public string Mood { get; set; }
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
public Day() { }
|
||||||
|
public Day(string mood, DateTime date)
|
||||||
|
{
|
||||||
|
Mood = mood;
|
||||||
|
Date = date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
CustomComboBox/TestApp/Example.cs
Normal file
26
CustomComboBox/TestApp/Example.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace TestApp
|
||||||
|
{
|
||||||
|
public class Example
|
||||||
|
{
|
||||||
|
public string First { get; set; } = string.Empty;
|
||||||
|
public string Second { get; set; } = string.Empty;
|
||||||
|
public string Third { get; set; } = string.Empty;
|
||||||
|
public string Fourth { get; set; } = string.Empty;
|
||||||
|
public string Fifth { get; set; } = string.Empty;
|
||||||
|
public Example() { }
|
||||||
|
public Example(string first, string second, string third, string fourth, string fifth)
|
||||||
|
{
|
||||||
|
First=first;
|
||||||
|
Second=second;
|
||||||
|
Third=third;
|
||||||
|
Fourth=fourth;
|
||||||
|
Fifth=fifth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
175
CustomComboBox/TestApp/Form1.Designer.cs
generated
Normal file
175
CustomComboBox/TestApp/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
using BarsukovComponents.NotVisualComponents.Configs;
|
||||||
|
|
||||||
|
namespace TestApp
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
customComboBox = new BarsukovComponents.VisualComponents.CustomComboBox();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
buttonClear = new Button();
|
||||||
|
buttonGet = new Button();
|
||||||
|
customTextBox = new BarsukovComponents.VisualComponents.CustomTextBox();
|
||||||
|
customListBox = new BarsukovComponents.VisualComponents.CustomListBox();
|
||||||
|
buttonDay = new Button();
|
||||||
|
buttonAddDay = new Button();
|
||||||
|
textBoxMood = new TextBox();
|
||||||
|
label1 = new Label();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// customComboBox
|
||||||
|
//
|
||||||
|
customComboBox.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
customComboBox.Location = new Point(12, 0);
|
||||||
|
customComboBox.Name = "customComboBox";
|
||||||
|
customComboBox.SelectedItem = "";
|
||||||
|
customComboBox.Size = new Size(252, 91);
|
||||||
|
customComboBox.TabIndex = 0;
|
||||||
|
customComboBox.ValueChangedEvent += customComboBox_ValueChanged;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.Location = new Point(5, 97);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(94, 29);
|
||||||
|
buttonAdd.TabIndex = 1;
|
||||||
|
buttonAdd.Text = "Add";
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// buttonClear
|
||||||
|
//
|
||||||
|
buttonClear.Location = new Point(105, 97);
|
||||||
|
buttonClear.Name = "buttonClear";
|
||||||
|
buttonClear.Size = new Size(94, 29);
|
||||||
|
buttonClear.TabIndex = 2;
|
||||||
|
buttonClear.Text = "Clear";
|
||||||
|
buttonClear.UseVisualStyleBackColor = true;
|
||||||
|
buttonClear.Click += buttonClear_Click;
|
||||||
|
//
|
||||||
|
// buttonGet
|
||||||
|
//
|
||||||
|
buttonGet.Location = new Point(205, 97);
|
||||||
|
buttonGet.Name = "buttonGet";
|
||||||
|
buttonGet.Size = new Size(94, 29);
|
||||||
|
buttonGet.TabIndex = 3;
|
||||||
|
buttonGet.Text = "Get";
|
||||||
|
buttonGet.UseVisualStyleBackColor = true;
|
||||||
|
buttonGet.Click += buttonGet_Click;
|
||||||
|
//
|
||||||
|
// customTextBox
|
||||||
|
//
|
||||||
|
customTextBox.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
customTextBox.Location = new Point(12, 144);
|
||||||
|
customTextBox.Name = "customTextBox";
|
||||||
|
customTextBox.numberPattern = null;
|
||||||
|
customTextBox.Size = new Size(258, 88);
|
||||||
|
customTextBox.TabIndex = 4;
|
||||||
|
customTextBox.ValueChangedEvent += customTextBox_ValueChanged;
|
||||||
|
//
|
||||||
|
// customListBox
|
||||||
|
//
|
||||||
|
customListBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
customListBox.Location = new Point(296, 0);
|
||||||
|
customListBox.Name = "customListBox";
|
||||||
|
customListBox.SelectedRow = -1;
|
||||||
|
customListBox.Size = new Size(848, 400);
|
||||||
|
customListBox.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonDay
|
||||||
|
//
|
||||||
|
buttonDay.Location = new Point(205, 342);
|
||||||
|
buttonDay.Name = "buttonDay";
|
||||||
|
buttonDay.Size = new Size(94, 29);
|
||||||
|
buttonDay.TabIndex = 6;
|
||||||
|
buttonDay.Text = "Get day";
|
||||||
|
buttonDay.UseVisualStyleBackColor = true;
|
||||||
|
buttonDay.Click += buttonDay_Click;
|
||||||
|
//
|
||||||
|
// buttonAddDay
|
||||||
|
//
|
||||||
|
buttonAddDay.Location = new Point(205, 371);
|
||||||
|
buttonAddDay.Name = "buttonAddDay";
|
||||||
|
buttonAddDay.Size = new Size(94, 29);
|
||||||
|
buttonAddDay.TabIndex = 7;
|
||||||
|
buttonAddDay.Text = "Write";
|
||||||
|
buttonAddDay.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddDay.Click += buttonAddDay_Click;
|
||||||
|
//
|
||||||
|
// textBoxMood
|
||||||
|
//
|
||||||
|
textBoxMood.Location = new Point(74, 371);
|
||||||
|
textBoxMood.Name = "textBoxMood";
|
||||||
|
textBoxMood.Size = new Size(125, 27);
|
||||||
|
textBoxMood.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(12, 378);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(52, 20);
|
||||||
|
label1.TabIndex = 9;
|
||||||
|
label1.Text = "Mood:";
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1156, 416);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Controls.Add(textBoxMood);
|
||||||
|
Controls.Add(buttonAddDay);
|
||||||
|
Controls.Add(buttonDay);
|
||||||
|
Controls.Add(customListBox);
|
||||||
|
Controls.Add(customTextBox);
|
||||||
|
Controls.Add(buttonGet);
|
||||||
|
Controls.Add(buttonClear);
|
||||||
|
Controls.Add(buttonAdd);
|
||||||
|
Controls.Add(customComboBox);
|
||||||
|
Name = "Form1";
|
||||||
|
Text = "Form1";
|
||||||
|
Load += MyForm_Load;
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private BarsukovComponents.VisualComponents.CustomComboBox customComboBox;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private Button buttonClear;
|
||||||
|
private Button buttonGet;
|
||||||
|
private BarsukovComponents.VisualComponents.CustomTextBox customTextBox;
|
||||||
|
private BarsukovComponents.VisualComponents.CustomListBox customListBox;
|
||||||
|
private Button buttonDay;
|
||||||
|
private Button buttonAddDay;
|
||||||
|
private TextBox textBoxMood;
|
||||||
|
private Label label1;
|
||||||
|
}
|
||||||
|
}
|
144
CustomComboBox/TestApp/Form1.cs
Normal file
144
CustomComboBox/TestApp/Form1.cs
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
using BarsukovComponents;
|
||||||
|
using BarsukovComponents.NotVisualComponents;
|
||||||
|
using BarsukovComponents.NotVisualComponents.Configs;
|
||||||
|
using MigraDoc.DocumentObjectModel;
|
||||||
|
namespace TestApp
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
private int counter = 4;
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
FillCustomComboBox();
|
||||||
|
FillCustomTextBox();
|
||||||
|
FillCustomListBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FillCustomComboBox()
|
||||||
|
{
|
||||||
|
customComboBox.ComboBoxItems.Add("some text 1");
|
||||||
|
customComboBox.ComboBoxItems.Add("some text 2");
|
||||||
|
customComboBox.ComboBoxItems.Add("some text 3");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
customComboBox.ComboBoxItems.Add($"some text {counter}");
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonClear_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
customComboBox.ClearComboBox();
|
||||||
|
counter = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void customComboBox_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
MessageBox.Show(customComboBox.SelectedItem.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonGet_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Âûáðàííûé ýëåìåíò :" + customComboBox.SelectedItem.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void FillCustomTextBox()
|
||||||
|
{
|
||||||
|
customTextBox.numberPattern = @"\+\d\s\d{3}\s\d{3}\s\d{2}\s\d{2}$";
|
||||||
|
customTextBox.textBoxNumber = "+7 953 982 67 85";
|
||||||
|
}
|
||||||
|
private void customTextBox_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
customTextBox.textBoxNumber = customTextBox.textBoxNumber;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
customTextBox.textBoxNumber = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void FillCustomListBox()
|
||||||
|
{
|
||||||
|
Day day1 = new Day() { Mood = "áîëü", Date = DateTime.Now };
|
||||||
|
Day day2 = new Day() { Mood = "ðàäîñòü", Date = DateTime.Now.AddDays(1.0) };
|
||||||
|
|
||||||
|
customListBox.setTemplate("Äîðîãîé äíåâíèê, ìíå íå ïîäîáðàòü ñëîâ ÷òîáû îïèñàòü âñþ {Mood}, ÷òî ÿ èñïûòàë ñåãîäíÿ; {Date}", "{", "}");
|
||||||
|
|
||||||
|
customListBox.FillProperty(day1, 0, "Mood");
|
||||||
|
customListBox.FillProperty(day1, 0, "Date");
|
||||||
|
|
||||||
|
customListBox.FillProperty(day2, 1, "Mood");
|
||||||
|
customListBox.FillProperty(day2, 1, "Date");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDay_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Day selectedDay = customListBox.GetObjectFromStr<Day>();
|
||||||
|
MessageBox.Show($"there was a lot {selectedDay.Mood} in {selectedDay.Date}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAddDay_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Day day = new();
|
||||||
|
day.Date = DateTime.Now;
|
||||||
|
if (string.IsNullOrEmpty(textBoxMood.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Write something!!!", "Error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
day.Mood = textBoxMood.Text;
|
||||||
|
int index = customListBox.CountRows();
|
||||||
|
customListBox.FillProperty(day, index, "Mood");
|
||||||
|
customListBox.FillProperty(day, index, "Date");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MyForm_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TextPdfConf conf = new TextPdfConf();
|
||||||
|
conf.Filename = "C:/Users/pasha/Desktop/MyDocument.pdf";
|
||||||
|
conf.Title = "My Document";
|
||||||
|
conf.Rows = new List<string> { "This is the first row. it's gonna be very long row that should actually take two rows or even more", "This is the second row.", "This is the third row." };
|
||||||
|
PdfHugeText pdfHugeText = new PdfHugeText();
|
||||||
|
pdfHugeText.CreatePdf(conf);
|
||||||
|
|
||||||
|
// -------------------
|
||||||
|
|
||||||
|
List<ColumnInfo> colInfos = new List<ColumnInfo>()
|
||||||
|
{
|
||||||
|
new ColumnInfo("First","First Prop",50),
|
||||||
|
new ColumnInfo("Second","Second Prop",100),
|
||||||
|
//new ColumnInfo("Third","Third Prop",100),
|
||||||
|
new ColumnInfo("Fourth","Fourth Prop",200),
|
||||||
|
new ColumnInfo("Fifth","Fifth Prop",50),
|
||||||
|
};
|
||||||
|
List<MergeCells> mergeCells = new List<MergeCells>()
|
||||||
|
{
|
||||||
|
new MergeCells("Merged columns", new int[] {2,3})
|
||||||
|
};
|
||||||
|
List<Example> workers = new List<Example>()
|
||||||
|
{
|
||||||
|
new Example("1 ïåðâûé", "1 ýòî âòîðîé)))", "1 òðåòèé", "1 ÷åòûðêà", "1 ïÿòêà"),
|
||||||
|
new Example("2 ïåðâàê", "2 ýòî âòîðîé âòîðîé)))", "2 òðåòüÿê", "2 õîðîøî", "5 ïÿòêà"),
|
||||||
|
};
|
||||||
|
PdfTable pdfTable = new PdfTable();
|
||||||
|
pdfTable.CreateTable("C:/Users/pasha/Desktop/MyTable.pdf", "TITLE", mergeCells, colInfos, workers);
|
||||||
|
|
||||||
|
// -------------------
|
||||||
|
|
||||||
|
Dictionary<string, List<double>> data = new();
|
||||||
|
data.Add("first", new List<double> {0.5, 3, 5, 9 });
|
||||||
|
data.Add("second", new List<double> {1, 2, 3, 7 });
|
||||||
|
|
||||||
|
PdfDiagram pdfDiagram = new PdfDiagram();
|
||||||
|
pdfDiagram.CreateDiagram("C:/Users/pasha/Desktop/MyDiagram.pdf", "title", "öèôåðêè öèôåðêè", data, LengendAlign.right);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
CustomComboBox/TestApp/Form1.resx
Normal file
120
CustomComboBox/TestApp/Form1.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
17
CustomComboBox/TestApp/Program.cs
Normal file
17
CustomComboBox/TestApp/Program.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace TestApp
|
||||||
|
{
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The main entry point for the application.
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
|
// see https://aka.ms/applicationconfiguration.
|
||||||
|
ApplicationConfiguration.Initialize();
|
||||||
|
Application.Run(new Form1());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
CustomComboBox/TestApp/TestApp.csproj
Normal file
15
CustomComboBox/TestApp/TestApp.csproj
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\Components\BarsukovComponents.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
Reference in New Issue
Block a user