Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 34d0d1aea6 | |||
| 1fefae50df | |||
| de3cb0a461 | |||
| 3b5d539290 | |||
| a372eeee57 |
37
WinFormsControlLibrary1/ComboSingleAddControl.Designer.cs
generated
Normal file
37
WinFormsControlLibrary1/ComboSingleAddControl.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
namespace WinFormsControlLibrary1
|
||||
{
|
||||
partial class ComboSingleAddControl
|
||||
{
|
||||
/// <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();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
51
WinFormsControlLibrary1/ComboSingleAddControl.cs
Normal file
51
WinFormsControlLibrary1/ComboSingleAddControl.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
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 WinFormsControlLibrary1;
|
||||
|
||||
|
||||
public partial class ComboSingleAddControl : UserControl
|
||||
{
|
||||
private readonly ComboBox _combo = new() { Dock = DockStyle.Fill };
|
||||
public EventHandler? SelectedValueChanged;
|
||||
public ComboSingleAddControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
Controls.Add(_combo);
|
||||
_combo.SelectedIndexChanged += (_, __) => SelectedValueChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public string SelectedValue
|
||||
{
|
||||
get => _combo.SelectedIndex.ToString() ?? string.Empty;
|
||||
set
|
||||
{
|
||||
if(string.IsNullOrEmpty(value)) { _combo.SelectedIndex = -1; return; }
|
||||
int id = _combo.Items.IndexOf(value);
|
||||
if(id >= 0) _combo.SelectedIndex = id;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddValue(string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value)) return;
|
||||
if (_combo.Items.Contains(value)) return;
|
||||
_combo.Items.Add(value);
|
||||
if(_combo.SelectedIndex < 0) _combo.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
public void ClearItems()
|
||||
{
|
||||
_combo.Items.Clear();
|
||||
_combo.SelectedIndex = -1;
|
||||
}
|
||||
}
|
||||
37
WinFormsControlLibrary1/DateByPatternTextBox.Designer.cs
generated
Normal file
37
WinFormsControlLibrary1/DateByPatternTextBox.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
namespace WinFormsControlLibrary1
|
||||
{
|
||||
partial class DateByPatternTextBox
|
||||
{
|
||||
/// <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();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
79
WinFormsControlLibrary1/DateByPatternTextBox.cs
Normal file
79
WinFormsControlLibrary1/DateByPatternTextBox.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
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;
|
||||
using WinFormsControlLibrary1.Exceptions;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace WinFormsControlLibrary1;
|
||||
|
||||
public partial class DateByPatternTextBox : UserControl
|
||||
{
|
||||
private readonly TextBox patternTextBox = new() { Dock = DockStyle.Fill };
|
||||
private readonly ToolTip _tip = new();
|
||||
private string? _pattern;
|
||||
private Regex? _regex;
|
||||
public event EventHandler? ValueChanged;
|
||||
|
||||
|
||||
public DateByPatternTextBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
Controls.Add(patternTextBox);
|
||||
patternTextBox.TextChanged += (_, __) => ValueChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public string? Pattern
|
||||
{
|
||||
get => _pattern;
|
||||
set
|
||||
{
|
||||
_pattern = value;
|
||||
_regex = string.IsNullOrWhiteSpace(value) ? null : new Regex(value, RegexOptions.Compiled);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetToolTip(string example)
|
||||
{
|
||||
_tip.SetToolTip(patternTextBox, example);
|
||||
}
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public string Value
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_regex is null)
|
||||
{
|
||||
throw new ComponentValidationException("Не задан шаблон дaты (Pattern).");
|
||||
}
|
||||
var text = patternTextBox.Text.Trim();
|
||||
if (!_regex.IsMatch(text))
|
||||
{
|
||||
throw new ComponentValidationException("Введённая дата не соответствует заданному формату.");
|
||||
}
|
||||
return text;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_regex is null)
|
||||
{
|
||||
throw new ComponentValidationException("Не задан шаблон дaты (Pattern).");
|
||||
}
|
||||
var text = value.Trim();
|
||||
if (!_regex.IsMatch(text))
|
||||
{
|
||||
throw new ComponentValidationException("Введённая дата не соответствует заданному формату.");
|
||||
}
|
||||
patternTextBox.Text = value ?? string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
120
WinFormsControlLibrary1/DateByPatternTextBox.resx
Normal file
120
WinFormsControlLibrary1/DateByPatternTextBox.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>
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WinFormsControlLibrary1.Exceptions;
|
||||
|
||||
public class ComponentValidationException : Exception
|
||||
{
|
||||
public ComponentValidationException(string message) : base(message) { }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WinFormsControlLibrary1.Exceptions;
|
||||
|
||||
public class TemplateConfigurationException : Exception
|
||||
{
|
||||
public TemplateConfigurationException(string message) : base(message) { }
|
||||
}
|
||||
12
WinFormsControlLibrary1/Exceptions/TemplateParseException.cs
Normal file
12
WinFormsControlLibrary1/Exceptions/TemplateParseException.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WinFormsControlLibrary1.Exceptions;
|
||||
|
||||
internal class TemplateParseException : Exception
|
||||
{
|
||||
public TemplateParseException(string message) : base(message) { }
|
||||
}
|
||||
37
WinFormsControlLibrary1/TemplatedListBox.Designer.cs
generated
Normal file
37
WinFormsControlLibrary1/TemplatedListBox.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
namespace WinFormsControlLibrary1
|
||||
{
|
||||
partial class TemplatedListBox
|
||||
{
|
||||
/// <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();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
169
WinFormsControlLibrary1/TemplatedListBox.cs
Normal file
169
WinFormsControlLibrary1/TemplatedListBox.cs
Normal file
@@ -0,0 +1,169 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using WinFormsControlLibrary1.Exceptions;
|
||||
|
||||
namespace WinFormsControlLibrary1;
|
||||
|
||||
public partial class TemplatedListBox : UserControl
|
||||
{
|
||||
private readonly ListBox _lb = new() { Dock = DockStyle.Fill };
|
||||
|
||||
private string _template = "";
|
||||
private string _open = "{";
|
||||
private string _close = "}";
|
||||
|
||||
public event EventHandler? SelectedIndexChanged;
|
||||
|
||||
public TemplatedListBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
Controls.Add(_lb);
|
||||
_lb.HorizontalScrollbar = true;
|
||||
_lb.SelectedIndexChanged += (_, __) => SelectedIndexChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public void SetTemplate(string template, string open = "{", string close = "}")
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(template))
|
||||
throw new TemplateConfigurationException("Шаблон не должен быть пустым.");
|
||||
|
||||
_template = template;
|
||||
_open = open;
|
||||
_close = close;
|
||||
|
||||
if (template[0] == open[0] || template[template.Length - 1] == close[0])
|
||||
throw new TemplateConfigurationException("Шаблон не должен начинаться или заканчиваться свойством.");
|
||||
|
||||
CheckNoDoubleProperties(template, open, close);
|
||||
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_lb.Items.Clear();
|
||||
}
|
||||
|
||||
public void AddItem<T>(T item)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_template))
|
||||
throw new TemplateConfigurationException("Сначала вызовите SetTemplate.");
|
||||
|
||||
var text = Render(item);
|
||||
_lb.Items.Add(text);
|
||||
}
|
||||
|
||||
private string Render(object obj)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_template)) return string.Empty;
|
||||
|
||||
string result = _template;
|
||||
var type = obj.GetType();
|
||||
|
||||
foreach (var p in type.GetProperties())
|
||||
{
|
||||
if (!p.CanRead) continue;
|
||||
|
||||
string name = p.Name;
|
||||
|
||||
string val = Convert.ToString(p.GetValue(obj)) ?? string.Empty;
|
||||
|
||||
result = result.Replace($"{_open}{name}{_close}", val);
|
||||
}
|
||||
|
||||
foreach (var f in type.GetFields())
|
||||
{
|
||||
string name = f.Name;
|
||||
|
||||
string val = Convert.ToString(f.GetValue(obj)) ?? string.Empty;
|
||||
|
||||
result = result.Replace($"{_open}{name}{_close}", val);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public T? GetSelectedObject<T>() where T : class, new()
|
||||
{
|
||||
if (_lb.SelectedIndex == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string row = _lb.SelectedItem!.ToString()!;
|
||||
T obj = new T();
|
||||
var type = typeof(T);
|
||||
|
||||
List<string> substrings = new List<string>();
|
||||
List<string> props = ExtractPlaceholders(_template, _open, _close);
|
||||
|
||||
string template = _template;
|
||||
|
||||
substrings.AddRange(template.Split(_open + _close));
|
||||
|
||||
int int1 = 0; int int2 = 0;
|
||||
|
||||
for (int i = 0; i < props.Count; i++)
|
||||
{
|
||||
int1 = row.IndexOf(substrings[i]) + substrings[i].Length;
|
||||
int2 = row.IndexOf(substrings[i + 1]);
|
||||
if (substrings[i + 1] == "")
|
||||
{
|
||||
int2 = row.Length;
|
||||
}
|
||||
var value = row[int1..int2];
|
||||
|
||||
var p = type.GetProperty(props[i]);
|
||||
|
||||
if (p is null) continue;
|
||||
|
||||
p.SetValue(obj, Convert.ChangeType(value, p.PropertyType));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
private List<string> ExtractPlaceholders(string template, string open, string close)
|
||||
{
|
||||
var names = new List<string>();
|
||||
int i = 0;
|
||||
while (i < template.Length)
|
||||
{
|
||||
if (template[i] == open[0])
|
||||
{
|
||||
int j = template.IndexOf(close, i + 1, StringComparison.Ordinal);
|
||||
string name = template.Substring(i + 1, j - i - 1).Trim();
|
||||
names.Add(name);
|
||||
i = j + 1;
|
||||
}
|
||||
else i++;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
private static void CheckNoDoubleProperties(string template, string open, string close)
|
||||
{
|
||||
for (int i = 0; i < template.Length; i++)
|
||||
{
|
||||
if (template[i] == close[0])
|
||||
{
|
||||
int k = i + 1;
|
||||
while (k < template.Length && char.IsWhiteSpace(template[k])) k++;
|
||||
if (k < template.Length && template[k] == open[0])
|
||||
throw new TemplateConfigurationException("В шаблоне не должно идти два свойства подряд без текста между ними.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
120
WinFormsControlLibrary1/TemplatedListBox.resx
Normal file
120
WinFormsControlLibrary1/TemplatedListBox.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>
|
||||
38
WinFormsControlLibrary1/UserControl1.Designer.cs
generated
38
WinFormsControlLibrary1/UserControl1.Designer.cs
generated
@@ -1,38 +0,0 @@
|
||||
namespace WinFormsControlLibrary1
|
||||
{
|
||||
partial class UserControl1
|
||||
{
|
||||
/// <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 Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace WinFormsControlLibrary1
|
||||
{
|
||||
public partial class UserControl1 : UserControl
|
||||
{
|
||||
public UserControl1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0-windows</TargetFramework>
|
||||
<TargetFramework>net8.0-windows7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Title>MyComponentsLibrary</Title>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Authors>Romtec</Authors>
|
||||
<Version>1.0.4</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
25
WinFormsControlLibrary1/WinFormsControlLibrary1.sln
Normal file
25
WinFormsControlLibrary1/WinFormsControlLibrary1.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36401.2 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsControlLibrary1", "WinFormsControlLibrary1.csproj", "{C8BBBE49-732C-C899-B020-6B87BCBF1CD2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C8BBBE49-732C-C899-B020-6B87BCBF1CD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C8BBBE49-732C-C899-B020-6B87BCBF1CD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C8BBBE49-732C-C899-B020-6B87BCBF1CD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C8BBBE49-732C-C899-B020-6B87BCBF1CD2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {98BBBD7D-7A95-4216-927E-F47C3D82C695}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Reference in New Issue
Block a user