1、优化LOG显示与引用
2、添加PMA工具,工具内容待完善 3、修复流程树显示 4、添加开源项目,优化UI空间 5、其他BUG更改
73
UsingControl/Controls/CButton.Designer.cs
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
namespace Controls
|
||||
{
|
||||
partial class CButton
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btn_button = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btn_button
|
||||
//
|
||||
this.btn_button.BackgroundImage = global::Controls.Properties.Resources.ButtonUp;
|
||||
this.btn_button.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.btn_button.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btn_button.FlatAppearance.BorderSize = 0;
|
||||
this.btn_button.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btn_button.ForeColor = System.Drawing.Color.White;
|
||||
this.btn_button.Location = new System.Drawing.Point(0, 0);
|
||||
this.btn_button.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_button.Name = "btn_button";
|
||||
this.btn_button.Size = new System.Drawing.Size(67, 28);
|
||||
this.btn_button.TabIndex = 0;
|
||||
this.btn_button.Text = "Button";
|
||||
this.btn_button.UseVisualStyleBackColor = true;
|
||||
this.btn_button.Click += new System.EventHandler(this.btn_button_Click);
|
||||
this.btn_button.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btn_button_MouseDown);
|
||||
this.btn_button.MouseEnter += new System.EventHandler(this.btn_button_MouseEnter);
|
||||
this.btn_button.MouseLeave += new System.EventHandler(this.btn_button_MouseLeave);
|
||||
this.btn_button.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btn_button_MouseUp);
|
||||
//
|
||||
// CButton
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.btn_button);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "CButton";
|
||||
this.Size = new System.Drawing.Size(67, 28);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btn_button;
|
||||
}
|
||||
}
|
||||
67
UsingControl/Controls/CButton.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Controls.Properties;
|
||||
|
||||
namespace Controls
|
||||
{
|
||||
public delegate void DClicked();
|
||||
public partial class CButton : UserControl
|
||||
{
|
||||
public CButton()
|
||||
{
|
||||
InitializeComponent();
|
||||
btn_button.Text = TextStr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击事件
|
||||
/// </summary>
|
||||
public event DClicked Clicked;
|
||||
/// <summary>
|
||||
/// 文本
|
||||
/// </summary>
|
||||
private string _textStr = "Button";
|
||||
public string TextStr
|
||||
{
|
||||
get { return _textStr; }
|
||||
set
|
||||
{
|
||||
_textStr = value;
|
||||
btn_button.Text = value;
|
||||
}
|
||||
}
|
||||
private void btn_button_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
btn_button.BackgroundImage = Resources.ButtonEnter;
|
||||
Application.DoEvents();
|
||||
}
|
||||
private void btn_button_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
btn_button.BackgroundImage = Resources.ButtonDown;
|
||||
Application.DoEvents();
|
||||
}
|
||||
private void btn_button_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
btn_button.BackgroundImage = Resources.ButtonUp;
|
||||
Application.DoEvents();
|
||||
}
|
||||
private void btn_button_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
btn_button.BackgroundImage = Resources.ButtonUp;
|
||||
Application.DoEvents();
|
||||
}
|
||||
private void btn_button_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Clicked != null)
|
||||
Clicked();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
120
UsingControl/Controls/CButton.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>
|
||||
76
UsingControl/Controls/CCheckBox.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Controls.Properties;
|
||||
|
||||
namespace Controls
|
||||
{
|
||||
public delegate void DCheckChanged(bool Checked);
|
||||
public partial class CCheckBox : UserControl
|
||||
{
|
||||
public CCheckBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
ckb_box.Text = TextStr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 状态改变事件
|
||||
/// </summary>
|
||||
public event DCheckChanged CheckChanged;
|
||||
/// <summary>
|
||||
/// 勾选状态
|
||||
/// </summary>
|
||||
private bool _checked = false;
|
||||
public bool Checked
|
||||
{
|
||||
get { return _checked; }
|
||||
set
|
||||
{
|
||||
_checked = value;
|
||||
ckb_box.Checked = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 文本
|
||||
/// </summary>
|
||||
private string _textStr = "复选框";
|
||||
public string TextStr
|
||||
{
|
||||
get { return _textStr; }
|
||||
set
|
||||
{
|
||||
_textStr = value;
|
||||
ckb_box.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void pic_image_Click(object sender, EventArgs e)
|
||||
{
|
||||
ckb_box.Checked = !ckb_box.Checked;
|
||||
}
|
||||
private void ckb_box_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (ckb_box.Checked)
|
||||
{
|
||||
pic_image.Image = Resources.复选框;
|
||||
Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
pic_image.Image = Resources.去复选框;
|
||||
Checked = false;
|
||||
}
|
||||
if (CheckChanged != null)
|
||||
CheckChanged(ckb_box.Checked);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
85
UsingControl/Controls/CCheckBox.designer.cs
generated
Normal file
@@ -0,0 +1,85 @@
|
||||
namespace Controls
|
||||
{
|
||||
partial class CCheckBox
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CCheckBox));
|
||||
this.pic_image = new System.Windows.Forms.PictureBox();
|
||||
this.ckb_box = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pic_image)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pic_image
|
||||
//
|
||||
this.pic_image.Image = ((System.Drawing.Image)(resources.GetObject("pic_image.Image")));
|
||||
this.pic_image.Location = new System.Drawing.Point(1, 1);
|
||||
this.pic_image.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.pic_image.Name = "pic_image";
|
||||
this.pic_image.Size = new System.Drawing.Size(18, 18);
|
||||
this.pic_image.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pic_image.TabIndex = 0;
|
||||
this.pic_image.TabStop = false;
|
||||
this.pic_image.Click += new System.EventHandler(this.pic_image_Click);
|
||||
//
|
||||
// ckb_box
|
||||
//
|
||||
this.ckb_box.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ckb_box.BackColor = System.Drawing.Color.White;
|
||||
this.ckb_box.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.ckb_box.Location = new System.Drawing.Point(5, 1);
|
||||
this.ckb_box.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.ckb_box.Name = "ckb_box";
|
||||
this.ckb_box.Size = new System.Drawing.Size(161, 23);
|
||||
this.ckb_box.TabIndex = 1;
|
||||
this.ckb_box.Text = "复选框";
|
||||
this.ckb_box.UseVisualStyleBackColor = false;
|
||||
this.ckb_box.CheckedChanged += new System.EventHandler(this.ckb_box_CheckedChanged);
|
||||
//
|
||||
// CCheckBox
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.pic_image);
|
||||
this.Controls.Add(this.ckb_box);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "CCheckBox";
|
||||
this.Size = new System.Drawing.Size(167, 20);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pic_image)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox pic_image;
|
||||
private System.Windows.Forms.CheckBox ckb_box;
|
||||
}
|
||||
}
|
||||
145
UsingControl/Controls/CCheckBox.resx
Normal file
@@ -0,0 +1,145 @@
|
||||
<?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>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="pic_image.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAABGdBTUEAALGPC/xhBQAABGFJREFUeF7t
|
||||
nYFR20AQRSnBJVBCOgglpIPQQdxBKIEOoBKTDkgHSQdJB8n/mTXjEYJIp7vT7u3/M29gQNrz+D9sy9jy
|
||||
laIoiqIoiqIoiqIU5unp6fp0On0U7eB1bFf3/uGFAV/AM/gjusLrnNd9fyGw6AE8gLkLJvrDLg5WT9tg
|
||||
oRvwyxYWfmAnH6ymNsECtxcLCp/cWl11g8H8y59bUPij7i0BBvI+Xzf7cWBX9R4TYNjjxXARg0erb1sw
|
||||
iId6cwsI/2w/RMSQ42SoiMPRaiwPhuhJnrg8W43lmRkqAmE1lgUDdP8fn/LHAdhZx/7xubE614c7T4aJ
|
||||
eEiA5EiA5EiA5EiA5EiA5EiA5EiA5EiA5EiA5EiA5EiA5EiA5EiA5EiA5EgAb5xOp5/4ylda3+H7b5e/
|
||||
a4AE8ALK/o2vr965g5/xXdWtRJAAHrDy333HDrb5Pt2vAhJgb5aUz3Cby/0qIQH2ZGn552B7Pj6YnVWI
|
||||
BNiLteUz2Kf2YwEJsAcl5TMSYABKy2emsyogAXqysfy7y1mVkAC92Fh+iyMAIgF6UKH8VifgkACtcVw+
|
||||
kQAtcV4+kQCtCFA+kQAtCFI+kQCNKLpisV/P8okEaEDRyRixX+/yiQSoTKTyiQSoSLTyiQSoRMTyiQSo
|
||||
QNTyiV8BcCh1fnHkPb5v/eLIUiKXT/wJYMfQr65Y/IwvjmzxurhSopdPXN4CvHuhnNwajFA+cSfAnY1/
|
||||
M9jmsPMtwSjlE3cCLLpA2G4vCUYqn/gSwEYvCrbvLcFo5RN3twCrzl2L7XtJMGL5xJ0An2z84mCf1hKM
|
||||
Wj5xJ8APG78q2K+VBCOXT9wJQB5siVXBfrUlKC2fH6IV5YM0XApA9pYgQ/nErQBkiwRb3kOXpXziWgBS
|
||||
fB8MCfiU8tzM98hUPnEvAOklQbbySQgBSGsJMpZPwghAWkmQtXwSSgBSW4LM5ZNwApBaEmQvn4QUgGyV
|
||||
oOjDk7HfSOWTsAKQUgmKPiwR+41WPgktACmSYG2wzojlk/ACkKL34C0N5o9aPhlCAP7XrYkEmDty+WQI
|
||||
AUh1CTBv9PLJMAKQahJgTobyyVACkM0SYP8s5ZPhBCDFEmC/TOWTIQUgqyXA9tnKJ8MKQBZLgO0ylk+G
|
||||
FoD8VwL8Pmv5ZHgByJsS4OeZyycpBDjzFfwTAV+vwWdAOea2zUIqAcRrJEByJEByJEByJEByJEByJEBy
|
||||
JEByJEByJEByJEByJEByJEByJEByJEByJEByJEByJEByJEByNgnA19XNDRVxKDpXwktmBopAWI3lOfU5
|
||||
VbtoALuzGsuDQcfpYBGGo9VYHgzR44C4bLv/PweD+Nl+cwsIv9xbfduDYTw795LTsQoHWFcHq69OMJCf
|
||||
kDG7oHDHqrfNLw4G304WEv5oe1o9LLD07NyiI9ZJm7/8abAQ33KtB4Z+uAd17/OXBIvyEPHIJxzsgohO
|
||||
2HXO52jqHOrVCC8M4D+QRDv8FK4oiqIoiqIoiqLEytXVXycxKra7YoNwAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
134
UsingControl/Controls/CComboBox.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Controls.Properties;
|
||||
|
||||
namespace Controls
|
||||
{
|
||||
public delegate void DSelectedIndexChanged();
|
||||
public partial class CComboBox : UserControl
|
||||
{
|
||||
public CComboBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
cbx_item.Items.AddRange(Items);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中项改变事件
|
||||
/// </summary>
|
||||
public event DSelectedIndexChanged SelectedIndexChanged;
|
||||
/// <summary>
|
||||
/// 选中项索引
|
||||
/// </summary>
|
||||
private int _selectedIndex = -1;
|
||||
public int SelectedIndex
|
||||
{
|
||||
get { return _selectedIndex; }
|
||||
set
|
||||
{
|
||||
_selectedIndex = value;
|
||||
cbx_item.SelectedIndex = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 文本
|
||||
/// </summary>
|
||||
private string _text = string.Empty;
|
||||
public string TextStr
|
||||
{
|
||||
get { return _text; }
|
||||
set
|
||||
{
|
||||
_text = value;
|
||||
cbx_item.Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否可以编辑
|
||||
/// </summary>
|
||||
private bool _canEdit = false;
|
||||
public bool CanEdit
|
||||
{
|
||||
get { return _canEdit; }
|
||||
set
|
||||
{
|
||||
_canEdit = value;
|
||||
if (value)
|
||||
cbx_item.DropDownStyle = ComboBoxStyle.DropDown;
|
||||
else
|
||||
cbx_item.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 项
|
||||
/// </summary>
|
||||
private string[] _items = new string[] { };
|
||||
public string[] Items
|
||||
{
|
||||
get { return _items; }
|
||||
set
|
||||
{
|
||||
_items = value;
|
||||
cbx_item.Items.Clear();
|
||||
cbx_item.Items.AddRange(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除所有项
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
Items = new string[] { };
|
||||
cbx_item.Items.Clear();
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加项
|
||||
/// </summary>
|
||||
/// <param name="item">项</param>
|
||||
public void Add(string item)
|
||||
{
|
||||
string[] items = new string[Items.Length + 1];
|
||||
for (int i = 0; i < Items.Length; i++)
|
||||
{
|
||||
items[i] = Items[i];
|
||||
}
|
||||
items[Items.Length] = item;
|
||||
Items = items;
|
||||
}
|
||||
|
||||
|
||||
private void cbx_item_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
SelectedIndex = cbx_item.SelectedIndex;
|
||||
TextStr = cbx_item.Text;
|
||||
if (SelectedIndexChanged != null)
|
||||
SelectedIndexChanged();
|
||||
}
|
||||
private void ComboBox_Enter(object sender, EventArgs e)
|
||||
{
|
||||
lbl_line.Height = 2;
|
||||
lbl_line.BackColor = Color.FromArgb(18, 150, 219);
|
||||
btn_showItem.Image = Resources.BlueImage;
|
||||
}
|
||||
private void ComboBox_Leave(object sender, EventArgs e)
|
||||
{
|
||||
lbl_line.Height = 1;
|
||||
lbl_line.BackColor = Color.Gray;
|
||||
btn_showItem.Image = Resources.GrayImage;
|
||||
}
|
||||
private void btn_showItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
cbx_item.DroppedDown = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
108
UsingControl/Controls/CComboBox.designer.cs
generated
Normal file
@@ -0,0 +1,108 @@
|
||||
namespace Controls
|
||||
{
|
||||
partial class CComboBox
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CComboBox));
|
||||
this.cbx_item = new System.Windows.Forms.ComboBox();
|
||||
this.lbl_line = new System.Windows.Forms.Label();
|
||||
this.btn_showItem = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// cbx_item
|
||||
//
|
||||
this.cbx_item.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cbx_item.BackColor = System.Drawing.Color.White;
|
||||
this.cbx_item.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbx_item.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.cbx_item.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.cbx_item.FormattingEnabled = true;
|
||||
this.cbx_item.Location = new System.Drawing.Point(2, -3);
|
||||
this.cbx_item.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.cbx_item.Name = "cbx_item";
|
||||
this.cbx_item.Size = new System.Drawing.Size(120, 25);
|
||||
this.cbx_item.TabIndex = 10;
|
||||
this.cbx_item.TabStop = false;
|
||||
this.cbx_item.SelectedIndexChanged += new System.EventHandler(this.cbx_item_SelectedIndexChanged);
|
||||
//
|
||||
// lbl_line
|
||||
//
|
||||
this.lbl_line.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lbl_line.BackColor = System.Drawing.Color.Gray;
|
||||
this.lbl_line.Location = new System.Drawing.Point(3, 20);
|
||||
this.lbl_line.Name = "lbl_line";
|
||||
this.lbl_line.Size = new System.Drawing.Size(120, 1);
|
||||
this.lbl_line.TabIndex = 11;
|
||||
//
|
||||
// btn_showItem
|
||||
//
|
||||
this.btn_showItem.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_showItem.BackColor = System.Drawing.Color.White;
|
||||
this.btn_showItem.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.btn_showItem.FlatAppearance.BorderColor = System.Drawing.Color.White;
|
||||
this.btn_showItem.FlatAppearance.BorderSize = 0;
|
||||
this.btn_showItem.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Gray;
|
||||
this.btn_showItem.FlatAppearance.MouseOverBackColor = System.Drawing.Color.DarkGray;
|
||||
this.btn_showItem.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btn_showItem.Image = ((System.Drawing.Image)(resources.GetObject("btn_showItem.Image")));
|
||||
this.btn_showItem.ImageAlign = System.Drawing.ContentAlignment.BottomCenter;
|
||||
this.btn_showItem.Location = new System.Drawing.Point(103, -1);
|
||||
this.btn_showItem.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.btn_showItem.Name = "btn_showItem";
|
||||
this.btn_showItem.Size = new System.Drawing.Size(17, 20);
|
||||
this.btn_showItem.TabIndex = 12;
|
||||
this.btn_showItem.UseVisualStyleBackColor = false;
|
||||
this.btn_showItem.Click += new System.EventHandler(this.btn_showItem_Click);
|
||||
//
|
||||
// CComboBox
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.btn_showItem);
|
||||
this.Controls.Add(this.lbl_line);
|
||||
this.Controls.Add(this.cbx_item);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.Name = "CComboBox";
|
||||
this.Size = new System.Drawing.Size(120, 22);
|
||||
this.Enter += new System.EventHandler(this.ComboBox_Enter);
|
||||
this.Leave += new System.EventHandler(this.ComboBox_Leave);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ComboBox cbx_item;
|
||||
private System.Windows.Forms.Label lbl_line;
|
||||
private System.Windows.Forms.Button btn_showItem;
|
||||
}
|
||||
}
|
||||
128
UsingControl/Controls/CComboBox.resx
Normal file
@@ -0,0 +1,128 @@
|
||||
<?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>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="btn_showItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAABGdBTUEAALGPC/xhBQAAADlJREFUKFNj
|
||||
6OrqMuju7q7HhkFyYAWdnZ0fgPR/ZAwVM2AAARADWRGKJAzAFGGVhAGQBE5JWgEGBgBpDD29jSJy5QAA
|
||||
AABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
77
UsingControl/Controls/CNumeric.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Controls
|
||||
{
|
||||
public partial class CNumeric : UserControl
|
||||
{
|
||||
public CNumeric()
|
||||
{
|
||||
InitializeComponent();
|
||||
tbx_value.Text = _value.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 值改变事件
|
||||
/// </summary>
|
||||
public event DValueChanged ValueChanged;
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
private string _value = string.Empty;
|
||||
public string Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
tbx_value.Text = value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void tbx_value_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
/*只能数字键、退格键、负号、小数点*/
|
||||
if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8 &&
|
||||
(int)e.KeyChar != 45 && (int)e.KeyChar != 46) e.Handled = true;
|
||||
/*输入为负号和小数点时,且只能输入一次(负号只能最前面输入,小数点不可最前面输入)*/
|
||||
if (e.KeyChar == 45 && (((TextBox)sender).SelectionStart != 0 ||
|
||||
((TextBox)sender).Text.IndexOf("-") >= 0)) e.Handled = true;
|
||||
if (e.KeyChar == 46 && (((TextBox)sender).SelectionStart == 0 ||
|
||||
((TextBox)sender).Text.IndexOf(".") >= 0)) e.Handled = true;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
private void Numeric_Enter(object sender, EventArgs e)
|
||||
{
|
||||
lbl_line.Height = 2;
|
||||
lbl_line.BackColor = Color.FromArgb(18, 150, 219);
|
||||
}
|
||||
private void Numeric_Leave(object sender, EventArgs e)
|
||||
{
|
||||
lbl_line.Height = 1;
|
||||
lbl_line.BackColor = Color.Gray;
|
||||
}
|
||||
private void tbx_value_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (tbx_value.Text != string.Empty && tbx_value.Text != Value.ToString())
|
||||
Value = tbx_value.Text;
|
||||
if (ValueChanged != null)
|
||||
ValueChanged(Convert.ToDouble(Value));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
79
UsingControl/Controls/CNumeric.designer.cs
generated
Normal file
@@ -0,0 +1,79 @@
|
||||
namespace Controls
|
||||
{
|
||||
partial class CNumeric
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lbl_line = new System.Windows.Forms.Label();
|
||||
this.tbx_value = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lbl_line
|
||||
//
|
||||
this.lbl_line.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lbl_line.BackColor = System.Drawing.Color.Gray;
|
||||
this.lbl_line.Location = new System.Drawing.Point(0, 20);
|
||||
this.lbl_line.Name = "lbl_line";
|
||||
this.lbl_line.Size = new System.Drawing.Size(120, 1);
|
||||
this.lbl_line.TabIndex = 8;
|
||||
//
|
||||
// tbx_value
|
||||
//
|
||||
this.tbx_value.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tbx_value.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.tbx_value.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.tbx_value.Location = new System.Drawing.Point(3, 0);
|
||||
this.tbx_value.Name = "tbx_value";
|
||||
this.tbx_value.Size = new System.Drawing.Size(114, 16);
|
||||
this.tbx_value.TabIndex = 9;
|
||||
this.tbx_value.TextChanged += new System.EventHandler(this.tbx_value_TextChanged);
|
||||
this.tbx_value.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbx_value_KeyPress);
|
||||
//
|
||||
// CNumeric
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.tbx_value);
|
||||
this.Controls.Add(this.lbl_line);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "CNumeric";
|
||||
this.Size = new System.Drawing.Size(121, 22);
|
||||
this.Enter += new System.EventHandler(this.Numeric_Enter);
|
||||
this.Leave += new System.EventHandler(this.Numeric_Leave);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label lbl_line;
|
||||
private System.Windows.Forms.TextBox tbx_value;
|
||||
}
|
||||
}
|
||||
120
UsingControl/Controls/CNumeric.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>
|
||||
193
UsingControl/Controls/CNumericUpDown.cs
Normal file
@@ -0,0 +1,193 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Text.RegularExpressions;
|
||||
using Controls.Properties;
|
||||
|
||||
namespace Controls
|
||||
{
|
||||
public delegate void DValueChanged(double value);
|
||||
public partial class CNumericUpDown : UserControl
|
||||
{
|
||||
public CNumericUpDown()
|
||||
{
|
||||
InitializeComponent();
|
||||
nud_value.Text = Value.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 值改变事件
|
||||
/// </summary>
|
||||
public event DValueChanged ValueChanged;
|
||||
/// <summary>
|
||||
/// 点击一下值的变化量
|
||||
/// </summary>
|
||||
private decimal _incremeent = 1;
|
||||
public decimal Incremeent
|
||||
{
|
||||
get { return _incremeent; }
|
||||
set { _incremeent = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 小数位数
|
||||
/// </summary>
|
||||
private int _decimalPlaces = 0;
|
||||
public int DecimalPlaces
|
||||
{
|
||||
get { return _decimalPlaces; }
|
||||
set
|
||||
{
|
||||
_decimalPlaces = value;
|
||||
nud_value.DecimalPlaces = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 最小值
|
||||
/// </summary>
|
||||
private decimal _minValue = 0;
|
||||
public decimal MinValue
|
||||
{
|
||||
get { return _minValue; }
|
||||
set
|
||||
{
|
||||
_minValue = value;
|
||||
nud_value.Minimum = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 最大值
|
||||
/// </summary>
|
||||
private decimal _maxValue = 100;
|
||||
public decimal MaxValue
|
||||
{
|
||||
get { return _maxValue; }
|
||||
set
|
||||
{
|
||||
_maxValue = value;
|
||||
nud_value.Maximum = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
private double _value = 0;
|
||||
public double Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
nud_value.Text = value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void btn_add_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
btn_add.BringToFront();
|
||||
if (nud_value.Value < MaxValue)
|
||||
{
|
||||
btn_add.FlatAppearance.MouseDownBackColor = Color.Gray;
|
||||
btn_add.FlatAppearance.MouseOverBackColor = Color.DarkGray;
|
||||
btn_add.Image = Resources.blueAdd;
|
||||
}
|
||||
else
|
||||
{
|
||||
btn_add.FlatAppearance.MouseDownBackColor = Color.White;
|
||||
btn_add.FlatAppearance.MouseOverBackColor = Color.White;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
private void btn_add_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
btn_add.Image = Resources.grayAdd;
|
||||
}
|
||||
private void btn_sub_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
btn_sub.BringToFront();
|
||||
if (nud_value.Value >= MinValue)
|
||||
{
|
||||
btn_sub.FlatAppearance.MouseDownBackColor = Color.Gray;
|
||||
btn_sub.FlatAppearance.MouseOverBackColor = Color.DarkGray;
|
||||
btn_sub.Image = Resources.blueSub;
|
||||
}
|
||||
else
|
||||
{
|
||||
btn_sub.FlatAppearance.MouseDownBackColor = Color.White;
|
||||
btn_sub.FlatAppearance.MouseOverBackColor = Color.White;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
private void btn_add_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (nud_value.Value + Incremeent <= MaxValue)
|
||||
nud_value.Text = (nud_value.Value + Incremeent).ToString();
|
||||
|
||||
if (nud_value.Value >= MaxValue)
|
||||
{
|
||||
btn_add.FlatAppearance.MouseDownBackColor = Color.White;
|
||||
btn_add.FlatAppearance.MouseOverBackColor = Color.White;
|
||||
btn_add.Image = Resources.grayAdd;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
private void btn_sub_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (nud_value.Value + Incremeent > MinValue)
|
||||
nud_value.Text = (nud_value.Value - Incremeent).ToString();
|
||||
|
||||
if (nud_value.Value <= MinValue)
|
||||
{
|
||||
btn_sub.FlatAppearance.MouseDownBackColor = Color.White;
|
||||
btn_sub.FlatAppearance.MouseOverBackColor = Color.White;
|
||||
btn_sub.Image = Resources.graySub;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
private void nud_value_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
Value = (double)nud_value.Value;
|
||||
if (ValueChanged != null)
|
||||
ValueChanged(Value);
|
||||
}
|
||||
private void UserControl1_Leave(object sender, EventArgs e)
|
||||
{
|
||||
lbl_line.Height = 1;
|
||||
lbl_line.BackColor = Color.Gray;
|
||||
}
|
||||
private void UserControl1_Enter(object sender, EventArgs e)
|
||||
{
|
||||
lbl_line.Height = 2;
|
||||
lbl_line.BackColor = Color.FromArgb(18, 150, 219);
|
||||
}
|
||||
private void btn_sub_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
btn_sub.Image = Resources.graySub;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
133
UsingControl/Controls/CNumericUpDown.designer.cs
generated
Normal file
@@ -0,0 +1,133 @@
|
||||
namespace Controls
|
||||
{
|
||||
partial class CNumericUpDown
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btn_add = new System.Windows.Forms.Button();
|
||||
this.btn_sub = new System.Windows.Forms.Button();
|
||||
this.lbl_line = new System.Windows.Forms.Label();
|
||||
this.nud_value = new System.Windows.Forms.NumericUpDown();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nud_value)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btn_add
|
||||
//
|
||||
this.btn_add.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_add.BackColor = System.Drawing.Color.White;
|
||||
this.btn_add.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||
this.btn_add.FlatAppearance.BorderSize = 0;
|
||||
this.btn_add.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Gray;
|
||||
this.btn_add.FlatAppearance.MouseOverBackColor = System.Drawing.Color.DarkGray;
|
||||
this.btn_add.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btn_add.Image = global::Controls.Properties.Resources.grayAdd;
|
||||
this.btn_add.Location = new System.Drawing.Point(119, 0);
|
||||
this.btn_add.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
|
||||
this.btn_add.Name = "btn_add";
|
||||
this.btn_add.Size = new System.Drawing.Size(20, 23);
|
||||
this.btn_add.TabIndex = 7;
|
||||
this.btn_add.TabStop = false;
|
||||
this.btn_add.UseVisualStyleBackColor = false;
|
||||
this.btn_add.Click += new System.EventHandler(this.btn_add_Click);
|
||||
this.btn_add.MouseEnter += new System.EventHandler(this.btn_add_MouseEnter);
|
||||
this.btn_add.MouseLeave += new System.EventHandler(this.btn_add_MouseLeave);
|
||||
//
|
||||
// btn_sub
|
||||
//
|
||||
this.btn_sub.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_sub.BackColor = System.Drawing.Color.White;
|
||||
this.btn_sub.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||
this.btn_sub.FlatAppearance.BorderSize = 0;
|
||||
this.btn_sub.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Gray;
|
||||
this.btn_sub.FlatAppearance.MouseOverBackColor = System.Drawing.Color.DarkGray;
|
||||
this.btn_sub.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btn_sub.Image = global::Controls.Properties.Resources.graySub;
|
||||
this.btn_sub.Location = new System.Drawing.Point(101, 0);
|
||||
this.btn_sub.Margin = new System.Windows.Forms.Padding(14, 20, 14, 20);
|
||||
this.btn_sub.Name = "btn_sub";
|
||||
this.btn_sub.Size = new System.Drawing.Size(20, 23);
|
||||
this.btn_sub.TabIndex = 6;
|
||||
this.btn_sub.TabStop = false;
|
||||
this.btn_sub.UseVisualStyleBackColor = false;
|
||||
this.btn_sub.Click += new System.EventHandler(this.btn_sub_Click);
|
||||
this.btn_sub.MouseEnter += new System.EventHandler(this.btn_sub_MouseEnter);
|
||||
this.btn_sub.MouseLeave += new System.EventHandler(this.btn_sub_MouseLeave);
|
||||
//
|
||||
// lbl_line
|
||||
//
|
||||
this.lbl_line.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lbl_line.BackColor = System.Drawing.Color.Gray;
|
||||
this.lbl_line.Location = new System.Drawing.Point(3, 24);
|
||||
this.lbl_line.Name = "lbl_line";
|
||||
this.lbl_line.Size = new System.Drawing.Size(137, 1);
|
||||
this.lbl_line.TabIndex = 5;
|
||||
//
|
||||
// nud_value
|
||||
//
|
||||
this.nud_value.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.nud_value.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.nud_value.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.nud_value.Location = new System.Drawing.Point(6, 4);
|
||||
this.nud_value.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.nud_value.Name = "nud_value";
|
||||
this.nud_value.Size = new System.Drawing.Size(130, 19);
|
||||
this.nud_value.TabIndex = 8;
|
||||
this.nud_value.ValueChanged += new System.EventHandler(this.nud_value_ValueChanged);
|
||||
//
|
||||
// CNumericUpDown
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.btn_add);
|
||||
this.Controls.Add(this.btn_sub);
|
||||
this.Controls.Add(this.lbl_line);
|
||||
this.Controls.Add(this.nud_value);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.MaximumSize = new System.Drawing.Size(300, 26);
|
||||
this.MinimumSize = new System.Drawing.Size(50, 26);
|
||||
this.Name = "CNumericUpDown";
|
||||
this.Size = new System.Drawing.Size(140, 26);
|
||||
this.Enter += new System.EventHandler(this.UserControl1_Enter);
|
||||
this.Leave += new System.EventHandler(this.UserControl1_Leave);
|
||||
((System.ComponentModel.ISupportInitialize)(this.nud_value)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btn_add;
|
||||
private System.Windows.Forms.Button btn_sub;
|
||||
private System.Windows.Forms.Label lbl_line;
|
||||
private System.Windows.Forms.NumericUpDown nud_value;
|
||||
}
|
||||
}
|
||||
120
UsingControl/Controls/CNumericUpDown.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>
|
||||
75
UsingControl/Controls/CRadioBox.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Controls.Properties;
|
||||
|
||||
namespace Controls
|
||||
{
|
||||
public partial class CRadioBox : UserControl
|
||||
{
|
||||
public CRadioBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
ckb_box.Text = TextStr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 状态改变事件
|
||||
/// </summary>
|
||||
public event DCheckChanged CheckChanged;
|
||||
/// <summary>
|
||||
/// 勾选状态
|
||||
/// </summary>
|
||||
private bool _checked = false;
|
||||
public bool Checked
|
||||
{
|
||||
get { return _checked; }
|
||||
set
|
||||
{
|
||||
_checked = value;
|
||||
ckb_box.Checked = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 文本
|
||||
/// </summary>
|
||||
private string _textStr = "复选框";
|
||||
public string TextStr
|
||||
{
|
||||
get { return _textStr; }
|
||||
set
|
||||
{
|
||||
_textStr = value;
|
||||
ckb_box.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void pic_image_Click(object sender, EventArgs e)
|
||||
{
|
||||
ckb_box.Checked = !ckb_box.Checked;
|
||||
}
|
||||
private void ckb_box_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (ckb_box.Checked)
|
||||
{
|
||||
pic_image.Image = Resources.勾选;
|
||||
Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
pic_image.Image = Resources.去勾选;
|
||||
Checked = false;
|
||||
}
|
||||
if (CheckChanged != null)
|
||||
CheckChanged(ckb_box.Checked);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
86
UsingControl/Controls/CRadioBox.designer.cs
generated
Normal file
@@ -0,0 +1,86 @@
|
||||
namespace Controls
|
||||
{
|
||||
partial class CRadioBox
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CRadioBox));
|
||||
this.pic_image = new System.Windows.Forms.PictureBox();
|
||||
this.ckb_box = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pic_image)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pic_image
|
||||
//
|
||||
this.pic_image.Image = ((System.Drawing.Image)(resources.GetObject("pic_image.Image")));
|
||||
this.pic_image.Location = new System.Drawing.Point(2, 2);
|
||||
this.pic_image.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.pic_image.Name = "pic_image";
|
||||
this.pic_image.Padding = new System.Windows.Forms.Padding(1);
|
||||
this.pic_image.Size = new System.Drawing.Size(20, 20);
|
||||
this.pic_image.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pic_image.TabIndex = 0;
|
||||
this.pic_image.TabStop = false;
|
||||
this.pic_image.Click += new System.EventHandler(this.pic_image_Click);
|
||||
//
|
||||
// ckb_box
|
||||
//
|
||||
this.ckb_box.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ckb_box.BackColor = System.Drawing.Color.White;
|
||||
this.ckb_box.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.ckb_box.Location = new System.Drawing.Point(7, 4);
|
||||
this.ckb_box.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.ckb_box.Name = "ckb_box";
|
||||
this.ckb_box.Size = new System.Drawing.Size(91, 23);
|
||||
this.ckb_box.TabIndex = 1;
|
||||
this.ckb_box.Text = "复选框";
|
||||
this.ckb_box.UseVisualStyleBackColor = false;
|
||||
this.ckb_box.CheckedChanged += new System.EventHandler(this.ckb_box_CheckedChanged);
|
||||
//
|
||||
// RadioBox
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.pic_image);
|
||||
this.Controls.Add(this.ckb_box);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "RadioBox";
|
||||
this.Size = new System.Drawing.Size(97, 24);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pic_image)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox pic_image;
|
||||
private System.Windows.Forms.CheckBox ckb_box;
|
||||
}
|
||||
}
|
||||
157
UsingControl/Controls/CRadioBox.resx
Normal file
@@ -0,0 +1,157 @@
|
||||
<?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>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="pic_image.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAABGdBTUEAALGPC/xhBQAAByJJREFUeF7t
|
||||
netRJTcQhQnBITgEMrAzWDJYMoAMzL8t4AdkgDMwGUAGOAOTAWSwPofq67rIgouk1nPOqfrqsgsjtdSt
|
||||
x0iauUeSJEmSJEmSJElr6+bm5perq6vfYvz48eNX+zNpVtGJ5tCzy8vLG3w+4PMffP5M5AXw2pvr6+s/
|
||||
8LMCZESxRcNB38zZT+a8algw3eHzuwKik6yVn4HqDj8EA8KC79jMk2qILZ2tDvwVOmEgGJBntNXMlkpl
|
||||
rf0OcEyOVfqo3GmIKNCe42OVOxMPmKP8bsWSDmkhx4coEA7JbrdilbcMnDBqjhCILYOz6ViFLcoLJ7RW
|
||||
/O3KZvYjz+pr87DZiSJbPSpgtpl9DdgbnFi1bENbGOtT4dzAqmddsctHYR/Cwov/eFp2SEDhjlnAvcKK
|
||||
OBwW11pWZoGsYLECi/+zThBospcN6+zUqnFOsQB7BRJ5zBkEMJzdfqxAIp25ggAGa8z3ZZ45AQ01g2MF
|
||||
EfmMHwS2tLulNf3WvAy9kQQDtchTnwer7rGEln8RMVZUgHVt1T6G7F4/aqyoA+vcqr+vbH1fk772jDEf
|
||||
QHe05f383vSdD8D5JxGjREPoA3NHW+mWbwzogy5DATLWrH8Q6AtzSxvZ0e2oMaIPTQ+SIOL+jBkh0kA9
|
||||
vuLzFpzyto7g/05Yv/a76HUxeI25p67U+n2gwz4bu+32+jG87jOa9AI0PJa5SOLL27v42y8HQfVeQK3f
|
||||
haS9fdZ5ynBQtRdQ6y8m62BHSr3jb+vcEdiYpCXffLJP9dCpkfQ+4sUu8xUS1vm+TODAc6vGLOH61BVX
|
||||
/yNkSFR7/Rmw+7YqzFZiD0Du7VIfafKXh4fzKaYTS/8zXJeHkSAXK6IZiThezqeQVvKeC64pGnbeCQnq
|
||||
ka4EnJ1/HsvjCzxaEmWy2X8sAxHB0/k29GbfebkMA0hIs/8v4ul8a3hFPS/sKT8rwELFEhfvGc35xq0l
|
||||
mS8UTIc+DjCo88mTJZsn3f4dZmDnv1E0D9Bx788Z3fmk6Pg4CqhjXx8wg/ON/GVhXOy2AIQKe2WlgXPA
|
||||
Uy8MrqQDD6PAclgVFauy82lr/u4gEvBy0P1H+9R2DOrvyDWj4rbOXtv5Rv6CEC4u3v79amvh38WuHwkG
|
||||
atGkak+NnE/y7wQiiaWS1FpGDgJP51NIs9nuqmWZrlhiKeQcTxoxCCo4v+nb0C3bNDmsAWSPlSMFwezO
|
||||
J5Z1mkrXAFBxRWfTRgiCFZxPstYCegcA1TMIVnE+6RUALvfKPYJgJeeTLgEA3F5g0DIIVnM+6RUALsMA
|
||||
RYfQMbE8PFnR+aRbABgu77arHQSrOp9kBQAu9HrVq9tQUCsIVna+kdcIIwnl8jRqEGzA+f1WAgNGDILn
|
||||
1Z1PzLx04eLnMLFChgkCXMsnbt3evYu0hnQ+MRPThYtr7Nd3D4ItOR8UbQfXeiKoWxBszPksb/6CHC6u
|
||||
eSSseRBszfmEPjRz0+W4FvARzYJgi84nKHf+wyGNjoVXD4KtOt8oKzcS8L4TiFH2AMOekNaxOfwt7S07
|
||||
n2U3s/OFRFptxNxZlsVCWm9BsGXnG+UHWFGJLV8I7RoExP5ZLNpmNk4DfFf+jgCOq7HEK+IWBF6iTYGN
|
||||
U5BzJjMqRFLyYkshwwQBbQlsm4VnK0K52JVEMqhN9yCgDYFN0wCfuT291PMp4W5BwLwDW2bDbf7zJiTY
|
||||
6zm+5kHAPAMbZsOv+98JifZ8VUyzIGBeQd7T4TL7D9XhbiCkehAwjyDPKXGb/YfixCKWYUOqBQHTDvKa
|
||||
Fd+3hO6r42RwH/cgYJpBHtOSdQA0RQP0AsQtCJhWkPbM+Lwc8jMN0guQ4iBgGkGaU1O99e+EzO7DzDuR
|
||||
HQS8Nkhrduq3/p0G6gXIQ8p5ArubWc357Vr/TpgLjPQGsRfYc/Dki51wavFalqZwXmZFbCdrSS0Oi6Tw
|
||||
hMr4vt8jsLeC47/hd0t+4QXK+5rSA7qKrS5mlGiK/9fDpAgGTPmuv0VoN/H7SOx+2A1FjBMVsTr33fHL
|
||||
lU2uooaKOnD4teofQzBI7xVuR/n3ANQQgqD10bHNwTq26h5Pg94aLgPH/WpbvV6Coe8ezBA+WJ2OMek7
|
||||
JBqqIPBjKufvBKO1SORH38WeXNHwoCAinTmdvxPXCDQcpGN1Nrfzd0JBNCdIYMox/5BYIAXBYZZ0/k62
|
||||
TqDNo4957La121KIci0bB7BOrHq2IRSYXx23+SGBddD8ONcosrOFWx4SttHlHxJ7A1TGlvYQnllmK75E
|
||||
2QSx1osphwGOv1Cr/0QcFlBJIzx95ArLNPxO3khaJRDk+ELNGAiw9+2LsuV4R9kc4RQVO/KpIz4yd6ox
|
||||
vrLYslDRtyMEA20A52rtnbTXM3CYqH4raUHH4DtRSx9QbIm2Bc1X2/G28hE/56w4Mph47QXTYppy+AKi
|
||||
E+nMGHKwJEmSJEmSJEmr6+joX4ihrIv2m0xeAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
190
UsingControl/Controls/CTextBox.cs
Normal file
@@ -0,0 +1,190 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Controls.Properties;
|
||||
|
||||
namespace Controls
|
||||
{
|
||||
public delegate void DTextStrChanged(string textStr);
|
||||
public partial class CTextBox : UserControl
|
||||
{
|
||||
public CTextBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
tbx_text.Text = DefaultText;
|
||||
//if (PasswordChar && tbx_text.Text != DefaultText)
|
||||
//{
|
||||
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
|
||||
//}
|
||||
//if (PasswordChar)
|
||||
//{
|
||||
// tbx_text.PasswordChar = '*';
|
||||
// btn_eye.Visible = true;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
if (!PasswordChar)
|
||||
{
|
||||
tbx_text.PasswordChar = '\0';
|
||||
btn_eye.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
tbx_text.PasswordChar = '\0';
|
||||
btn_eye.Visible = true ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文本改变事件
|
||||
/// </summary>
|
||||
public event DTextStrChanged TextStrChanged;
|
||||
/// <summary>
|
||||
/// 控件文本
|
||||
/// </summary>
|
||||
private string _text = string.Empty;
|
||||
public string TextStr
|
||||
{
|
||||
get
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == string.Empty)
|
||||
{
|
||||
tbx_text.PasswordChar = '\0';
|
||||
tbx_text.ForeColor = Color.DarkGray;
|
||||
tbx_text.Text = DefaultText;
|
||||
_text = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PasswordChar)
|
||||
tbx_text.PasswordChar = '*';
|
||||
else
|
||||
tbx_text.PasswordChar = '\0';
|
||||
tbx_text.ForeColor = Color.FromArgb(64, 64, 64);
|
||||
_text = value;
|
||||
tbx_text.Text = _text;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 默认文本
|
||||
/// </summary>
|
||||
private string _defaultText = string.Empty;
|
||||
public string DefaultText
|
||||
{
|
||||
get { return _defaultText; }
|
||||
set { _defaultText = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否以密码形式显示
|
||||
/// </summary>
|
||||
private bool _passwordChar = false;
|
||||
public bool PasswordChar
|
||||
{
|
||||
get { return _passwordChar; }
|
||||
set
|
||||
{
|
||||
_passwordChar = value;
|
||||
if (PasswordChar)
|
||||
{
|
||||
tbx_text.PasswordChar = '*';
|
||||
}
|
||||
else
|
||||
{
|
||||
tbx_text.PasswordChar = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void TextBox_Enter(object sender, EventArgs e)
|
||||
{
|
||||
lbl_line.Height = 2;
|
||||
lbl_line.BackColor = Color.FromArgb(18, 150, 219);
|
||||
if (tbx_text.Text == DefaultText)
|
||||
{
|
||||
tbx_text.SelectionStart = 0;
|
||||
tbx_text.SelectionLength = 0;
|
||||
}
|
||||
}
|
||||
private void TextBox_Leave(object sender, EventArgs e)
|
||||
{
|
||||
lbl_line.Height = 1;
|
||||
lbl_line.BackColor = Color.Gray;
|
||||
}
|
||||
private void tbx_text_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (tbx_text.Text != DefaultText && tbx_text.Text != TextStr)
|
||||
TextStr = tbx_text.Text;
|
||||
if (TextStrChanged != null)
|
||||
TextStrChanged(TextStr);
|
||||
if (PasswordChar && TextStr != string.Empty)
|
||||
tbx_text.PasswordChar = '*';
|
||||
else if (TextStr ==string .Empty )
|
||||
tbx_text.PasswordChar = '\0';
|
||||
}
|
||||
private void tbx_text_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (tbx_text.Text == DefaultText && e.KeyCode != Keys.Back)
|
||||
tbx_text.Text = string.Empty;
|
||||
}
|
||||
private void tbx_text_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (tbx_text.Text == DefaultText)
|
||||
{
|
||||
tbx_text.SelectionStart = 0;
|
||||
tbx_text.SelectionLength = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void btn_eye_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
tbx_text.PasswordChar = '\0';
|
||||
btn_eye.BackgroundImage = Resources.Show;
|
||||
//tbx_text.Width = tbx_text.Width - 30;
|
||||
}
|
||||
private void btn_eye_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (TextStr != string.Empty)
|
||||
tbx_text.PasswordChar = '*';
|
||||
btn_eye.BackgroundImage = Resources.Hide;
|
||||
tbx_text.Width = tbx_text.Width + 30;
|
||||
tbx_text.Focus();
|
||||
tbx_text.SelectionStart = 0;
|
||||
tbx_text.SelectionLength = 0;
|
||||
}
|
||||
private void TextBox_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!PasswordChar)
|
||||
{
|
||||
tbx_text.PasswordChar = '\0';
|
||||
btn_eye.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
tbx_text.PasswordChar = '\0';
|
||||
btn_eye.Visible = true ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
108
UsingControl/Controls/CTextBox.designer.cs
generated
Normal file
@@ -0,0 +1,108 @@
|
||||
namespace Controls
|
||||
{
|
||||
partial class CTextBox
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CTextBox));
|
||||
this.lbl_line = new System.Windows.Forms.Label();
|
||||
this.tbx_text = new System.Windows.Forms.TextBox();
|
||||
this.btn_eye = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lbl_line
|
||||
//
|
||||
this.lbl_line.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lbl_line.BackColor = System.Drawing.Color.Gray;
|
||||
this.lbl_line.Location = new System.Drawing.Point(2, 20);
|
||||
this.lbl_line.Name = "lbl_line";
|
||||
this.lbl_line.Size = new System.Drawing.Size(133, 1);
|
||||
this.lbl_line.TabIndex = 10;
|
||||
//
|
||||
// tbx_text
|
||||
//
|
||||
this.tbx_text.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tbx_text.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.tbx_text.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.tbx_text.Location = new System.Drawing.Point(6, 1);
|
||||
this.tbx_text.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
|
||||
this.tbx_text.Name = "tbx_text";
|
||||
this.tbx_text.Size = new System.Drawing.Size(125, 16);
|
||||
this.tbx_text.TabIndex = 9;
|
||||
this.tbx_text.TextChanged += new System.EventHandler(this.tbx_text_TextChanged);
|
||||
this.tbx_text.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbx_text_KeyDown);
|
||||
this.tbx_text.MouseUp += new System.Windows.Forms.MouseEventHandler(this.tbx_text_MouseUp);
|
||||
//
|
||||
// btn_eye
|
||||
//
|
||||
this.btn_eye.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_eye.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btn_eye.BackgroundImage")));
|
||||
this.btn_eye.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||
this.btn_eye.FlatAppearance.BorderSize = 0;
|
||||
this.btn_eye.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btn_eye.Location = new System.Drawing.Point(110, 1);
|
||||
this.btn_eye.Name = "btn_eye";
|
||||
this.btn_eye.Size = new System.Drawing.Size(21, 18);
|
||||
this.btn_eye.TabIndex = 11;
|
||||
this.btn_eye.TabStop = false;
|
||||
this.btn_eye.UseVisualStyleBackColor = true;
|
||||
this.btn_eye.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btn_eye_MouseDown);
|
||||
this.btn_eye.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btn_eye_MouseUp);
|
||||
//
|
||||
// CTextBox
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.btn_eye);
|
||||
this.Controls.Add(this.lbl_line);
|
||||
this.Controls.Add(this.tbx_text);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.MaximumSize = new System.Drawing.Size(400, 22);
|
||||
this.MinimumSize = new System.Drawing.Size(20, 22);
|
||||
this.Name = "CTextBox";
|
||||
this.Size = new System.Drawing.Size(137, 22);
|
||||
this.Load += new System.EventHandler(this.TextBox_Load);
|
||||
this.Enter += new System.EventHandler(this.TextBox_Enter);
|
||||
this.Leave += new System.EventHandler(this.TextBox_Leave);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label lbl_line;
|
||||
private System.Windows.Forms.TextBox tbx_text;
|
||||
private System.Windows.Forms.Button btn_eye;
|
||||
}
|
||||
}
|
||||
131
UsingControl/Controls/CTextBox.resx
Normal file
@@ -0,0 +1,131 @@
|
||||
<?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>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="btn_eye.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABGdBTUEAALGPC/xhBQAAAPxJREFUOE/N
|
||||
kj0KwlAQhHMEj+ARvIDghfIH3sLG0sqktBcsxc5KCVjYKIhIbAQjgrZ+89zEKNhnYNid3XlvN494zUIU
|
||||
RR1LHX71X8gYhuGD2LaSh76geya/EQTBAMNaOaYW+Ym4iuN4TJyhb6pbPxWVOyDaGM5wS54rJy5KWk+c
|
||||
owvf97t2tJq2gXu26EvDFL2EE2nVyXfkB2k7+l7FGtVqaH2nq8Op1TVEvs/aKuhmkzJpXWdQlHYNYBsc
|
||||
TTrDkIImuRcmH5lOYA7Li8q3GUlXoDClWcgoExxCt4HpRBfKZ0e+YY+VYXgSr/Bei1n90/4Coyb1aqx+
|
||||
mCbA816Kvb06q+4cHAAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
178
UsingControl/Controls/Controls.csproj
Normal file
@@ -0,0 +1,178 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{6D2088CB-161B-47FB-9C35-0EE8DE61A3DF}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Controls</RootNamespace>
|
||||
<AssemblyName>Controls</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CButton.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CButton.Designer.cs">
|
||||
<DependentUpon>CButton.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CCheckBox.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CCheckBox.designer.cs">
|
||||
<DependentUpon>CCheckBox.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CComboBox.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CComboBox.designer.cs">
|
||||
<DependentUpon>CComboBox.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CNumeric.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CNumeric.designer.cs">
|
||||
<DependentUpon>CNumeric.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CNumericUpDown.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CNumericUpDown.designer.cs">
|
||||
<DependentUpon>CNumericUpDown.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CRadioBox.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CRadioBox.designer.cs">
|
||||
<DependentUpon>CRadioBox.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CTextBox.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CTextBox.designer.cs">
|
||||
<DependentUpon>CTextBox.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="CButton.resx">
|
||||
<DependentUpon>CButton.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="CCheckBox.resx">
|
||||
<DependentUpon>CCheckBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="CComboBox.resx">
|
||||
<DependentUpon>CComboBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="CNumeric.resx">
|
||||
<DependentUpon>CNumeric.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="CNumericUpDown.resx">
|
||||
<DependentUpon>CNumericUpDown.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="CRadioBox.resx">
|
||||
<DependentUpon>CRadioBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="CTextBox.resx">
|
||||
<DependentUpon>CTextBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\复选框.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\去复选框.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\勾选.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\去勾选.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\grayAdd.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\blueSub.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\graySub.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\blueAdd.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\BlueImage.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\GrayImage.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Hide.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Show.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\ButtonDown.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\ButtonEnter.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\ButtonUp.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
36
UsingControl/Controls/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Controls")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Controls")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("2eb3123a-4223-4587-83e5-2b1cf8508df3")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
213
UsingControl/Controls/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,213 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Controls.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Controls.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用此强类型资源类,为所有资源查找
|
||||
/// 重写当前线程的 CurrentUICulture 属性。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap blueAdd {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("blueAdd", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap BlueImage {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("BlueImage", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap blueSub {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("blueSub", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ButtonDown {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ButtonDown", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ButtonEnter {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ButtonEnter", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ButtonUp {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ButtonUp", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap grayAdd {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("grayAdd", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap GrayImage {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("GrayImage", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap graySub {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("graySub", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Hide {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Hide", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Show {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Show", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap 勾选 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("勾选", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap 去勾选 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("去勾选", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap 去复选框 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("去复选框", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap 复选框 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("复选框", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
166
UsingControl/Controls/Properties/Resources.resx
Normal file
@@ -0,0 +1,166 @@
|
||||
<?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>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="blueAdd" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\blueAdd.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="BlueImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\BlueImage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="blueSub" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\blueSub.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="grayAdd" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\grayAdd.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="GrayImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\GrayImage.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="graySub" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\graySub.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Hide" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Hide.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Show" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Show.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="勾选" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\勾选.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="去勾选" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\去勾选.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="去复选框" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\去复选框.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="复选框" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\复选框.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ButtonDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ButtonDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ButtonEnter" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ButtonEnter.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ButtonUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ButtonUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
UsingControl/Controls/Resources/BlueImage.png
Normal file
|
After Width: | Height: | Size: 142 B |
BIN
UsingControl/Controls/Resources/ButtonDown.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
UsingControl/Controls/Resources/ButtonEnter.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
UsingControl/Controls/Resources/ButtonUp.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
UsingControl/Controls/Resources/GrayImage.png
Normal file
|
After Width: | Height: | Size: 143 B |
BIN
UsingControl/Controls/Resources/Hide.png
Normal file
|
After Width: | Height: | Size: 430 B |
BIN
UsingControl/Controls/Resources/Show.png
Normal file
|
After Width: | Height: | Size: 491 B |
BIN
UsingControl/Controls/Resources/blueAdd.png
Normal file
|
After Width: | Height: | Size: 100 B |
BIN
UsingControl/Controls/Resources/blueSub.png
Normal file
|
After Width: | Height: | Size: 95 B |
BIN
UsingControl/Controls/Resources/grayAdd.png
Normal file
|
After Width: | Height: | Size: 99 B |
BIN
UsingControl/Controls/Resources/graySub.png
Normal file
|
After Width: | Height: | Size: 95 B |
BIN
UsingControl/Controls/Resources/勾选.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
UsingControl/Controls/Resources/去勾选.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
UsingControl/Controls/Resources/去复选框.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
UsingControl/Controls/Resources/复选框.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
73
UsingControl/HZHControls/Colors/BasisColors.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="BasisColors.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class BasisColors.
|
||||
/// </summary>
|
||||
public class BasisColors
|
||||
{
|
||||
/// <summary>
|
||||
/// The light
|
||||
/// </summary>
|
||||
private static Color light = ColorTranslator.FromHtml("#f5f7fa");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the light.
|
||||
/// </summary>
|
||||
/// <value>The light.</value>
|
||||
public static Color Light
|
||||
{
|
||||
get { return light; }
|
||||
internal set { light = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The medium
|
||||
/// </summary>
|
||||
private static Color medium = ColorTranslator.FromHtml("#f0f2f5");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the medium.
|
||||
/// </summary>
|
||||
/// <value>The medium.</value>
|
||||
public static Color Medium
|
||||
{
|
||||
get { return medium; }
|
||||
internal set { medium = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The dark
|
||||
/// </summary>
|
||||
private static Color dark = ColorTranslator.FromHtml("#000000");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the dark.
|
||||
/// </summary>
|
||||
/// <value>The dark.</value>
|
||||
public static Color Dark
|
||||
{
|
||||
get { return dark; }
|
||||
internal set { dark = value; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
86
UsingControl/HZHControls/Colors/BorderColors.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="BorderColors.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class BorderColors.
|
||||
/// </summary>
|
||||
public class BorderColors
|
||||
{
|
||||
/// <summary>
|
||||
/// The green
|
||||
/// </summary>
|
||||
private static Color green = ColorTranslator.FromHtml("#f0f9ea");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the green.
|
||||
/// </summary>
|
||||
/// <value>The green.</value>
|
||||
public static Color Green
|
||||
{
|
||||
get { return green; }
|
||||
internal set { green = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The blue
|
||||
/// </summary>
|
||||
private static Color blue = ColorTranslator.FromHtml("#ecf5ff");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the blue.
|
||||
/// </summary>
|
||||
/// <value>The blue.</value>
|
||||
public static Color Blue
|
||||
{
|
||||
get { return blue; }
|
||||
internal set { blue = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The red
|
||||
/// </summary>
|
||||
private static Color red = ColorTranslator.FromHtml("#fef0f0");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the red.
|
||||
/// </summary>
|
||||
/// <value>The red.</value>
|
||||
public static Color Red
|
||||
{
|
||||
get { return red; }
|
||||
internal set { red = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The yellow
|
||||
/// </summary>
|
||||
private static Color yellow = ColorTranslator.FromHtml("#fdf5e6");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the yellow.
|
||||
/// </summary>
|
||||
/// <value>The yellow.</value>
|
||||
public static Color Yellow
|
||||
{
|
||||
get { return yellow; }
|
||||
internal set { yellow = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
203
UsingControl/HZHControls/Colors/ColorEnums.cs
Normal file
@@ -0,0 +1,203 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="ColorEnums.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum BasisColorsTypes
|
||||
/// </summary>
|
||||
public enum BasisColorsTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The light
|
||||
/// </summary>
|
||||
Light = 1,
|
||||
/// <summary>
|
||||
/// The medium
|
||||
/// </summary>
|
||||
Medium = 2,
|
||||
/// <summary>
|
||||
/// The dark
|
||||
/// </summary>
|
||||
Dark = 3
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum BorderColorsTypes
|
||||
/// </summary>
|
||||
public enum BorderColorsTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The green
|
||||
/// </summary>
|
||||
Green = 1,
|
||||
/// <summary>
|
||||
/// The blue
|
||||
/// </summary>
|
||||
Blue = 2,
|
||||
/// <summary>
|
||||
/// The red
|
||||
/// </summary>
|
||||
Red = 3,
|
||||
/// <summary>
|
||||
/// The yellow
|
||||
/// </summary>
|
||||
Yellow = 4
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum GradientColorsTypes
|
||||
/// </summary>
|
||||
public enum GradientColorsTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The orange
|
||||
/// </summary>
|
||||
Orange = 1,
|
||||
/// <summary>
|
||||
/// The light green
|
||||
/// </summary>
|
||||
LightGreen = 2,
|
||||
/// <summary>
|
||||
/// The green
|
||||
/// </summary>
|
||||
Green = 3,
|
||||
/// <summary>
|
||||
/// The blue
|
||||
/// </summary>
|
||||
Blue = 4,
|
||||
/// <summary>
|
||||
/// The blue green
|
||||
/// </summary>
|
||||
BlueGreen = 5,
|
||||
/// <summary>
|
||||
/// The light violet
|
||||
/// </summary>
|
||||
LightViolet = 6,
|
||||
/// <summary>
|
||||
/// The violet
|
||||
/// </summary>
|
||||
Violet = 7,
|
||||
/// <summary>
|
||||
/// The gray
|
||||
/// </summary>
|
||||
Gray = 8
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum LineColorsTypes
|
||||
/// </summary>
|
||||
public enum LineColorsTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The more light
|
||||
/// </summary>
|
||||
MoreLight = 1,
|
||||
/// <summary>
|
||||
/// The light
|
||||
/// </summary>
|
||||
Light = 2,
|
||||
/// <summary>
|
||||
/// The dark
|
||||
/// </summary>
|
||||
Dark = 3,
|
||||
/// <summary>
|
||||
/// The more dark
|
||||
/// </summary>
|
||||
MoreDark = 4
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum StatusColorsTypes
|
||||
/// </summary>
|
||||
public enum StatusColorsTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The primary
|
||||
/// </summary>
|
||||
Primary = 1,
|
||||
/// <summary>
|
||||
/// The success
|
||||
/// </summary>
|
||||
Success = 2,
|
||||
/// <summary>
|
||||
/// The warning
|
||||
/// </summary>
|
||||
Warning = 3,
|
||||
/// <summary>
|
||||
/// The danger
|
||||
/// </summary>
|
||||
Danger = 4,
|
||||
/// <summary>
|
||||
/// The information
|
||||
/// </summary>
|
||||
Info = 5
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum TableColorsTypes
|
||||
/// </summary>
|
||||
public enum TableColorsTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The green
|
||||
/// </summary>
|
||||
Green = 1,
|
||||
/// <summary>
|
||||
/// The blue
|
||||
/// </summary>
|
||||
Blue = 2,
|
||||
/// <summary>
|
||||
/// The red
|
||||
/// </summary>
|
||||
Red = 3,
|
||||
/// <summary>
|
||||
/// The yellow
|
||||
/// </summary>
|
||||
Yellow = 4,
|
||||
/// <summary>
|
||||
/// The gray
|
||||
/// </summary>
|
||||
Gray = 5
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum TextColorsTypes
|
||||
/// </summary>
|
||||
public enum TextColorsTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The more light
|
||||
/// </summary>
|
||||
MoreLight = 1,
|
||||
/// <summary>
|
||||
/// The light
|
||||
/// </summary>
|
||||
Light = 2,
|
||||
/// <summary>
|
||||
/// The dark
|
||||
/// </summary>
|
||||
Dark = 3,
|
||||
/// <summary>
|
||||
/// The more dark
|
||||
/// </summary>
|
||||
MoreDark = 4
|
||||
}
|
||||
}
|
||||
264
UsingControl/HZHControls/Colors/ColorExt.cs
Normal file
@@ -0,0 +1,264 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="ColorExt.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ColorExt.
|
||||
/// </summary>
|
||||
public static class ColorExt
|
||||
{
|
||||
#region 重置内置的颜色 English:Reset color
|
||||
/// <summary>
|
||||
/// Resets the color.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="light">The light.</param>
|
||||
/// <param name="medium">The medium.</param>
|
||||
/// <param name="dark">The dark.</param>
|
||||
public static void ResetColor(
|
||||
this BasisColors type,
|
||||
Color light,
|
||||
Color medium,
|
||||
Color dark)
|
||||
{
|
||||
BasisColors.Light = light;
|
||||
BasisColors.Medium = medium;
|
||||
BasisColors.Dark = dark;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the color.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="green">The green.</param>
|
||||
/// <param name="blue">The blue.</param>
|
||||
/// <param name="red">The red.</param>
|
||||
/// <param name="yellow">The yellow.</param>
|
||||
public static void ResetColor(
|
||||
this BorderColors type,
|
||||
Color green,
|
||||
Color blue,
|
||||
Color red,
|
||||
Color yellow)
|
||||
{
|
||||
BorderColors.Green = green;
|
||||
BorderColors.Blue = blue;
|
||||
BorderColors.Red = red;
|
||||
BorderColors.Yellow = yellow;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the color.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="orange">The orange.</param>
|
||||
/// <param name="lightGreen">The light green.</param>
|
||||
/// <param name="green">The green.</param>
|
||||
/// <param name="blue">The blue.</param>
|
||||
/// <param name="blueGreen">The blue green.</param>
|
||||
/// <param name="lightViolet">The light violet.</param>
|
||||
/// <param name="violet">The violet.</param>
|
||||
/// <param name="gray">The gray.</param>
|
||||
public static void ResetColor(
|
||||
this GradientColors type,
|
||||
Color[] orange,
|
||||
Color[] lightGreen,
|
||||
Color[] green,
|
||||
Color[] blue,
|
||||
Color[] blueGreen,
|
||||
Color[] lightViolet,
|
||||
Color[] violet,
|
||||
Color[] gray
|
||||
)
|
||||
{
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.Orange = orange;
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.LightGreen = lightGreen;
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.Green = green;
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.Blue = blue;
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.BlueGreen = blueGreen;
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.LightViolet = lightViolet;
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.Violet = violet;
|
||||
if (orange != null && orange.Length == 2)
|
||||
GradientColors.Gray = gray;
|
||||
}
|
||||
/// <summary>
|
||||
/// Resets the color.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="moreLight">The more light.</param>
|
||||
/// <param name="light">The light.</param>
|
||||
/// <param name="dark">The dark.</param>
|
||||
/// <param name="moreDark">The more dark.</param>
|
||||
public static void ResetColor(
|
||||
this LineColors type,
|
||||
Color moreLight,
|
||||
Color light,
|
||||
Color dark,
|
||||
Color moreDark)
|
||||
{
|
||||
LineColors.MoreLight = moreLight;
|
||||
LineColors.Light = light;
|
||||
LineColors.Dark = dark;
|
||||
LineColors.MoreDark = moreDark;
|
||||
}
|
||||
/// <summary>
|
||||
/// Resets the color.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="primary">The primary.</param>
|
||||
/// <param name="success">The success.</param>
|
||||
/// <param name="warning">The warning.</param>
|
||||
/// <param name="danger">The danger.</param>
|
||||
/// <param name="info">The information.</param>
|
||||
public static void ResetColor(
|
||||
this StatusColors type,
|
||||
Color primary,
|
||||
Color success,
|
||||
Color warning,
|
||||
Color danger,
|
||||
Color info
|
||||
)
|
||||
{
|
||||
StatusColors.Primary = primary;
|
||||
StatusColors.Success = success;
|
||||
StatusColors.Warning = warning;
|
||||
StatusColors.Danger = danger;
|
||||
StatusColors.Info = info;
|
||||
}
|
||||
/// <summary>
|
||||
/// Resets the color.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="green">The green.</param>
|
||||
/// <param name="blue">The blue.</param>
|
||||
/// <param name="red">The red.</param>
|
||||
/// <param name="yellow">The yellow.</param>
|
||||
/// <param name="gray">The gray.</param>
|
||||
public static void ResetColor(
|
||||
this TableColors type,
|
||||
Color green,
|
||||
Color blue,
|
||||
Color red,
|
||||
Color yellow,
|
||||
Color gray
|
||||
)
|
||||
{
|
||||
TableColors.Green = green;
|
||||
TableColors.Blue = blue;
|
||||
TableColors.Red = red;
|
||||
TableColors.Yellow = yellow;
|
||||
TableColors.Gray = gray;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the color.
|
||||
/// </summary>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="moreLight">The more light.</param>
|
||||
/// <param name="light">The light.</param>
|
||||
/// <param name="dark">The dark.</param>
|
||||
/// <param name="moreDark">The more dark.</param>
|
||||
public static void ResetColor(
|
||||
this TextColors type,
|
||||
Color moreLight,
|
||||
Color light,
|
||||
Color dark,
|
||||
Color moreDark)
|
||||
{
|
||||
TextColors.MoreLight = moreLight;
|
||||
TextColors.Light = light;
|
||||
TextColors.Dark = dark;
|
||||
TextColors.MoreDark = moreDark;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取一个内置颜色 English:Get a built-in color
|
||||
/// <summary>
|
||||
/// 功能描述:获取一个内置颜色 English:Get a built-in color
|
||||
/// 作 者:HZH
|
||||
/// 创建日期:2019-09-30 11:08:04
|
||||
/// 任务编号:POS
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="t">t</param>
|
||||
/// <returns>颜色列表</returns>
|
||||
public static Color[] GetInternalColor<T>(T t)
|
||||
{
|
||||
Type type = null;
|
||||
if (t is BasisColorsTypes)
|
||||
{
|
||||
type = typeof(BasisColors);
|
||||
}
|
||||
else if (t is BorderColorsTypes)
|
||||
{
|
||||
type = typeof(BorderColors);
|
||||
}
|
||||
else if (t is GradientColorsTypes)
|
||||
{
|
||||
type = typeof(GradientColors);
|
||||
}
|
||||
else if (t is LineColorsTypes)
|
||||
{
|
||||
type = typeof(LineColors);
|
||||
}
|
||||
else if (t is StatusColorsTypes)
|
||||
{
|
||||
type = typeof(StatusColors);
|
||||
}
|
||||
else if (t is TableColorsTypes)
|
||||
{
|
||||
type = typeof(TableColors);
|
||||
}
|
||||
else if (t is TextColorsTypes)
|
||||
{
|
||||
type = typeof(TextColors);
|
||||
}
|
||||
if (type == null)
|
||||
return new Color[] { Color.Empty };
|
||||
else
|
||||
{
|
||||
string strName = t.ToString();
|
||||
var pi = type.GetProperty(strName);
|
||||
if (pi == null)
|
||||
return new Color[] { Color.Empty };
|
||||
else
|
||||
{
|
||||
var c = pi.GetValue(null, null);
|
||||
if (c == null)
|
||||
return new Color[] { Color.Empty };
|
||||
else if (c is Color[])
|
||||
return (Color[])c;
|
||||
else
|
||||
return new Color[] { (Color)c };
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
142
UsingControl/HZHControls/Colors/GradientColors.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="GradientColors.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class GradientColors.
|
||||
/// </summary>
|
||||
public class GradientColors
|
||||
{
|
||||
/// <summary>
|
||||
/// The orange
|
||||
/// </summary>
|
||||
private static Color[] orange = new Color[] { Color.FromArgb(252, 196, 136), Color.FromArgb(243, 138, 159) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the orange.
|
||||
/// </summary>
|
||||
/// <value>The orange.</value>
|
||||
public static Color[] Orange
|
||||
{
|
||||
get { return GradientColors.orange; }
|
||||
internal set { GradientColors.orange = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The light green
|
||||
/// </summary>
|
||||
private static Color[] lightGreen = new Color[] { Color.FromArgb(210, 251, 123), Color.FromArgb(152, 231, 160) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the light green.
|
||||
/// </summary>
|
||||
/// <value>The light green.</value>
|
||||
public static Color[] LightGreen
|
||||
{
|
||||
get { return GradientColors.lightGreen; }
|
||||
internal set { GradientColors.lightGreen = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The green
|
||||
/// </summary>
|
||||
private static Color[] green = new Color[] { Color.FromArgb(138, 241, 124), Color.FromArgb(32, 190, 179) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the green.
|
||||
/// </summary>
|
||||
/// <value>The green.</value>
|
||||
public static Color[] Green
|
||||
{
|
||||
get { return GradientColors.green; }
|
||||
internal set { GradientColors.green = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The blue
|
||||
/// </summary>
|
||||
private static Color[] blue = new Color[] { Color.FromArgb(193, 232, 251), Color.FromArgb(162, 197, 253) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the blue.
|
||||
/// </summary>
|
||||
/// <value>The blue.</value>
|
||||
public static Color[] Blue
|
||||
{
|
||||
get { return GradientColors.blue; }
|
||||
internal set { GradientColors.blue = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The blue green
|
||||
/// </summary>
|
||||
private static Color[] blueGreen = new Color[] { Color.FromArgb(122, 251, 218), Color.FromArgb(16, 193, 252) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the blue green.
|
||||
/// </summary>
|
||||
/// <value>The blue green.</value>
|
||||
public static Color[] BlueGreen
|
||||
{
|
||||
get { return GradientColors.blueGreen; }
|
||||
internal set { GradientColors.blueGreen = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The light violet
|
||||
/// </summary>
|
||||
private static Color[] lightViolet = new Color[] { Color.FromArgb(248, 192, 234), Color.FromArgb(164, 142, 210) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the light violet.
|
||||
/// </summary>
|
||||
/// <value>The light violet.</value>
|
||||
public static Color[] LightViolet
|
||||
{
|
||||
get { return GradientColors.lightViolet; }
|
||||
internal set { GradientColors.lightViolet = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The violet
|
||||
/// </summary>
|
||||
private static Color[] violet = new Color[] { Color.FromArgb(185, 154, 241), Color.FromArgb(137, 124, 242) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the violet.
|
||||
/// </summary>
|
||||
/// <value>The violet.</value>
|
||||
public static Color[] Violet
|
||||
{
|
||||
get { return GradientColors.violet; }
|
||||
internal set { GradientColors.violet = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The gray
|
||||
/// </summary>
|
||||
private static Color[] gray = new Color[] { Color.FromArgb(233, 238, 239), Color.FromArgb(147, 162, 175) };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the gray.
|
||||
/// </summary>
|
||||
/// <value>The gray.</value>
|
||||
public static Color[] Gray
|
||||
{
|
||||
get { return GradientColors.gray; }
|
||||
internal set { GradientColors.gray = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
86
UsingControl/HZHControls/Colors/LineColors.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="LineColors.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class LineColors.
|
||||
/// </summary>
|
||||
public class LineColors
|
||||
{
|
||||
/// <summary>
|
||||
/// The more light
|
||||
/// </summary>
|
||||
private static Color _MoreLight = ColorTranslator.FromHtml("#f2f6fc");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the more light.
|
||||
/// </summary>
|
||||
/// <value>The more light.</value>
|
||||
public static Color MoreLight
|
||||
{
|
||||
get { return _MoreLight; }
|
||||
internal set { _MoreLight = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The light
|
||||
/// </summary>
|
||||
private static Color _Light = ColorTranslator.FromHtml("#ebeef5");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the light.
|
||||
/// </summary>
|
||||
/// <value>The light.</value>
|
||||
public static Color Light
|
||||
{
|
||||
get { return _Light; }
|
||||
internal set { _Light = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The dark
|
||||
/// </summary>
|
||||
private static Color _Dark = ColorTranslator.FromHtml("#e4e7ed");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the dark.
|
||||
/// </summary>
|
||||
/// <value>The dark.</value>
|
||||
public static Color Dark
|
||||
{
|
||||
get { return _Dark; }
|
||||
internal set { _Dark = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The more dark
|
||||
/// </summary>
|
||||
private static Color _MoreDark = ColorTranslator.FromHtml("#dcdfe6");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the more dark.
|
||||
/// </summary>
|
||||
/// <value>The more dark.</value>
|
||||
public static Color MoreDark
|
||||
{
|
||||
get { return _MoreDark; }
|
||||
internal set { _MoreDark = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
100
UsingControl/HZHControls/Colors/StatusColors.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="StatusColors.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// 状态颜色
|
||||
/// </summary>
|
||||
public class StatusColors
|
||||
{
|
||||
/// <summary>
|
||||
/// The primary
|
||||
/// </summary>
|
||||
private static Color _Primary = ColorTranslator.FromHtml("#409eff");
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the primary.
|
||||
/// </summary>
|
||||
/// <value>The primary.</value>
|
||||
public static Color Primary
|
||||
{
|
||||
get { return _Primary; }
|
||||
internal set { _Primary = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The success
|
||||
/// </summary>
|
||||
private static Color _Success = ColorTranslator.FromHtml("#67c23a");
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the success.
|
||||
/// </summary>
|
||||
/// <value>The success.</value>
|
||||
public static Color Success
|
||||
{
|
||||
get { return _Success; }
|
||||
internal set { _Success = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The warning
|
||||
/// </summary>
|
||||
private static Color _Warning = ColorTranslator.FromHtml("#e6a23c");
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the warning.
|
||||
/// </summary>
|
||||
/// <value>The warning.</value>
|
||||
public static Color Warning
|
||||
{
|
||||
get { return _Warning; }
|
||||
internal set { _Warning = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The danger
|
||||
/// </summary>
|
||||
private static Color _Danger = ColorTranslator.FromHtml("#f56c6c");
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the danger.
|
||||
/// </summary>
|
||||
/// <value>The danger.</value>
|
||||
public static Color Danger
|
||||
{
|
||||
get { return _Danger; }
|
||||
internal set { _Danger = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The information
|
||||
/// </summary>
|
||||
private static Color _Info = ColorTranslator.FromHtml("#909399");
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the information.
|
||||
/// </summary>
|
||||
/// <value>The information.</value>
|
||||
public static Color Info
|
||||
{
|
||||
get { return _Info; }
|
||||
internal set { _Info = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
100
UsingControl/HZHControls/Colors/TableColors.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="TableColors.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class TableColors.
|
||||
/// </summary>
|
||||
public class TableColors
|
||||
{
|
||||
/// <summary>
|
||||
/// The green
|
||||
/// </summary>
|
||||
private static Color green = ColorTranslator.FromHtml("#c2e7b0");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the green.
|
||||
/// </summary>
|
||||
/// <value>The green.</value>
|
||||
public static Color Green
|
||||
{
|
||||
get { return green; }
|
||||
internal set { green = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The blue
|
||||
/// </summary>
|
||||
private static Color blue = ColorTranslator.FromHtml("#a3d0fd");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the blue.
|
||||
/// </summary>
|
||||
/// <value>The blue.</value>
|
||||
public static Color Blue
|
||||
{
|
||||
get { return blue; }
|
||||
internal set { blue = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The red
|
||||
/// </summary>
|
||||
private static Color red = ColorTranslator.FromHtml("#fbc4c4");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the red.
|
||||
/// </summary>
|
||||
/// <value>The red.</value>
|
||||
public static Color Red
|
||||
{
|
||||
get { return red; }
|
||||
internal set { red = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The yellow
|
||||
/// </summary>
|
||||
private static Color yellow = ColorTranslator.FromHtml("#f5dab1");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the yellow.
|
||||
/// </summary>
|
||||
/// <value>The yellow.</value>
|
||||
public static Color Yellow
|
||||
{
|
||||
get { return yellow; }
|
||||
internal set { yellow = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The gray
|
||||
/// </summary>
|
||||
private static Color gray = ColorTranslator.FromHtml("#d3d4d6");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the gray.
|
||||
/// </summary>
|
||||
/// <value>The gray.</value>
|
||||
public static Color Gray
|
||||
{
|
||||
get { return gray; }
|
||||
internal set { gray = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
86
UsingControl/HZHControls/Colors/TextColors.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-30
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="TextColors.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class TextColor.
|
||||
/// </summary>
|
||||
public class TextColors
|
||||
{
|
||||
/// <summary>
|
||||
/// The more light
|
||||
/// </summary>
|
||||
private static Color _MoreLight = ColorTranslator.FromHtml("#c0c4cc");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the more light.
|
||||
/// </summary>
|
||||
/// <value>The more light.</value>
|
||||
public static Color MoreLight
|
||||
{
|
||||
get { return _MoreLight; }
|
||||
internal set { _MoreLight = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The light
|
||||
/// </summary>
|
||||
private static Color _Light = ColorTranslator.FromHtml("#909399");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the light.
|
||||
/// </summary>
|
||||
/// <value>The light.</value>
|
||||
public static Color Light
|
||||
{
|
||||
get { return _Light; }
|
||||
internal set { _Light = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The dark
|
||||
/// </summary>
|
||||
private static Color _Dark = ColorTranslator.FromHtml("#606266");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the dark.
|
||||
/// </summary>
|
||||
/// <value>The dark.</value>
|
||||
public static Color Dark
|
||||
{
|
||||
get { return _Dark; }
|
||||
internal set { _Dark = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The more dark
|
||||
/// </summary>
|
||||
private static Color _MoreDark = ColorTranslator.FromHtml("#303133");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the more dark.
|
||||
/// </summary>
|
||||
/// <value>The more dark.</value>
|
||||
public static Color MoreDark
|
||||
{
|
||||
get { return _MoreDark; }
|
||||
internal set { _MoreDark = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
116
UsingControl/HZHControls/Controls/Btn/UCBtnExt.Designer.cs
generated
Normal file
@@ -0,0 +1,116 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnExt.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnExt.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
public partial class UCBtnExt
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lbl = new System.Windows.Forms.Label();
|
||||
this.lblTips = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lbl
|
||||
//
|
||||
this.lbl.BackColor = System.Drawing.Color.Transparent;
|
||||
this.lbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lbl.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.lbl.ForeColor = System.Drawing.Color.White;
|
||||
this.lbl.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.lbl.Location = new System.Drawing.Point(0, 0);
|
||||
this.lbl.Name = "lbl";
|
||||
this.lbl.Size = new System.Drawing.Size(184, 60);
|
||||
this.lbl.TabIndex = 0;
|
||||
this.lbl.Text = "自定义按钮";
|
||||
this.lbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lbl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbl_MouseDown);
|
||||
//
|
||||
// lblTips
|
||||
//
|
||||
this.lblTips.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblTips.BackColor = System.Drawing.Color.Transparent;
|
||||
this.lblTips.Font = new System.Drawing.Font("Arial Unicode MS", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.lblTips.ForeColor = System.Drawing.Color.White;
|
||||
this.lblTips.ImageIndex = 0;
|
||||
this.lblTips.Location = new System.Drawing.Point(158, 0);
|
||||
this.lblTips.Name = "lblTips";
|
||||
this.lblTips.Size = new System.Drawing.Size(24, 24);
|
||||
this.lblTips.TabIndex = 1;
|
||||
this.lblTips.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblTips.Visible = false;
|
||||
//
|
||||
// UCBtnExt
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.ConerRadius = 5;
|
||||
this.Controls.Add(this.lblTips);
|
||||
this.Controls.Add(this.lbl);
|
||||
this.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.IsRadius = true;
|
||||
this.IsShowRect = true;
|
||||
this.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.Name = "UCBtnExt";
|
||||
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(58)))));
|
||||
this.Size = new System.Drawing.Size(184, 60);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The label
|
||||
/// </summary>
|
||||
public System.Windows.Forms.Label lbl;
|
||||
/// <summary>
|
||||
/// The label tips
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Label lblTips;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
255
UsingControl/HZHControls/Controls/Btn/UCBtnExt.cs
Normal file
@@ -0,0 +1,255 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnExt.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnExt.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
[DefaultEvent("BtnClick")]
|
||||
|
||||
public partial class UCBtnExt : UCControlBase
|
||||
{
|
||||
#region 字段属性
|
||||
private bool enabledMouseEffect = false;
|
||||
[Description("是否启用鼠标效果"), Category("自定义")]
|
||||
public bool EnabledMouseEffect
|
||||
{
|
||||
get { return enabledMouseEffect; }
|
||||
set { enabledMouseEffect = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示角标
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is show tips; otherwise, <c>false</c>.</value>
|
||||
[Description("是否显示角标"), Category("自定义")]
|
||||
public bool IsShowTips
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.lblTips.Visible;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.lblTips.Visible = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 角标文字
|
||||
/// </summary>
|
||||
/// <value>The tips text.</value>
|
||||
[Description("角标文字"), Category("自定义")]
|
||||
public string TipsText
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.lblTips.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.lblTips.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The BTN back color
|
||||
/// </summary>
|
||||
private Color _btnBackColor = Color.White;
|
||||
/// <summary>
|
||||
/// 按钮背景色
|
||||
/// </summary>
|
||||
/// <value>The color of the BTN back.</value>
|
||||
[Description("按钮背景色"), Category("自定义")]
|
||||
public Color BtnBackColor
|
||||
{
|
||||
get { return _btnBackColor; }
|
||||
set
|
||||
{
|
||||
_btnBackColor = value;
|
||||
this.BackColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The BTN fore color
|
||||
/// </summary>
|
||||
private Color _btnForeColor = Color.White;
|
||||
/// <summary>
|
||||
/// 按钮字体颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the BTN fore.</value>
|
||||
[Description("按钮字体颜色"), Category("自定义")]
|
||||
public virtual Color BtnForeColor
|
||||
{
|
||||
get { return _btnForeColor; }
|
||||
set
|
||||
{
|
||||
_btnForeColor = value;
|
||||
this.lbl.ForeColor = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The BTN font
|
||||
/// </summary>
|
||||
private Font _btnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
/// <summary>
|
||||
/// 按钮字体
|
||||
/// </summary>
|
||||
/// <value>The BTN font.</value>
|
||||
[Description("按钮字体"), Category("自定义")]
|
||||
public Font BtnFont
|
||||
{
|
||||
get { return _btnFont; }
|
||||
set
|
||||
{
|
||||
_btnFont = value;
|
||||
this.lbl.Font = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按钮点击事件
|
||||
/// </summary>
|
||||
[Description("按钮点击事件"), Category("自定义")]
|
||||
public event EventHandler BtnClick;
|
||||
|
||||
/// <summary>
|
||||
/// The BTN text
|
||||
/// </summary>
|
||||
private string _btnText;
|
||||
/// <summary>
|
||||
/// 按钮文字
|
||||
/// </summary>
|
||||
/// <value>The BTN text.</value>
|
||||
[Description("按钮文字"), Category("自定义")]
|
||||
public virtual string BtnText
|
||||
{
|
||||
get { return _btnText; }
|
||||
set
|
||||
{
|
||||
_btnText = value;
|
||||
lbl.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m tips color
|
||||
/// </summary>
|
||||
private Color m_tipsColor = Color.FromArgb(232, 30, 99);
|
||||
/// <summary>
|
||||
/// 角标颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the tips.</value>
|
||||
[Description("角标颜色"), Category("自定义")]
|
||||
public Color TipsColor
|
||||
{
|
||||
get { return m_tipsColor; }
|
||||
set { m_tipsColor = value; }
|
||||
}
|
||||
[Description("鼠标效果生效时发生,需要和MouseEffected同时使用,否则无效"), Category("自定义")]
|
||||
public event EventHandler MouseEffecting;
|
||||
[Description("鼠标效果结束时发生,需要和MouseEffecting同时使用,否则无效"), Category("自定义")]
|
||||
public event EventHandler MouseEffected;
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCBtnExt" /> class.
|
||||
/// </summary>
|
||||
public UCBtnExt()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.TabStop = false;
|
||||
lblTips.Paint += lblTips_Paint;
|
||||
this.lbl.MouseEnter += lbl_MouseEnter;
|
||||
this.lbl.MouseLeave += lbl_MouseLeave;
|
||||
}
|
||||
Color m_cacheColor = Color.Empty;
|
||||
void lbl_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
if (enabledMouseEffect)
|
||||
{
|
||||
if (MouseEffecting != null && MouseEffected != null)
|
||||
{
|
||||
MouseEffected(this, e);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_cacheColor != Color.Empty)
|
||||
{
|
||||
this.FillColor = m_cacheColor;
|
||||
m_cacheColor = Color.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lbl_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
if (enabledMouseEffect)
|
||||
{
|
||||
if (MouseEffecting != null && MouseEffected != null)
|
||||
{
|
||||
MouseEffecting(this, e);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FillColor != Color.Empty && FillColor != null)
|
||||
{
|
||||
m_cacheColor = this.FillColor;
|
||||
this.FillColor = Color.FromArgb(230, this.FillColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Paint event of the lblTips control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="PaintEventArgs" /> instance containing the event data.</param>
|
||||
void lblTips_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.SetGDIHigh();
|
||||
e.Graphics.FillEllipse(new SolidBrush(m_tipsColor), new Rectangle(0, 0, lblTips.Width - 1, lblTips.Height - 1));
|
||||
System.Drawing.SizeF sizeEnd = e.Graphics.MeasureString(TipsText, lblTips.Font);
|
||||
|
||||
e.Graphics.DrawString(TipsText, lblTips.Font, new SolidBrush(lblTips.ForeColor), new PointF((lblTips.Width - sizeEnd.Width) / 2, (lblTips.Height - sizeEnd.Height) / 2 + 1));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the lbl control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
private void lbl_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (this.BtnClick != null)
|
||||
BtnClick(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
120
UsingControl/HZHControls/Controls/Btn/UCBtnExt.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>
|
||||
90
UsingControl/HZHControls/Controls/Btn/UCBtnFillet.Designer.cs
generated
Normal file
@@ -0,0 +1,90 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnFillet.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnFillet.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
partial class UCBtnFillet
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lbl = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lbl
|
||||
//
|
||||
this.lbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lbl.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.lbl.Image = global::HZH_Controls.Properties.Resources.alarm;
|
||||
this.lbl.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.lbl.Location = new System.Drawing.Point(0, 0);
|
||||
this.lbl.Name = "lbl";
|
||||
this.lbl.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0);
|
||||
this.lbl.Size = new System.Drawing.Size(120, 76);
|
||||
this.lbl.TabIndex = 0;
|
||||
this.lbl.Text = "按钮1 ";
|
||||
this.lbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.lbl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbl_MouseDown);
|
||||
//
|
||||
// UCBtnFillet
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.ConerRadius = 5;
|
||||
this.Controls.Add(this.lbl);
|
||||
this.IsShowRect = true;
|
||||
this.IsRadius = true;
|
||||
this.Name = "UCBtnFillet";
|
||||
this.Size = new System.Drawing.Size(120, 76);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The label
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Label lbl;
|
||||
}
|
||||
}
|
||||
88
UsingControl/HZHControls/Controls/Btn/UCBtnFillet.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnFillet.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnFillet.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
[DefaultEvent("BtnClick")]
|
||||
public partial class UCBtnFillet : UCControlBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 按钮点击事件
|
||||
/// </summary>
|
||||
[Description("按钮点击事件"), Category("自定义")]
|
||||
public event EventHandler BtnClick;
|
||||
/// <summary>
|
||||
/// 按钮图片
|
||||
/// </summary>
|
||||
/// <value>The BTN image.</value>
|
||||
[Description("按钮图片"), Category("自定义")]
|
||||
public Image BtnImage
|
||||
{
|
||||
get
|
||||
{
|
||||
return lbl.Image;
|
||||
}
|
||||
set
|
||||
{
|
||||
lbl.Image = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 按钮文字
|
||||
/// </summary>
|
||||
/// <value>The BTN text.</value>
|
||||
[Description("按钮文字"), Category("自定义")]
|
||||
public string BtnText
|
||||
{
|
||||
get { return lbl.Text; }
|
||||
set
|
||||
{
|
||||
lbl.Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCBtnFillet" /> class.
|
||||
/// </summary>
|
||||
public UCBtnFillet()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the lbl control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
private void lbl_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (BtnClick != null)
|
||||
BtnClick(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
120
UsingControl/HZHControls/Controls/Btn/UCBtnFillet.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>
|
||||
69
UsingControl/HZHControls/Controls/Btn/UCBtnImg.Designer.cs
generated
Normal file
@@ -0,0 +1,69 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnImg.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnImg.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCBtnExt" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCBtnExt" />
|
||||
partial class UCBtnImg
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lbl
|
||||
//
|
||||
this.lbl.Image = global::HZH_Controls.Properties.Resources.back;
|
||||
//
|
||||
// UCBtnImg
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.IsShowTips = true;
|
||||
this.Name = "UCBtnImg";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
129
UsingControl/HZHControls/Controls/Btn/UCBtnImg.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnImg.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnImg.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCBtnExt" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCBtnExt" />
|
||||
public partial class UCBtnImg : UCBtnExt
|
||||
{
|
||||
/// <summary>
|
||||
/// The BTN text
|
||||
/// </summary>
|
||||
private string _btnText = "自定义按钮";
|
||||
/// <summary>
|
||||
/// 按钮文字
|
||||
/// </summary>
|
||||
/// <value>The BTN text.</value>
|
||||
[Description("按钮文字"), Category("自定义")]
|
||||
public override string BtnText
|
||||
{
|
||||
get { return _btnText; }
|
||||
set
|
||||
{
|
||||
_btnText = value;
|
||||
lbl.Text = value;
|
||||
lbl.Refresh();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 图片
|
||||
/// </summary>
|
||||
/// <value>The image.</value>
|
||||
[Description("图片"), Category("自定义")]
|
||||
public virtual Image Image
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.lbl.Image;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.lbl.Image = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The image font icons
|
||||
/// </summary>
|
||||
private object imageFontIcons;
|
||||
/// <summary>
|
||||
/// Gets or sets the image font icons.
|
||||
/// </summary>
|
||||
/// <value>The image font icons.</value>
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
[Editor(typeof(ImagePropertyEditor), typeof(System.Drawing.Design.UITypeEditor))]
|
||||
public object ImageFontIcons
|
||||
{
|
||||
get { return imageFontIcons; }
|
||||
set
|
||||
{
|
||||
if (value == null || value is Image)
|
||||
{
|
||||
imageFontIcons = value;
|
||||
if (value != null)
|
||||
{
|
||||
Image = (Image)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片位置
|
||||
/// </summary>
|
||||
/// <value>The image align.</value>
|
||||
[Description("图片位置"), Category("自定义")]
|
||||
public virtual ContentAlignment ImageAlign
|
||||
{
|
||||
get { return this.lbl.ImageAlign; }
|
||||
set { lbl.ImageAlign = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 文字位置
|
||||
/// </summary>
|
||||
/// <value>The text align.</value>
|
||||
[Description("文字位置"), Category("自定义")]
|
||||
public virtual ContentAlignment TextAlign
|
||||
{
|
||||
get { return this.lbl.TextAlign; }
|
||||
set { lbl.TextAlign = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCBtnImg" /> class.
|
||||
/// </summary>
|
||||
public UCBtnImg()
|
||||
{
|
||||
InitializeComponent();
|
||||
IsShowTips = false;
|
||||
base.BtnForeColor = ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(102)))));
|
||||
base.BtnFont = new System.Drawing.Font("微软雅黑", 17F);
|
||||
base.BtnText = "自定义按钮";
|
||||
}
|
||||
}
|
||||
}
|
||||
120
UsingControl/HZHControls/Controls/Btn/UCBtnImg.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>
|
||||
79
UsingControl/HZHControls/Controls/Btn/UCDropDownBtn.Designer.cs
generated
Normal file
@@ -0,0 +1,79 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-27-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDropDownBtn.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDropDownBtn.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCBtnImg" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCBtnImg" />
|
||||
partial class UCDropDownBtn
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UCDropDownBtn));
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lbl
|
||||
//
|
||||
this.lbl.Font = new System.Drawing.Font("微软雅黑", 14F);
|
||||
this.lbl.ForeColor = System.Drawing.Color.White;
|
||||
this.lbl.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.lbl.ImageList = null;
|
||||
this.lbl.Text = "自定义按钮";
|
||||
this.lbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// UCDropDownBtn
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BtnFont = new System.Drawing.Font("微软雅黑", 14F);
|
||||
this.BtnForeColor = System.Drawing.Color.White;
|
||||
this.ForeColor = System.Drawing.Color.White;
|
||||
this.Image = ((System.Drawing.Image)(resources.GetObject("$this.Image")));
|
||||
this.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.Name = "UCDropDownBtn";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
211
UsingControl/HZHControls/Controls/Btn/UCDropDownBtn.cs
Normal file
@@ -0,0 +1,211 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-27-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDropDownBtn.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDropDownBtn.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCBtnImg" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCBtnImg" />
|
||||
[DefaultEvent("BtnClick")]
|
||||
public partial class UCDropDownBtn : UCBtnImg
|
||||
{
|
||||
/// <summary>
|
||||
/// The FRM anchor
|
||||
/// </summary>
|
||||
Forms.FrmAnchor _frmAnchor;
|
||||
/// <summary>
|
||||
/// The drop panel height
|
||||
/// </summary>
|
||||
private int _dropPanelHeight = -1;
|
||||
/// <summary>
|
||||
/// 按钮点击事件
|
||||
/// </summary>
|
||||
public new event EventHandler BtnClick;
|
||||
/// <summary>
|
||||
/// 下拉框高度
|
||||
/// </summary>
|
||||
/// <value>The height of the drop panel.</value>
|
||||
[Description("下拉框高度"), Category("自定义")]
|
||||
public int DropPanelHeight
|
||||
{
|
||||
get { return _dropPanelHeight; }
|
||||
set { _dropPanelHeight = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The BTNS
|
||||
/// </summary>
|
||||
private string[] btns;
|
||||
/// <summary>
|
||||
/// 需要显示的按钮文字
|
||||
/// </summary>
|
||||
/// <value>The BTNS.</value>
|
||||
[Description("需要显示的按钮文字"), Category("自定义")]
|
||||
public string[] Btns
|
||||
{
|
||||
get { return btns; }
|
||||
set { btns = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图片
|
||||
/// </summary>
|
||||
/// <value>The image.</value>
|
||||
[Obsolete("不再可用的属性")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override Image Image
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 图片位置
|
||||
/// </summary>
|
||||
/// <value>The image align.</value>
|
||||
[Obsolete("不再可用的属性")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public override ContentAlignment ImageAlign
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 按钮字体颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the BTN fore.</value>
|
||||
[Description("按钮字体颜色"), Category("自定义")]
|
||||
public override Color BtnForeColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.BtnForeColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.BtnForeColor = value;
|
||||
Bitmap bit = new Bitmap(12, 10);
|
||||
Graphics g = Graphics.FromImage(bit);
|
||||
g.SetGDIHigh();
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddLines(new Point[]
|
||||
{
|
||||
new Point(1,1),
|
||||
new Point(11,1),
|
||||
new Point(6,10),
|
||||
new Point(1,1)
|
||||
});
|
||||
g.FillPath(new SolidBrush(value), path);
|
||||
g.Dispose();
|
||||
this.lbl.Image = bit;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCDropDownBtn" /> class.
|
||||
/// </summary>
|
||||
public UCDropDownBtn()
|
||||
{
|
||||
InitializeComponent();
|
||||
IsShowTips = false;
|
||||
this.lbl.ImageAlign = ContentAlignment.MiddleRight;
|
||||
base.BtnClick += UCDropDownBtn_BtnClick;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the BtnClick event of the UCDropDownBtn control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void UCDropDownBtn_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
if (_frmAnchor == null || _frmAnchor.IsDisposed || _frmAnchor.Visible == false)
|
||||
{
|
||||
|
||||
if (Btns != null && Btns.Length > 0)
|
||||
{
|
||||
int intRow = 0;
|
||||
int intCom = 1;
|
||||
var p = this.PointToScreen(this.Location);
|
||||
while (true)
|
||||
{
|
||||
int intScreenHeight = Screen.PrimaryScreen.Bounds.Height;
|
||||
if ((p.Y + this.Height + Btns.Length / intCom * 50 < intScreenHeight || p.Y - Btns.Length / intCom * 50 > 0)
|
||||
&& (_dropPanelHeight <= 0 ? true : (Btns.Length / intCom * 50 <= _dropPanelHeight)))
|
||||
{
|
||||
intRow = Btns.Length / intCom + (Btns.Length % intCom != 0 ? 1 : 0);
|
||||
break;
|
||||
}
|
||||
intCom++;
|
||||
}
|
||||
UCTimePanel ucTime = new UCTimePanel();
|
||||
ucTime.IsShowBorder = true;
|
||||
int intWidth = this.Width / intCom;
|
||||
|
||||
Size size = new Size(intCom * intWidth, intRow * 50);
|
||||
ucTime.Size = size;
|
||||
ucTime.FirstEvent = true;
|
||||
ucTime.SelectSourceEvent += ucTime_SelectSourceEvent;
|
||||
ucTime.Row = intRow;
|
||||
ucTime.Column = intCom;
|
||||
|
||||
List<KeyValuePair<string, string>> lst = new List<KeyValuePair<string, string>>();
|
||||
foreach (var item in Btns)
|
||||
{
|
||||
lst.Add(new KeyValuePair<string, string>(item, item));
|
||||
}
|
||||
ucTime.Source = lst;
|
||||
|
||||
_frmAnchor = new Forms.FrmAnchor(this, ucTime);
|
||||
_frmAnchor.Load += (a, b) => { (a as Form).Size = size; };
|
||||
|
||||
_frmAnchor.Show(this.FindForm());
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_frmAnchor.Close();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Handles the SelectSourceEvent event of the ucTime control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void ucTime_SelectSourceEvent(object sender, EventArgs e)
|
||||
{
|
||||
if (_frmAnchor != null && !_frmAnchor.IsDisposed && _frmAnchor.Visible)
|
||||
{
|
||||
_frmAnchor.Close();
|
||||
|
||||
if (BtnClick != null)
|
||||
{
|
||||
BtnClick(sender.ToString(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
131
UsingControl/HZHControls/Controls/Btn/UCDropDownBtn.resx
Normal file
@@ -0,0 +1,131 @@
|
||||
<?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>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAA4AAAAYCAYAAADKx8xXAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAD0SURBVDhPjZLtDcIwDES9Ezt1py7AMCgrdIGKH3SC0OfE
|
||||
JZ/FJxmR+E55livP1ycua4iPJboKLxnZti0HPeFwemPc9z3KcRx68AbX04uEHw4eXB4A8wqmOcfmsvCE
|
||||
oLkoCOb/uAlT5zMxp+IOA6noQYY3x6TAnb/YYSIOXN7NaZhdkEuaoxBlmFUQcaG4g5DN14UQlzNcne+t
|
||||
uT6Ifmupq1tDK2YAqd5n+qirNbQCBdzyNea7xUQ0MZW4/O/W0Ipmu5bpGlrVc4b+a5kJk+G6ME2YbC2U
|
||||
CxNhMlzKlNtzZZ/i2hpQbt8LI6+6MU3qLpSvC4l8ASkgxV0fp9H6AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
81
UsingControl/HZHControls/Controls/BtnsGroup/UCBtnsGroup.Designer.cs
generated
Normal file
@@ -0,0 +1,81 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-15-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnsGroup.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnsGroup.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
partial class UCBtnsGroup
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(420, 50);
|
||||
this.flowLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// UCBtnsGroup
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.flowLayoutPanel1);
|
||||
this.MinimumSize = new System.Drawing.Size(0, 50);
|
||||
this.Name = "UCBtnsGroup";
|
||||
this.Size = new System.Drawing.Size(420, 50);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The flow layout panel1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
}
|
||||
}
|
||||
229
UsingControl/HZHControls/Controls/BtnsGroup/UCBtnsGroup.cs
Normal file
@@ -0,0 +1,229 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-15-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCBtnsGroup.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCBtnsGroup.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
public partial class UCBtnsGroup : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 选中改变事件
|
||||
/// </summary>
|
||||
[Description("选中改变事件"), Category("自定义")]
|
||||
public event EventHandler SelectedItemChanged;
|
||||
/// <summary>
|
||||
/// The m data source
|
||||
/// </summary>
|
||||
private Dictionary<string, string> m_dataSource = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
/// <value>The data source.</value>
|
||||
[Description("数据源"), Category("自定义")]
|
||||
public Dictionary<string, string> DataSource
|
||||
{
|
||||
get { return m_dataSource; }
|
||||
set
|
||||
{
|
||||
m_dataSource = value;
|
||||
Reload();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m select item
|
||||
/// </summary>
|
||||
private List<string> m_selectItem = new List<string>();
|
||||
/// <summary>
|
||||
/// 选中项
|
||||
/// </summary>
|
||||
/// <value>The select item.</value>
|
||||
[Description("选中项"), Category("自定义")]
|
||||
public List<string> SelectItem
|
||||
{
|
||||
get { return m_selectItem; }
|
||||
set
|
||||
{
|
||||
m_selectItem = value;
|
||||
if (m_selectItem == null)
|
||||
m_selectItem = new List<string>();
|
||||
SetSelected();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m is multiple
|
||||
/// </summary>
|
||||
private bool m_isMultiple = false;
|
||||
/// <summary>
|
||||
/// 是否多选
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is multiple; otherwise, <c>false</c>.</value>
|
||||
[Description("是否多选"), Category("自定义")]
|
||||
public bool IsMultiple
|
||||
{
|
||||
get { return m_isMultiple; }
|
||||
set { m_isMultiple = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCBtnsGroup" /> class.
|
||||
/// </summary>
|
||||
public UCBtnsGroup()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads this instance.
|
||||
/// </summary>
|
||||
private void Reload()
|
||||
{
|
||||
try
|
||||
{
|
||||
ControlHelper.FreezeControl(flowLayoutPanel1, true);
|
||||
this.flowLayoutPanel1.Controls.Clear();
|
||||
if (DataSource != null)
|
||||
{
|
||||
foreach (var item in DataSource)
|
||||
{
|
||||
UCBtnExt btn = new UCBtnExt();
|
||||
btn.BackColor = System.Drawing.Color.Transparent;
|
||||
btn.BtnBackColor = System.Drawing.Color.White;
|
||||
btn.BtnFont = new System.Drawing.Font("微软雅黑", 10F);
|
||||
btn.BtnForeColor = System.Drawing.Color.Gray;
|
||||
btn.BtnText = item.Value;
|
||||
btn.ConerRadius = 5;
|
||||
btn.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
btn.FillColor = System.Drawing.Color.White;
|
||||
btn.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
btn.IsRadius = true;
|
||||
btn.IsShowRect = true;
|
||||
btn.IsShowTips = false;
|
||||
btn.Location = new System.Drawing.Point(5, 5);
|
||||
btn.Margin = new System.Windows.Forms.Padding(5);
|
||||
btn.Name = item.Key;
|
||||
btn.RectColor = System.Drawing.Color.FromArgb(224, 224, 224);
|
||||
btn.RectWidth = 1;
|
||||
btn.Size = new System.Drawing.Size(72, 38);
|
||||
btn.TabStop = false;
|
||||
btn.BtnClick += btn_BtnClick;
|
||||
this.flowLayoutPanel1.Controls.Add(btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(flowLayoutPanel1, false);
|
||||
}
|
||||
SetSelected();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the BtnClick event of the btn control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void btn_BtnClick(object sender, EventArgs e)
|
||||
{
|
||||
var btn = sender as UCBtnExt;
|
||||
if (m_selectItem.Contains(btn.Name))
|
||||
{
|
||||
btn.RectColor = System.Drawing.Color.FromArgb(224, 224, 224);
|
||||
m_selectItem.Remove(btn.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_isMultiple)
|
||||
{
|
||||
foreach (var item in m_selectItem)
|
||||
{
|
||||
var lst = this.flowLayoutPanel1.Controls.Find(item, false);
|
||||
if (lst.Length == 1)
|
||||
{
|
||||
var _btn = lst[0] as UCBtnExt;
|
||||
_btn.RectColor = System.Drawing.Color.FromArgb(224, 224, 224);
|
||||
}
|
||||
}
|
||||
m_selectItem.Clear();
|
||||
}
|
||||
btn.RectColor = System.Drawing.Color.FromArgb(255, 77, 59);
|
||||
m_selectItem.Add(btn.Name);
|
||||
}
|
||||
if (SelectedItemChanged != null)
|
||||
SelectedItemChanged(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the selected.
|
||||
/// </summary>
|
||||
private void SetSelected()
|
||||
{
|
||||
if (m_selectItem != null && m_selectItem.Count > 0 && DataSource != null && DataSource.Count > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
ControlHelper.FreezeControl(flowLayoutPanel1, true);
|
||||
if (m_isMultiple)
|
||||
{
|
||||
foreach (var item in m_selectItem)
|
||||
{
|
||||
var lst = this.flowLayoutPanel1.Controls.Find(item, false);
|
||||
if (lst.Length == 1)
|
||||
{
|
||||
var btn = lst[0] as UCBtnExt;
|
||||
btn.RectColor = System.Drawing.Color.FromArgb(255, 77, 59);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UCBtnExt btn = null;
|
||||
foreach (var item in m_selectItem)
|
||||
{
|
||||
var lst = this.flowLayoutPanel1.Controls.Find(item, false);
|
||||
if (lst.Length == 1)
|
||||
{
|
||||
btn = lst[0] as UCBtnExt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (btn != null)
|
||||
{
|
||||
m_selectItem = new List<string>() { btn.Name };
|
||||
btn.RectColor = System.Drawing.Color.FromArgb(255, 77, 59);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(flowLayoutPanel1, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
UsingControl/HZHControls/Controls/BtnsGroup/UCBtnsGroup.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
UsingControl/HZHControls/Controls/Charts/AuxiliaryLable.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
public class AuxiliaryLable
|
||||
{
|
||||
public string Text
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Brush TextBrush
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Brush TextBack
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public float LocationX
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public AuxiliaryLable()
|
||||
{
|
||||
TextBrush = Brushes.Black;
|
||||
TextBack = Brushes.Transparent;
|
||||
LocationX = 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
122
UsingControl/HZHControls/Controls/Charts/AuxiliaryLine.cs
Normal file
@@ -0,0 +1,122 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-17
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="AuxiliaryLine.cs">
|
||||
// Copyright by Huang Zhenghui(»ÆÕý»Ô) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub£ºhttps://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee£ºhttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class AuxiliaryLine.
|
||||
/// Implements the <see cref="System.IDisposable" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.IDisposable" />
|
||||
internal class AuxiliaryLine : IDisposable
|
||||
{
|
||||
private bool disposedValue = false;
|
||||
|
||||
public float Value
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public float PaintValue
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public float PaintValueBackUp
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Color LineColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Pen PenDash
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Pen PenSolid
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public float LineThickness
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Brush LineTextBrush
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public bool IsLeftFrame
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
private bool isDashStyle = true;
|
||||
|
||||
public bool IsDashStyle
|
||||
{
|
||||
get { return isDashStyle; }
|
||||
set { isDashStyle = value; }
|
||||
}
|
||||
|
||||
|
||||
public Pen GetPen()
|
||||
{
|
||||
return IsDashStyle ? PenDash : PenSolid;
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!disposedValue)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if(PenDash==null)
|
||||
PenDash.Dispose();
|
||||
if(PenSolid==null)
|
||||
PenSolid.Dispose();
|
||||
if(LineTextBrush==null)
|
||||
LineTextBrush.Dispose();
|
||||
}
|
||||
disposedValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
public string Tip { get; set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-26
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="FunelChartAlignment.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum FunelChartAlignment
|
||||
/// </summary>
|
||||
public enum FunelChartAlignment
|
||||
{
|
||||
/// <summary>
|
||||
/// The left
|
||||
/// </summary>
|
||||
Left,
|
||||
/// <summary>
|
||||
/// The center
|
||||
/// </summary>
|
||||
Center,
|
||||
/// <summary>
|
||||
/// The right
|
||||
/// </summary>
|
||||
Right
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-26
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="FunelChartDirection.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum FunelChartDirection
|
||||
/// </summary>
|
||||
public enum FunelChartDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Up
|
||||
/// </summary>
|
||||
UP,
|
||||
/// <summary>
|
||||
/// Down
|
||||
/// </summary>
|
||||
Down
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-26
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="FunelChartItem.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class FunelChartItem.
|
||||
/// </summary>
|
||||
public class FunelChartItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the text.
|
||||
/// </summary>
|
||||
/// <value>The text.</value>
|
||||
public string Text { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public float Value { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the value.
|
||||
/// </summary>
|
||||
/// <value>The color of the value.</value>
|
||||
public System.Drawing.Color? ValueColor { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the text fore.
|
||||
/// </summary>
|
||||
/// <value>The color of the text fore.</value>
|
||||
public System.Drawing.Color? TextForeColor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,506 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-26
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCFunnelChart.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCFunnelChart.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
public class UCFunnelChart : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// The title
|
||||
/// </summary>
|
||||
private string title;
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置标题")]
|
||||
public string Title
|
||||
{
|
||||
get { return title; }
|
||||
set
|
||||
{
|
||||
title = value;
|
||||
ResetTitleSize();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The title font
|
||||
/// </summary>
|
||||
private Font titleFont = new Font("微软雅黑", 12);
|
||||
/// <summary>
|
||||
/// Gets or sets the title font.
|
||||
/// </summary>
|
||||
/// <value>The title font.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置标题字体")]
|
||||
public Font TitleFont
|
||||
{
|
||||
get { return titleFont; }
|
||||
set
|
||||
{
|
||||
titleFont = value;
|
||||
ResetTitleSize();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The title fore color
|
||||
/// </summary>
|
||||
private Color titleForeColor = Color.Black;
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the title fore.
|
||||
/// </summary>
|
||||
/// <value>The color of the title fore.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置标题文字颜色")]
|
||||
public Color TitleForeColor
|
||||
{
|
||||
get { return titleForeColor; }
|
||||
set
|
||||
{
|
||||
titleForeColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The items
|
||||
/// </summary>
|
||||
private FunelChartItem[] items;
|
||||
/// <summary>
|
||||
/// Gets or sets the items.
|
||||
/// </summary>
|
||||
/// <value>The items.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置项目")]
|
||||
public FunelChartItem[] Items
|
||||
{
|
||||
get { return items; }
|
||||
set
|
||||
{
|
||||
items = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The direction
|
||||
/// </summary>
|
||||
private FunelChartDirection direction = FunelChartDirection.UP;
|
||||
/// <summary>
|
||||
/// Gets or sets the direction.
|
||||
/// </summary>
|
||||
/// <value>The direction.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置方向")]
|
||||
public FunelChartDirection Direction
|
||||
{
|
||||
get { return direction; }
|
||||
set
|
||||
{
|
||||
direction = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The alignment
|
||||
/// </summary>
|
||||
private FunelChartAlignment alignment = FunelChartAlignment.Center;
|
||||
/// <summary>
|
||||
/// Gets or sets the alignment.
|
||||
/// </summary>
|
||||
/// <value>The alignment.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置对齐方式")]
|
||||
public FunelChartAlignment Alignment
|
||||
{
|
||||
get { return alignment; }
|
||||
set
|
||||
{
|
||||
alignment = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The item text align
|
||||
/// </summary>
|
||||
private FunelChartAlignment itemTextAlign = FunelChartAlignment.Center;
|
||||
/// <summary>
|
||||
/// Gets or sets the item text align.
|
||||
/// </summary>
|
||||
/// <value>The item text align.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置文字位置")]
|
||||
public FunelChartAlignment ItemTextAlign
|
||||
{
|
||||
get { return itemTextAlign; }
|
||||
set
|
||||
{
|
||||
itemTextAlign = value;
|
||||
ResetWorkingRect();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The show value
|
||||
/// </summary>
|
||||
private bool showValue = false;
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [show value].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [show value]; otherwise, <c>false</c>.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置是否显示值")]
|
||||
public bool ShowValue
|
||||
{
|
||||
get { return showValue; }
|
||||
set
|
||||
{
|
||||
showValue = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The value format
|
||||
/// </summary>
|
||||
private string valueFormat = "0.##";
|
||||
/// <summary>
|
||||
/// Gets or sets the value format.
|
||||
/// </summary>
|
||||
/// <value>The value format.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置值格式化")]
|
||||
public string ValueFormat
|
||||
{
|
||||
get { return valueFormat; }
|
||||
set
|
||||
{
|
||||
valueFormat = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m rect working
|
||||
/// </summary>
|
||||
RectangleF m_rectWorking;
|
||||
/// <summary>
|
||||
/// The m title size
|
||||
/// </summary>
|
||||
SizeF m_titleSize = SizeF.Empty;
|
||||
/// <summary>
|
||||
/// The int split width
|
||||
/// </summary>
|
||||
int intSplitWidth = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCFunnelChart"/> class.
|
||||
/// </summary>
|
||||
public UCFunnelChart()
|
||||
{
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
this.SetStyle(ControlStyles.Selectable, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.FontChanged += UCFunnelChart_FontChanged;
|
||||
Font = new Font("微软雅黑", 8);
|
||||
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.SizeChanged += UCFunnelChart_SizeChanged;
|
||||
Size = new System.Drawing.Size(150, 150);
|
||||
items = new FunelChartItem[0];
|
||||
if (ControlHelper.IsDesignMode())
|
||||
{
|
||||
items = new FunelChartItem[5];
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
items[i] = new FunelChartItem()
|
||||
{
|
||||
Text = "item" + i,
|
||||
Value = 10 * (i + 1)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the FontChanged event of the UCFunnelChart control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
void UCFunnelChart_FontChanged(object sender, EventArgs e)
|
||||
{
|
||||
ResetWorkingRect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the UCFunnelChart control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
void UCFunnelChart_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
ResetWorkingRect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the working rect.
|
||||
/// </summary>
|
||||
private void ResetWorkingRect()
|
||||
{
|
||||
if (itemTextAlign == FunelChartAlignment.Center)
|
||||
{
|
||||
m_rectWorking = new RectangleF(0, m_titleSize.Height == 0 ? 0 : (m_titleSize.Height + 10), this.Width, this.Height - (m_titleSize.Height == 0 ? 0 : (m_titleSize.Height + 10)));
|
||||
}
|
||||
else if (itemTextAlign == FunelChartAlignment.Left)
|
||||
{
|
||||
float fltMax = 0;
|
||||
if (items != null && items.Length > 0)
|
||||
{
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
{
|
||||
fltMax = items.Max(p => g.MeasureString(p.Text, Font).Width);
|
||||
}
|
||||
}
|
||||
m_rectWorking = new RectangleF(fltMax, m_titleSize.Height == 0 ? 0 : (m_titleSize.Height + 10), this.Width - fltMax, this.Height - (m_titleSize.Height == 0 ? 0 : (m_titleSize.Height + 10)));
|
||||
}
|
||||
else
|
||||
{
|
||||
float fltMax = 0;
|
||||
if (items != null && items.Length > 0)
|
||||
{
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
{
|
||||
fltMax = items.Max(p => g.MeasureString(p.Text, Font).Width);
|
||||
}
|
||||
}
|
||||
m_rectWorking = new RectangleF(0, m_titleSize.Height == 0 ? 0 : (m_titleSize.Height + 10), this.Width - fltMax, this.Height - (m_titleSize.Height == 0 ? 0 : (m_titleSize.Height + 10)));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the size of the title.
|
||||
/// </summary>
|
||||
private void ResetTitleSize()
|
||||
{
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
m_titleSize = SizeF.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
{
|
||||
m_titleSize = g.MeasureString(title, titleFont);
|
||||
m_titleSize.Height += 20;
|
||||
}
|
||||
}
|
||||
ResetWorkingRect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 引发 <see cref="E:System.Windows.Forms.Control.Paint" /> 事件。
|
||||
/// </summary>
|
||||
/// <param name="e">包含事件数据的 <see cref="T:System.Windows.Forms.PaintEventArgs" />。</param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
var g = e.Graphics;
|
||||
g.SetGDIHigh();
|
||||
|
||||
if (!string.IsNullOrEmpty(title))
|
||||
{
|
||||
g.DrawString(title, titleFont, new SolidBrush(titleForeColor), new RectangleF(0, 0, this.Width, m_titleSize.Height), new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
}
|
||||
|
||||
if (items == null || items.Length <= 0)
|
||||
{
|
||||
g.DrawString("没有数据", Font, new SolidBrush(Color.Black), this.m_rectWorking, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
return;
|
||||
}
|
||||
|
||||
List<FunelChartItem> lstItems;
|
||||
if (direction == FunelChartDirection.UP)
|
||||
{
|
||||
lstItems = items.OrderBy(p => p.Value).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
lstItems = items.OrderByDescending(p => p.Value).ToList();
|
||||
}
|
||||
|
||||
List<RectangleF> lstRects = new List<RectangleF>();
|
||||
List<GraphicsPath> lstPaths = new List<GraphicsPath>();
|
||||
float maxValue = lstItems.Max(p => p.Value);
|
||||
float dblSplitHeight = m_rectWorking.Height / lstItems.Count;
|
||||
for (int i = 0; i < lstItems.Count; i++)
|
||||
{
|
||||
FunelChartItem item = lstItems[i];
|
||||
if (item.ValueColor == null || item.ValueColor == Color.Empty || item.ValueColor == Color.Transparent)
|
||||
item.ValueColor = ControlHelper.Colors[i];
|
||||
|
||||
switch (alignment)
|
||||
{
|
||||
case FunelChartAlignment.Left:
|
||||
lstRects.Add(new RectangleF(m_rectWorking.Left, m_rectWorking.Top + dblSplitHeight * i, item.Value / maxValue * m_rectWorking.Width, dblSplitHeight));
|
||||
break;
|
||||
case FunelChartAlignment.Center:
|
||||
lstRects.Add(new RectangleF(m_rectWorking.Left + (m_rectWorking.Width - (item.Value / maxValue * m_rectWorking.Width)) / 2, m_rectWorking.Top + dblSplitHeight * i, item.Value / maxValue * m_rectWorking.Width, dblSplitHeight));
|
||||
break;
|
||||
case FunelChartAlignment.Right:
|
||||
lstRects.Add(new RectangleF(m_rectWorking.Right - (item.Value / maxValue * m_rectWorking.Width), m_rectWorking.Top + dblSplitHeight * i, item.Value / maxValue * m_rectWorking.Width, dblSplitHeight));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < lstRects.Count; i++)
|
||||
{
|
||||
var rect = lstRects[i];
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
List<PointF> lstPoints = new List<PointF>();
|
||||
if (direction == FunelChartDirection.UP)
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
case FunelChartAlignment.Left:
|
||||
lstPoints.Add(new PointF(rect.Left, rect.Top));
|
||||
if (i != 0)
|
||||
{
|
||||
lstPoints.Add(new PointF(lstRects[i - 1].Right, rect.Top));
|
||||
}
|
||||
break;
|
||||
case FunelChartAlignment.Center:
|
||||
if (i == 0)
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Left + rect.Width / 2, rect.Top));
|
||||
}
|
||||
else
|
||||
{
|
||||
lstPoints.Add(new PointF(lstRects[i - 1].Left, rect.Top));
|
||||
lstPoints.Add(new PointF(lstRects[i - 1].Right, rect.Top));
|
||||
}
|
||||
break;
|
||||
case FunelChartAlignment.Right:
|
||||
if (i == 0)
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Right, rect.Top));
|
||||
}
|
||||
else
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Right - lstRects[i - 1].Width, rect.Top));
|
||||
lstPoints.Add(new PointF(rect.Right, rect.Top));
|
||||
}
|
||||
break;
|
||||
}
|
||||
lstPoints.Add(new PointF(rect.Right, rect.Bottom - intSplitWidth));
|
||||
lstPoints.Add(new PointF(rect.Left, rect.Bottom - intSplitWidth));
|
||||
}
|
||||
else
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Left, rect.Top + intSplitWidth));
|
||||
lstPoints.Add(new PointF(rect.Right, rect.Top + intSplitWidth));
|
||||
switch (alignment)
|
||||
{
|
||||
case FunelChartAlignment.Left:
|
||||
if (i == lstRects.Count - 1)
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Left, rect.Bottom));
|
||||
}
|
||||
else
|
||||
{
|
||||
lstPoints.Add(new PointF(lstRects[i + 1].Right, rect.Bottom));
|
||||
lstPoints.Add(new PointF(rect.Left, rect.Bottom));
|
||||
}
|
||||
break;
|
||||
case FunelChartAlignment.Center:
|
||||
if (i == lstRects.Count - 1)
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Left + rect.Width / 2, rect.Bottom));
|
||||
}
|
||||
else
|
||||
{
|
||||
lstPoints.Add(new PointF(lstRects[i + 1].Right, rect.Bottom));
|
||||
lstPoints.Add(new PointF(lstRects[i + 1].Left, rect.Bottom));
|
||||
}
|
||||
break;
|
||||
case FunelChartAlignment.Right:
|
||||
if (i == lstRects.Count - 1)
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Right, rect.Bottom));
|
||||
}
|
||||
else
|
||||
{
|
||||
lstPoints.Add(new PointF(rect.Right, rect.Bottom));
|
||||
lstPoints.Add(new PointF(lstRects[i + 1].Left, rect.Bottom));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
path.AddLines(lstPoints.ToArray());
|
||||
path.CloseAllFigures();
|
||||
// g.DrawPath(new Pen(new SolidBrush(lstItems[i].ValueColor.Value)), path);
|
||||
g.FillPath(new SolidBrush(lstItems[i].ValueColor.Value), path);
|
||||
|
||||
//写字
|
||||
if (itemTextAlign == FunelChartAlignment.Center)
|
||||
{
|
||||
g.DrawString(lstItems[i].Text + (ShowValue ? lstItems[i].Value.ToString("\n" + valueFormat) : ""), Font, new SolidBrush((lstItems[i].TextForeColor == null || lstItems[i].TextForeColor == Color.Empty || lstItems[i].TextForeColor == Color.Transparent) ? Color.White : lstItems[i].TextForeColor.Value), rect, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
}
|
||||
else if (itemTextAlign == FunelChartAlignment.Left)
|
||||
{
|
||||
g.DrawString(lstItems[i].Text + (ShowValue ? lstItems[i].Value.ToString("\n" + valueFormat) : ""), Font, new SolidBrush((lstItems[i].TextForeColor == null || lstItems[i].TextForeColor == Color.Empty || lstItems[i].TextForeColor == Color.Transparent) ? lstItems[i].ValueColor.Value : lstItems[i].TextForeColor.Value), new RectangleF(0, rect.Top, rect.Left, rect.Height), new StringFormat() { Alignment = StringAlignment.Far, LineAlignment = StringAlignment.Center });
|
||||
g.DrawLine(new Pen(new SolidBrush((lstItems[i].TextForeColor == null || lstItems[i].TextForeColor == Color.Empty || lstItems[i].TextForeColor == Color.Transparent) ? lstItems[i].ValueColor.Value : lstItems[i].TextForeColor.Value)), rect.Left, rect.Top + rect.Height / 2, rect.Left + rect.Width / 2, rect.Top + rect.Height / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
g.DrawString(lstItems[i].Text + (ShowValue ? lstItems[i].Value.ToString("\n" + valueFormat) : ""), Font, new SolidBrush((lstItems[i].TextForeColor == null || lstItems[i].TextForeColor == Color.Empty || lstItems[i].TextForeColor == Color.Transparent) ? lstItems[i].ValueColor.Value : lstItems[i].TextForeColor.Value), new RectangleF(rect.Right, rect.Top, this.Width - rect.Right, rect.Height), new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center });
|
||||
g.DrawLine(new Pen(new SolidBrush((lstItems[i].TextForeColor == null || lstItems[i].TextForeColor == Color.Empty || lstItems[i].TextForeColor == Color.Transparent) ? lstItems[i].ValueColor.Value : lstItems[i].TextForeColor.Value)), rect.Left + rect.Width / 2, rect.Top + rect.Height / 2, rect.Right, rect.Top + rect.Height / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
113
UsingControl/HZHControls/Controls/Charts/MarkText.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-23
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="MarkText.cs">
|
||||
// Copyright by Huang Zhenghui(»ÆÕý»Ô) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub£ºhttps://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee£ºhttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System.Drawing;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class MarkText.
|
||||
/// </summary>
|
||||
public class MarkText
|
||||
{
|
||||
/// <summary>
|
||||
/// The mark text offect
|
||||
/// </summary>
|
||||
public static readonly int MarkTextOffect = 5;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the curve key.
|
||||
/// </summary>
|
||||
/// <value>The curve key.</value>
|
||||
public string CurveKey
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the index.
|
||||
/// </summary>
|
||||
/// <value>The index.</value>
|
||||
public int Index
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the mark text.
|
||||
/// </summary>
|
||||
/// <value>The mark text.</value>
|
||||
public string Text
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
private Color? textColor = null;
|
||||
|
||||
public Color? TextColor
|
||||
{
|
||||
get { return textColor; }
|
||||
set { textColor = value; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The position style
|
||||
/// </summary>
|
||||
private MarkTextPositionStyle positionStyle = MarkTextPositionStyle.Auto;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the position style.
|
||||
/// </summary>
|
||||
/// <value>The position style.</value>
|
||||
public MarkTextPositionStyle PositionStyle
|
||||
{
|
||||
get { return positionStyle; }
|
||||
set { positionStyle = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the index of the direction from data.
|
||||
/// </summary>
|
||||
/// <param name="data">The data.</param>
|
||||
/// <param name="Index">The index.</param>
|
||||
/// <returns>MarkTextPositionStyle.</returns>
|
||||
public static MarkTextPositionStyle CalculateDirectionFromDataIndex(float[] data, int Index)
|
||||
{
|
||||
float num = (Index == 0) ? data[Index] : data[Index - 1];
|
||||
float num2 = (Index == data.Length - 1) ? data[Index] : data[Index + 1];
|
||||
if (num < data[Index] && data[Index] < num2)
|
||||
{
|
||||
return MarkTextPositionStyle.Left;
|
||||
}
|
||||
if (num > data[Index] && data[Index] > num2)
|
||||
{
|
||||
return MarkTextPositionStyle.Right;
|
||||
}
|
||||
if (num <= data[Index] && data[Index] >= num2)
|
||||
{
|
||||
return MarkTextPositionStyle.Up;
|
||||
}
|
||||
if (num >= data[Index] && data[Index] <= num2)
|
||||
{
|
||||
return MarkTextPositionStyle.Down;
|
||||
}
|
||||
return MarkTextPositionStyle.Up;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
public enum MarkTextPositionStyle
|
||||
{
|
||||
Up = 1,
|
||||
Right = 2,
|
||||
Down = 4,
|
||||
Left = 8,
|
||||
Auto = 16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-25
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="RadarLine.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class RadarLine.
|
||||
/// </summary>
|
||||
public class RadarLine
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the values.
|
||||
/// </summary>
|
||||
/// <value>The values.</value>
|
||||
public double[] Values { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the line.
|
||||
/// </summary>
|
||||
/// <value>The color of the line.</value>
|
||||
public Color? LineColor { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [show value text].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [show value text]; otherwise, <c>false</c>.</value>
|
||||
public bool ShowValueText { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the fill.
|
||||
/// </summary>
|
||||
/// <value>The color of the fill.</value>
|
||||
public Color? FillColor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
public class RadarPosition
|
||||
{
|
||||
public string Text { get; set; }
|
||||
public double MaxValue { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,663 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-25
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCRadarChart.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCRadarChart.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
public class UCRadarChart : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// The split count
|
||||
/// </summary>
|
||||
private int splitCount = 5;
|
||||
/// <summary>
|
||||
/// Gets or sets the split count.
|
||||
/// </summary>
|
||||
/// <value>The split count.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置分隔份数")]
|
||||
public int SplitCount
|
||||
{
|
||||
get { return splitCount; }
|
||||
set
|
||||
{
|
||||
splitCount = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置是否使用圆代替连线进行分隔")]
|
||||
public bool UseRoundSplit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The split odd color
|
||||
/// </summary>
|
||||
private Color splitOddColor = Color.White;
|
||||
/// <summary>
|
||||
/// 分隔奇数栏背景色
|
||||
/// </summary>
|
||||
/// <value>The color of the split odd.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置分隔奇数栏背景色")]
|
||||
public Color SplitOddColor
|
||||
{
|
||||
get { return splitOddColor; }
|
||||
set
|
||||
{
|
||||
splitOddColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The split even color
|
||||
/// </summary>
|
||||
private Color splitEvenColor = Color.FromArgb(232, 232, 232);
|
||||
/// <summary>
|
||||
/// 分隔偶数栏背景色
|
||||
/// </summary>
|
||||
/// <value>The color of the split even.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置分隔偶数栏背景色")]
|
||||
public Color SplitEvenColor
|
||||
{
|
||||
get { return splitEvenColor; }
|
||||
set
|
||||
{
|
||||
splitEvenColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The line color
|
||||
/// </summary>
|
||||
private Color lineColor = Color.FromArgb(153, 153, 153);
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the line.
|
||||
/// </summary>
|
||||
/// <value>The color of the line.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置线条色")]
|
||||
public Color LineColor
|
||||
{
|
||||
get { return lineColor; }
|
||||
set
|
||||
{
|
||||
lineColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The radar positions
|
||||
/// </summary>
|
||||
private RadarPosition[] radarPositions;
|
||||
/// <summary>
|
||||
/// 节点列表,至少需要3个
|
||||
/// </summary>
|
||||
/// <value>The radar positions.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置节点,至少需要3个")]
|
||||
public RadarPosition[] RadarPositions
|
||||
{
|
||||
get { return radarPositions; }
|
||||
set
|
||||
{
|
||||
radarPositions = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The title
|
||||
/// </summary>
|
||||
private string title;
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置标题")]
|
||||
public string Title
|
||||
{
|
||||
get { return title; }
|
||||
set
|
||||
{
|
||||
title = value;
|
||||
ResetTitleSize();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The title font
|
||||
/// </summary>
|
||||
private Font titleFont = new Font("微软雅黑", 12);
|
||||
/// <summary>
|
||||
/// Gets or sets the title font.
|
||||
/// </summary>
|
||||
/// <value>The title font.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置标题字体")]
|
||||
public Font TitleFont
|
||||
{
|
||||
get { return titleFont; }
|
||||
set
|
||||
{
|
||||
titleFont = value;
|
||||
ResetTitleSize();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The title color
|
||||
/// </summary>
|
||||
private Color titleColor = Color.Black;
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the title.
|
||||
/// </summary>
|
||||
/// <value>The color of the title.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置标题文本颜色")]
|
||||
public Color TitleColor
|
||||
{
|
||||
get { return titleColor; }
|
||||
set
|
||||
{
|
||||
titleColor = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The lines
|
||||
/// </summary>
|
||||
private RadarLine[] lines;
|
||||
/// <summary>
|
||||
/// Gets or sets the lines.
|
||||
/// </summary>
|
||||
/// <value>The lines.</value>
|
||||
[Browsable(true)]
|
||||
[Category("自定义")]
|
||||
[Description("获取或设置值线条,Values长度必须与RadarPositions长度一致,否则无法显示")]
|
||||
public RadarLine[] Lines
|
||||
{
|
||||
get { return lines; }
|
||||
set
|
||||
{
|
||||
lines = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The title size
|
||||
/// </summary>
|
||||
SizeF titleSize = SizeF.Empty;
|
||||
/// <summary>
|
||||
/// The m rect working
|
||||
/// </summary>
|
||||
private RectangleF m_rectWorking = Rectangle.Empty;
|
||||
/// <summary>
|
||||
/// The line value type size
|
||||
/// </summary>
|
||||
SizeF lineValueTypeSize = SizeF.Empty;
|
||||
/// <summary>
|
||||
/// The int line value COM count
|
||||
/// </summary>
|
||||
int intLineValueComCount = 0;
|
||||
/// <summary>
|
||||
/// The int line value row count
|
||||
/// </summary>
|
||||
int intLineValueRowCount = 0;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCRadarChart"/> class.
|
||||
/// </summary>
|
||||
public UCRadarChart()
|
||||
{
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
this.SetStyle(ControlStyles.Selectable, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.SizeChanged += UCRadarChart_SizeChanged;
|
||||
Size = new System.Drawing.Size(150, 150);
|
||||
radarPositions = new RadarPosition[0];
|
||||
if (ControlHelper.IsDesignMode())
|
||||
{
|
||||
radarPositions = new RadarPosition[6];
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
radarPositions[i] = new RadarPosition
|
||||
{
|
||||
Text = "Item" + (i + 1),
|
||||
MaxValue = 100
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
lines = new RadarLine[0];
|
||||
if (ControlHelper.IsDesignMode())
|
||||
{
|
||||
Random r = new Random();
|
||||
lines = new RadarLine[2];
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
lines[i] = new RadarLine()
|
||||
{
|
||||
Name = "line" + i
|
||||
};
|
||||
lines[i].Values = new double[radarPositions.Length];
|
||||
for (int j = 0; j < radarPositions.Length; j++)
|
||||
{
|
||||
lines[i].Values[j] = r.Next(20, (int)radarPositions[j].MaxValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the UCRadarChart control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
void UCRadarChart_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
ResetWorkingRect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the working rect.
|
||||
/// </summary>
|
||||
private void ResetWorkingRect()
|
||||
{
|
||||
if (lines != null && lines.Length > 0)
|
||||
{
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
{
|
||||
foreach (var item in lines)
|
||||
{
|
||||
var s = g.MeasureString(item.Name, Font);
|
||||
if (s.Width > lineValueTypeSize.Width)
|
||||
lineValueTypeSize = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
var lineTypePanelHeight = 0f;
|
||||
if (lineValueTypeSize != SizeF.Empty)
|
||||
{
|
||||
intLineValueComCount = (int)(this.Width / (lineValueTypeSize.Width + 25));
|
||||
|
||||
intLineValueRowCount = lines.Length / intLineValueComCount;
|
||||
if (lines.Length % intLineValueComCount != 0)
|
||||
{
|
||||
intLineValueRowCount++;
|
||||
}
|
||||
lineTypePanelHeight = (lineValueTypeSize.Height + 10) * intLineValueRowCount;
|
||||
}
|
||||
var min = Math.Min(this.Width, this.Height - titleSize.Height - lineTypePanelHeight);
|
||||
var rectWorking = new RectangleF((this.Width - min) / 2 + 10, titleSize.Height + lineTypePanelHeight + 10, min - 10, min - 10);
|
||||
//处理文字
|
||||
float fltSplitAngle = 360F / radarPositions.Length;
|
||||
float fltRadiusWidth = rectWorking.Width / 2;
|
||||
float minX = rectWorking.Left;
|
||||
float maxX = rectWorking.Right;
|
||||
float minY = rectWorking.Top;
|
||||
float maxY = rectWorking.Bottom;
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
{
|
||||
PointF centrePoint = new PointF(rectWorking.Left + rectWorking.Width / 2, rectWorking.Top + rectWorking.Height / 2);
|
||||
for (int i = 0; i < radarPositions.Length; i++)
|
||||
{
|
||||
float fltAngle = 270 + fltSplitAngle * i;
|
||||
fltAngle = fltAngle % 360;
|
||||
PointF _point = GetPointByAngle(centrePoint, fltAngle, fltRadiusWidth);
|
||||
var _txtSize = g.MeasureString(radarPositions[i].Text, Font);
|
||||
if (_point.X < centrePoint.X)//左
|
||||
{
|
||||
if (_point.X - _txtSize.Width < minX)
|
||||
{
|
||||
minX = rectWorking.Left + _txtSize.Width;
|
||||
}
|
||||
}
|
||||
else//右
|
||||
{
|
||||
if (_point.X + _txtSize.Width > maxX)
|
||||
{
|
||||
maxX = rectWorking.Right - _txtSize.Width;
|
||||
}
|
||||
}
|
||||
if (_point.Y < centrePoint.Y)//上
|
||||
{
|
||||
if (_point.Y - _txtSize.Height < minY)
|
||||
{
|
||||
minY = rectWorking.Top + _txtSize.Height;
|
||||
}
|
||||
}
|
||||
else//下
|
||||
{
|
||||
if (_point.Y + _txtSize.Height > maxY)
|
||||
{
|
||||
maxY = rectWorking.Bottom - _txtSize.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
min = Math.Min(maxX - minX, maxY - minY);
|
||||
m_rectWorking = new RectangleF(minX, minY, min, min);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 引发 <see cref="E:System.Windows.Forms.Control.Paint" /> 事件。
|
||||
/// </summary>
|
||||
/// <param name="e">包含事件数据的 <see cref="T:System.Windows.Forms.PaintEventArgs" />。</param>
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
var g = e.Graphics;
|
||||
g.SetGDIHigh();
|
||||
|
||||
if (!string.IsNullOrEmpty(title))
|
||||
{
|
||||
g.DrawString(title, titleFont, new SolidBrush(titleColor), new RectangleF(m_rectWorking.Left + (m_rectWorking.Width - titleSize.Width) / 2, m_rectWorking.Top - titleSize.Height - 10 - (intLineValueRowCount * (10 + lineValueTypeSize.Height)), titleSize.Width, titleSize.Height));
|
||||
}
|
||||
|
||||
if (radarPositions.Length <= 2)
|
||||
{
|
||||
g.DrawString("至少需要3个顶点", Font, new SolidBrush(Color.Black), m_rectWorking, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
|
||||
return;
|
||||
}
|
||||
|
||||
var y = m_rectWorking.Top - 20 - (intLineValueRowCount * (10 + lineValueTypeSize.Height));
|
||||
|
||||
for (int i = 0; i < intLineValueRowCount; i++)
|
||||
{
|
||||
var x = 0f;
|
||||
int intCount = intLineValueComCount;
|
||||
if (i == intLineValueRowCount - 1)
|
||||
{
|
||||
intCount = lines.Length % intLineValueComCount;
|
||||
|
||||
}
|
||||
x = m_rectWorking.Left + (m_rectWorking.Width - intCount * (lineValueTypeSize.Width + 25)) / 2;
|
||||
|
||||
for (int j = 0; j < intCount; j++)
|
||||
{
|
||||
g.FillRectangle(new SolidBrush(lines[i * intLineValueComCount + j].LineColor.Value), new RectangleF(x + (lineValueTypeSize.Width + 25) * j, y + lineValueTypeSize.Height * i, 15, lineValueTypeSize.Height));
|
||||
g.DrawString(lines[i * intLineValueComCount + j].Name, Font, new SolidBrush(lines[i * intLineValueComCount + j].LineColor.Value), new PointF(x + (lineValueTypeSize.Width + 25) * j + 20, y + lineValueTypeSize.Height * i));
|
||||
}
|
||||
}
|
||||
|
||||
float fltSplitAngle = 360F / radarPositions.Length;
|
||||
float fltRadiusWidth = m_rectWorking.Width / 2;
|
||||
float fltSplitRadiusWidth = fltRadiusWidth / splitCount;
|
||||
PointF centrePoint = new PointF(m_rectWorking.Left + m_rectWorking.Width / 2, m_rectWorking.Top + m_rectWorking.Height / 2);
|
||||
|
||||
List<List<PointF>> lstRingPoints = new List<List<PointF>>(splitCount);
|
||||
//分割点
|
||||
for (int i = 0; i < radarPositions.Length; i++)
|
||||
{
|
||||
float fltAngle = 270 + fltSplitAngle * i;
|
||||
fltAngle = fltAngle % 360;
|
||||
for (int j = 0; j < splitCount; j++)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
lstRingPoints.Add(new List<PointF>());
|
||||
}
|
||||
PointF _point = GetPointByAngle(centrePoint, fltAngle, fltSplitRadiusWidth * (splitCount - j));
|
||||
lstRingPoints[j].Add(_point);
|
||||
}
|
||||
}
|
||||
|
||||
if (UseRoundSplit)
|
||||
{
|
||||
for (int i = 0; i < splitCount; i++)
|
||||
{
|
||||
RectangleF rect = new RectangleF(centrePoint.X - fltSplitRadiusWidth * (splitCount - i), centrePoint.Y - fltSplitRadiusWidth * (splitCount - i), fltSplitRadiusWidth * (splitCount - i) * 2, fltSplitRadiusWidth * (splitCount - i) * 2);
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
g.FillEllipse(new SolidBrush(splitOddColor), rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
g.FillEllipse(new SolidBrush(splitEvenColor), rect);
|
||||
}
|
||||
|
||||
g.DrawEllipse(new Pen(new SolidBrush(lineColor)), rect);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//间隔颜色
|
||||
for (int i = 0; i < lstRingPoints.Count; i++)
|
||||
{
|
||||
var ring = lstRingPoints[i];
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddLines(ring.ToArray());
|
||||
if ((lstRingPoints.Count - i) % 2 == 0)
|
||||
{
|
||||
g.FillPath(new SolidBrush(splitEvenColor), path);
|
||||
}
|
||||
else
|
||||
{
|
||||
g.FillPath(new SolidBrush(splitOddColor), path);
|
||||
}
|
||||
}
|
||||
//画环
|
||||
foreach (var ring in lstRingPoints)
|
||||
{
|
||||
ring.Add(ring[0]);
|
||||
g.DrawLines(new Pen(new SolidBrush(lineColor)), ring.ToArray());
|
||||
}
|
||||
}
|
||||
//分割线
|
||||
foreach (var item in lstRingPoints[0])
|
||||
{
|
||||
g.DrawLine(new Pen(new SolidBrush(lineColor)), centrePoint, item);
|
||||
}
|
||||
|
||||
//值
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
var line = lines[i];
|
||||
if (line.Values.Length != radarPositions.Length)//如果数据长度和节点长度不一致则不绘制
|
||||
continue;
|
||||
if (line.LineColor == null || line.LineColor == Color.Empty || line.LineColor == Color.Transparent)
|
||||
line.LineColor = ControlHelper.Colors[i + 13];
|
||||
List<PointF> ps = new List<PointF>();
|
||||
for (int j = 0; j < radarPositions.Length; j++)
|
||||
{
|
||||
float fltAngle = 270 + fltSplitAngle * j;
|
||||
fltAngle = fltAngle % 360;
|
||||
PointF _point = GetPointByAngle(centrePoint, fltAngle, fltRadiusWidth * (float)(line.Values[j] / radarPositions[i].MaxValue));
|
||||
ps.Add(_point);
|
||||
}
|
||||
ps.Add(ps[0]);
|
||||
if (line.FillColor != null && line.FillColor != Color.Empty && line.FillColor != Color.Transparent)
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddLines(ps.ToArray());
|
||||
g.FillPath(new SolidBrush(line.FillColor.Value), path);
|
||||
}
|
||||
g.DrawLines(new Pen(new SolidBrush(line.LineColor.Value), 2), ps.ToArray());
|
||||
|
||||
for (int j = 0; j < radarPositions.Length; j++)
|
||||
{
|
||||
var item = ps[j];
|
||||
g.FillEllipse(new SolidBrush(Color.White), new RectangleF(item.X - 3, item.Y - 3, 6, 6));
|
||||
g.DrawEllipse(new Pen(new SolidBrush(line.LineColor.Value)), new RectangleF(item.X - 3, item.Y - 3, 6, 6));
|
||||
if (line.ShowValueText)
|
||||
{
|
||||
var valueSize = g.MeasureString(line.Values[j].ToString("0.##"), Font);
|
||||
g.DrawString(line.Values[j].ToString("0.##"), Font, new SolidBrush(line.LineColor.Value), new PointF(item.X - valueSize.Width / 2, item.Y - valueSize.Height - 5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//文本
|
||||
|
||||
for (int i = 0; i < radarPositions.Length; i++)
|
||||
{
|
||||
PointF point = lstRingPoints[0][i];
|
||||
var txtSize = g.MeasureString(radarPositions[i].Text, Font);
|
||||
|
||||
if (point.X == centrePoint.X)
|
||||
{
|
||||
if (point.Y > centrePoint.Y)
|
||||
{
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X - txtSize.Width / 2, point.Y + 10));
|
||||
}
|
||||
else
|
||||
{
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X - txtSize.Width / 2, point.Y - 10 - txtSize.Height));
|
||||
}
|
||||
}
|
||||
else if (point.Y == centrePoint.Y)
|
||||
{
|
||||
if (point.X < centrePoint.X)
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X - 10 - txtSize.Width, point.Y - txtSize.Height / 2));
|
||||
else
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X + 10, point.Y - txtSize.Height / 2));
|
||||
}
|
||||
else if (point.X < centrePoint.X)//左
|
||||
{
|
||||
if (point.Y < centrePoint.Y)//左上
|
||||
{
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X - 10 - txtSize.Width, point.Y - 10 + txtSize.Height / 2));
|
||||
}
|
||||
else//左下
|
||||
{
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X - 10 - txtSize.Width, point.Y + 10 - txtSize.Height / 2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (point.Y < centrePoint.Y)//右上
|
||||
{
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X + 10, point.Y - 10 + txtSize.Height / 2));
|
||||
}
|
||||
else//右下
|
||||
{
|
||||
g.DrawString(radarPositions[i].Text, Font, new SolidBrush(ForeColor), new PointF(point.X + 10, point.Y + 10 - txtSize.Height / 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region 根据中心点、角度、半径计算圆边坐标点 English:Calculating the coordinate points of circular edge according to the center point, angle and radius
|
||||
/// <summary>
|
||||
/// 功能描述:根据中心点、角度、半径计算圆边坐标点 English:Calculating the coordinate points of circular edge according to the center point, angle and radius
|
||||
/// 作 者:HZH
|
||||
/// 创建日期:2019-09-25 09:46:32
|
||||
/// 任务编号:POS
|
||||
/// </summary>
|
||||
/// <param name="centrePoint">centrePoint</param>
|
||||
/// <param name="fltAngle">fltAngle</param>
|
||||
/// <param name="fltRadiusWidth">fltRadiusWidth</param>
|
||||
/// <returns>返回值</returns>
|
||||
private PointF GetPointByAngle(PointF centrePoint, float fltAngle, float fltRadiusWidth)
|
||||
{
|
||||
PointF p = centrePoint;
|
||||
if (fltAngle == 0)
|
||||
{
|
||||
p.X += fltRadiusWidth;
|
||||
}
|
||||
else if (fltAngle == 90)
|
||||
{
|
||||
p.Y += fltRadiusWidth;
|
||||
}
|
||||
else if (fltAngle == 180)
|
||||
{
|
||||
p.X -= fltRadiusWidth;
|
||||
}
|
||||
else if (fltAngle == 270)
|
||||
{
|
||||
p.Y -= fltRadiusWidth;
|
||||
}
|
||||
else if (fltAngle > 0 && fltAngle < 90)
|
||||
{
|
||||
p.Y += (float)Math.Sin(Math.PI * (fltAngle / 180.00F)) * fltRadiusWidth;
|
||||
p.X += (float)Math.Cos(Math.PI * (fltAngle / 180.00F)) * fltRadiusWidth;
|
||||
}
|
||||
else if (fltAngle > 90 && fltAngle < 180)
|
||||
{
|
||||
p.Y += (float)Math.Sin(Math.PI * ((180 - fltAngle) / 180.00F)) * fltRadiusWidth;
|
||||
p.X -= (float)Math.Cos(Math.PI * ((180 - fltAngle) / 180.00F)) * fltRadiusWidth;
|
||||
}
|
||||
else if (fltAngle > 180 && fltAngle < 270)
|
||||
{
|
||||
p.Y -= (float)Math.Sin(Math.PI * ((fltAngle - 180) / 180.00F)) * fltRadiusWidth;
|
||||
p.X -= (float)Math.Cos(Math.PI * ((fltAngle - 180) / 180.00F)) * fltRadiusWidth;
|
||||
}
|
||||
else if (fltAngle > 270 && fltAngle < 360)
|
||||
{
|
||||
p.Y -= (float)Math.Sin(Math.PI * ((360 - fltAngle) / 180.00F)) * fltRadiusWidth;
|
||||
p.X += (float)Math.Cos(Math.PI * ((360 - fltAngle) / 180.00F)) * fltRadiusWidth;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Resets the size of the title.
|
||||
/// </summary>
|
||||
private void ResetTitleSize()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(title))
|
||||
{
|
||||
using (Graphics g = this.CreateGraphics())
|
||||
{
|
||||
titleSize = g.MeasureString(title, titleFont);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
titleSize = SizeF.Empty;
|
||||
}
|
||||
titleSize.Height += 20;
|
||||
ResetWorkingRect();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
UsingControl/HZHControls/Controls/Charts/ZoomType.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 2019-09-17
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="ZoomType.cs">
|
||||
// Copyright by Huang Zhenghui(»ÆÕý»Ô) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub£ºhttps://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee£ºhttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum ZoomType
|
||||
/// </summary>
|
||||
public enum ZoomType
|
||||
{
|
||||
/// <summary>
|
||||
/// The none
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// The enlarge
|
||||
/// </summary>
|
||||
Enlarge,
|
||||
/// <summary>
|
||||
/// The reduce
|
||||
/// </summary>
|
||||
Reduce
|
||||
}
|
||||
}
|
||||
105
UsingControl/HZHControls/Controls/Checkbox/UCCheckBox.Designer.cs
generated
Normal file
@@ -0,0 +1,105 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCCheckBox.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCCheckBox.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
partial class UCCheckBox
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BackgroundImage = global::HZH_Controls.Properties.Resources.checkbox0;
|
||||
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.panel1.Location = new System.Drawing.Point(1, 1);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(18, 28);
|
||||
this.panel1.TabIndex = 0;
|
||||
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CheckBox_MouseDown);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(62)))), ((int)(((byte)(62)))));
|
||||
this.label1.Location = new System.Drawing.Point(19, 1);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0);
|
||||
this.label1.Size = new System.Drawing.Size(213, 28);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "复选框";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.label1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CheckBox_MouseDown);
|
||||
//
|
||||
// UCCheckBox
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "UCCheckBox";
|
||||
this.Padding = new System.Windows.Forms.Padding(1);
|
||||
this.Size = new System.Drawing.Size(233, 30);
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CheckBox_MouseDown);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The panel1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
/// <summary>
|
||||
/// The label1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
||||
216
UsingControl/HZHControls/Controls/Checkbox/UCCheckBox.cs
Normal file
@@ -0,0 +1,216 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCCheckBox.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCCheckBox.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
[DefaultEvent("CheckedChangeEvent")]
|
||||
public partial class UCCheckBox : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 选中改变事件
|
||||
/// </summary>
|
||||
[Description("选中改变事件"), Category("自定义")]
|
||||
public event EventHandler CheckedChangeEvent;
|
||||
/// <summary>
|
||||
/// 字体
|
||||
/// </summary>
|
||||
/// <value>The font.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Description("字体"), Category("自定义")]
|
||||
public override Font Font
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Font;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Font = value;
|
||||
label1.Font = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The fore color
|
||||
/// </summary>
|
||||
private Color _ForeColor = Color.FromArgb(62, 62, 62);
|
||||
/// <summary>
|
||||
/// 字体颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the fore.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Description("字体颜色"), Category("自定义")]
|
||||
public new Color ForeColor
|
||||
{
|
||||
get { return _ForeColor; }
|
||||
set
|
||||
{
|
||||
base.ForeColor = value;
|
||||
label1.ForeColor = value;
|
||||
_ForeColor = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The text
|
||||
/// </summary>
|
||||
private string _Text = "复选框";
|
||||
/// <summary>
|
||||
/// 文本
|
||||
/// </summary>
|
||||
/// <value>The text value.</value>
|
||||
[Description("文本"), Category("自定义")]
|
||||
public string TextValue
|
||||
{
|
||||
get { return _Text; }
|
||||
set
|
||||
{
|
||||
label1.Text = value;
|
||||
_Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The checked
|
||||
/// </summary>
|
||||
private bool _checked = false;
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if checked; otherwise, <c>false</c>.</value>
|
||||
[Description("是否选中"), Category("自定义")]
|
||||
public bool Checked
|
||||
{
|
||||
get
|
||||
{
|
||||
return _checked;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_checked != value)
|
||||
{
|
||||
_checked = value;
|
||||
if (base.Enabled)
|
||||
{
|
||||
if (_checked)
|
||||
{
|
||||
panel1.BackgroundImage = Properties.Resources.checkbox1;
|
||||
}
|
||||
else
|
||||
{
|
||||
panel1.BackgroundImage = Properties.Resources.checkbox0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_checked)
|
||||
{
|
||||
panel1.BackgroundImage = Properties.Resources.checkbox10;
|
||||
}
|
||||
else
|
||||
{
|
||||
panel1.BackgroundImage = Properties.Resources.checkbox00;
|
||||
}
|
||||
}
|
||||
|
||||
if (CheckedChangeEvent != null)
|
||||
{
|
||||
CheckedChangeEvent(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置一个值,该值指示控件是否可以对用户交互作出响应。
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
public new bool Enabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Enabled;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Enabled = value;
|
||||
if (value)
|
||||
{
|
||||
if (_checked)
|
||||
{
|
||||
panel1.BackgroundImage = Properties.Resources.checkbox1;
|
||||
}
|
||||
else
|
||||
{
|
||||
panel1.BackgroundImage = Properties.Resources.checkbox0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_checked)
|
||||
{
|
||||
panel1.BackgroundImage = Properties.Resources.checkbox10;
|
||||
}
|
||||
else
|
||||
{
|
||||
panel1.BackgroundImage = Properties.Resources.checkbox00;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCCheckBox" /> class.
|
||||
/// </summary>
|
||||
public UCCheckBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the CheckBox control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
private void CheckBox_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
Checked = !Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
UsingControl/HZHControls/Controls/Checkbox/UCCheckBox.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>
|
||||
147
UsingControl/HZHControls/Controls/ComboBox/UCCombox.Designer.cs
generated
Normal file
@@ -0,0 +1,147 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCCombox.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCCombox.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
partial class UCCombox
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.txtInput = new HZH_Controls.Controls.TextBoxEx();
|
||||
this.lblInput = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.panel1.BackgroundImage = global::HZH_Controls.Properties.Resources.ComboBox;
|
||||
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.panel1.Location = new System.Drawing.Point(136, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(37, 32);
|
||||
this.panel1.TabIndex = 0;
|
||||
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.click_MouseDown);
|
||||
//
|
||||
// txtInput
|
||||
//
|
||||
this.txtInput.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtInput.BackColor = System.Drawing.Color.White;
|
||||
this.txtInput.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtInput.DecLength = 2;
|
||||
this.txtInput.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtInput.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.txtInput.InputType = HZH_Controls.TextInputType.NotControl;
|
||||
this.txtInput.Location = new System.Drawing.Point(3, 4);
|
||||
this.txtInput.Margin = new System.Windows.Forms.Padding(3, 3, 10, 3);
|
||||
this.txtInput.MaxValue = new decimal(new int[] {
|
||||
1000000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtInput.MinValue = new decimal(new int[] {
|
||||
1000000,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.txtInput.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||
this.txtInput.Name = "txtInput";
|
||||
this.txtInput.OldText = null;
|
||||
this.txtInput.PromptColor = System.Drawing.Color.Silver;
|
||||
this.txtInput.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtInput.PromptText = "";
|
||||
this.txtInput.RegexPattern = "";
|
||||
this.txtInput.Size = new System.Drawing.Size(133, 24);
|
||||
this.txtInput.TabIndex = 1;
|
||||
this.txtInput.TextChanged += new System.EventHandler(this.txtInput_TextChanged);
|
||||
//
|
||||
// lblInput
|
||||
//
|
||||
this.lblInput.AutoSize = true;
|
||||
this.lblInput.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.lblInput.Location = new System.Drawing.Point(3, 6);
|
||||
this.lblInput.Name = "lblInput";
|
||||
this.lblInput.Size = new System.Drawing.Size(0, 20);
|
||||
this.lblInput.TabIndex = 2;
|
||||
this.lblInput.Visible = false;
|
||||
this.lblInput.MouseDown += new System.Windows.Forms.MouseEventHandler(this.click_MouseDown);
|
||||
//
|
||||
// UCCombox
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.ConerRadius = 5;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.txtInput);
|
||||
this.Controls.Add(this.lblInput);
|
||||
this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.IsRadius = true;
|
||||
this.IsShowRect = true;
|
||||
this.Name = "UCCombox";
|
||||
this.Size = new System.Drawing.Size(173, 32);
|
||||
this.Load += new System.EventHandler(this.UCComboBox_Load);
|
||||
this.SizeChanged += new System.EventHandler(this.UCComboBox_SizeChanged);
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.click_MouseDown);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The panel1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
/// <summary>
|
||||
/// The text input
|
||||
/// </summary>
|
||||
public TextBoxEx txtInput;
|
||||
/// <summary>
|
||||
/// The label input
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Label lblInput;
|
||||
}
|
||||
}
|
||||
586
UsingControl/HZHControls/Controls/ComboBox/UCCombox.cs
Normal file
@@ -0,0 +1,586 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCCombox.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCCombox.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
[DefaultEvent("SelectedChangedEvent")]
|
||||
public partial class UCCombox : UCControlBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The fore color
|
||||
/// </summary>
|
||||
Color _ForeColor = Color.FromArgb(64, 64, 64);
|
||||
/// <summary>
|
||||
/// 文字颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the fore.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Description("文字颜色"), Category("自定义")]
|
||||
public override Color ForeColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ForeColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ForeColor = value;
|
||||
lblInput.ForeColor = value;
|
||||
txtInput.ForeColor = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 选中事件
|
||||
/// </summary>
|
||||
[Description("选中事件"), Category("自定义")]
|
||||
public event EventHandler SelectedChangedEvent;
|
||||
/// <summary>
|
||||
/// 文本改变事件
|
||||
/// </summary>
|
||||
[Description("文本改变事件"), Category("自定义")]
|
||||
public event EventHandler TextChangedEvent;
|
||||
|
||||
/// <summary>
|
||||
/// The box style
|
||||
/// </summary>
|
||||
private ComboBoxStyle _BoxStyle = ComboBoxStyle.DropDown;
|
||||
/// <summary>
|
||||
/// 控件样式
|
||||
/// </summary>
|
||||
/// <value>The box style.</value>
|
||||
[Description("控件样式"), Category("自定义")]
|
||||
public ComboBoxStyle BoxStyle
|
||||
{
|
||||
get { return _BoxStyle; }
|
||||
set
|
||||
{
|
||||
_BoxStyle = value;
|
||||
if (value == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
lblInput.Visible = true;
|
||||
txtInput.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
lblInput.Visible = false;
|
||||
txtInput.Visible = true;
|
||||
}
|
||||
|
||||
if (this._BoxStyle == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
txtInput.BackColor = _BackColor;
|
||||
base.FillColor = _BackColor;
|
||||
base.RectColor = _BackColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtInput.BackColor = Color.White;
|
||||
base.FillColor = Color.White;
|
||||
base.RectColor = Color.FromArgb(220, 220, 220);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The font
|
||||
/// </summary>
|
||||
private Font _Font = new Font("微软雅黑", 12);
|
||||
/// <summary>
|
||||
/// 字体
|
||||
/// </summary>
|
||||
/// <value>The font.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Description("字体"), Category("自定义")]
|
||||
public new Font Font
|
||||
{
|
||||
get { return _Font; }
|
||||
set
|
||||
{
|
||||
_Font = value;
|
||||
lblInput.Font = value;
|
||||
txtInput.Font = value;
|
||||
txtInput.PromptFont = value;
|
||||
this.txtInput.Location = new Point(this.txtInput.Location.X, (this.Height - txtInput.Height) / 2);
|
||||
this.lblInput.Location = new Point(this.lblInput.Location.X, (this.Height - lblInput.Height) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 当使用边框时填充颜色,当值为背景色或透明色或空值则不填充
|
||||
/// </summary>
|
||||
/// <value>The color of the fill.</value>
|
||||
[Obsolete("不再可用的属性")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private new Color FillColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 边框颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the rect.</value>
|
||||
[Obsolete("不再可用的属性")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private new Color RectColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The text value
|
||||
/// </summary>
|
||||
private string _TextValue;
|
||||
/// <summary>
|
||||
/// 文字
|
||||
/// </summary>
|
||||
/// <value>The text value.</value>
|
||||
[Description("文字"), Category("自定义")]
|
||||
public string TextValue
|
||||
{
|
||||
get { return _TextValue; }
|
||||
set
|
||||
{
|
||||
_TextValue = value;
|
||||
if (lblInput.Text != value)
|
||||
lblInput.Text = value;
|
||||
if (txtInput.Text != value)
|
||||
txtInput.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The source
|
||||
/// </summary>
|
||||
private List<KeyValuePair<string, string>> _source = null;
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
/// <value>The source.</value>
|
||||
[Description("数据源"), Category("自定义")]
|
||||
public List<KeyValuePair<string, string>> Source
|
||||
{
|
||||
get { return _source; }
|
||||
set
|
||||
{
|
||||
_source = value;
|
||||
_selectedIndex = -1;
|
||||
_selectedValue = "";
|
||||
_selectedItem = new KeyValuePair<string, string>();
|
||||
_selectedText = "";
|
||||
lblInput.Text = "";
|
||||
txtInput.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The selected item
|
||||
/// </summary>
|
||||
private KeyValuePair<string, string> _selectedItem = new KeyValuePair<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// The selected index
|
||||
/// </summary>
|
||||
private int _selectedIndex = -1;
|
||||
/// <summary>
|
||||
/// 选中的数据下标
|
||||
/// </summary>
|
||||
/// <value>The index of the selected.</value>
|
||||
[Description("选中的数据下标"), Category("自定义")]
|
||||
public int SelectedIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selectedIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 0 || _source == null || _source.Count <= 0 || value >= _source.Count)
|
||||
{
|
||||
_selectedIndex = -1;
|
||||
_selectedValue = "";
|
||||
_selectedItem = new KeyValuePair<string, string>();
|
||||
SelectedText = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedIndex = value;
|
||||
_selectedItem = _source[value];
|
||||
_selectedValue = _source[value].Key;
|
||||
SelectedText = _source[value].Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The selected value
|
||||
/// </summary>
|
||||
private string _selectedValue = "";
|
||||
/// <summary>
|
||||
/// 选中的值
|
||||
/// </summary>
|
||||
/// <value>The selected value.</value>
|
||||
[Description("选中的值"), Category("自定义")]
|
||||
public string SelectedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selectedValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_source == null || _source.Count <= 0)
|
||||
{
|
||||
SelectedText = "";
|
||||
_selectedValue = "";
|
||||
_selectedIndex = -1;
|
||||
_selectedItem = new KeyValuePair<string, string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < _source.Count; i++)
|
||||
{
|
||||
if (_source[i].Key == value)
|
||||
{
|
||||
_selectedValue = value;
|
||||
_selectedIndex = i;
|
||||
_selectedItem = _source[i];
|
||||
SelectedText = _source[i].Value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
_selectedValue = "";
|
||||
_selectedIndex = -1;
|
||||
_selectedItem = new KeyValuePair<string, string>();
|
||||
SelectedText = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The selected text
|
||||
/// </summary>
|
||||
private string _selectedText = "";
|
||||
/// <summary>
|
||||
/// 选中的文本
|
||||
/// </summary>
|
||||
/// <value>The selected text.</value>
|
||||
[Description("选中的文本"), Category("自定义")]
|
||||
public string SelectedText
|
||||
{
|
||||
get { return _selectedText; }
|
||||
private set
|
||||
{
|
||||
_selectedText = value;
|
||||
lblInput.Text = _selectedText;
|
||||
txtInput.Text = _selectedText;
|
||||
if (SelectedChangedEvent != null)
|
||||
{
|
||||
SelectedChangedEvent(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The item width
|
||||
/// </summary>
|
||||
private int _ItemWidth = 70;
|
||||
/// <summary>
|
||||
/// 项宽度
|
||||
/// </summary>
|
||||
/// <value>The width of the item.</value>
|
||||
[Description("项宽度"), Category("自定义")]
|
||||
public int ItemWidth
|
||||
{
|
||||
get { return _ItemWidth; }
|
||||
set { _ItemWidth = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The drop panel height
|
||||
/// </summary>
|
||||
private int _dropPanelHeight = -1;
|
||||
/// <summary>
|
||||
/// 下拉面板高度
|
||||
/// </summary>
|
||||
/// <value>The height of the drop panel.</value>
|
||||
[Description("下拉面板高度"), Category("自定义")]
|
||||
public int DropPanelHeight
|
||||
{
|
||||
get { return _dropPanelHeight; }
|
||||
set { _dropPanelHeight = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取或设置控件的背景色。
|
||||
/// </summary>
|
||||
/// <value>The color of the back.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Obsolete("不再可用的属性,如需要改变背景色,请使用BackColorExt")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private new Color BackColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.BackColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.BackColor = Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The back color
|
||||
/// </summary>
|
||||
private Color _BackColor = Color.FromArgb(240, 240, 240);
|
||||
/// <summary>
|
||||
/// 背景色
|
||||
/// </summary>
|
||||
/// <value>The back color ext.</value>
|
||||
[Description("背景色"), Category("自定义")]
|
||||
public Color BackColorExt
|
||||
{
|
||||
get
|
||||
{
|
||||
return _BackColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == Color.Transparent)
|
||||
return;
|
||||
_BackColor = value;
|
||||
lblInput.BackColor = value;
|
||||
|
||||
if (this._BoxStyle == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
txtInput.BackColor = value;
|
||||
base.FillColor = value;
|
||||
base.RectColor = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtInput.BackColor = Color.White;
|
||||
base.FillColor = Color.White;
|
||||
base.RectColor = Color.FromArgb(220, 220, 220);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The triangle color
|
||||
/// </summary>
|
||||
private Color triangleColor = Color.FromArgb(255, 77, 59);
|
||||
/// <summary>
|
||||
/// 三角颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the triangle.</value>
|
||||
[Description("三角颜色"), Category("自定义")]
|
||||
public Color TriangleColor
|
||||
{
|
||||
get { return triangleColor; }
|
||||
set
|
||||
{
|
||||
triangleColor = value;
|
||||
Bitmap bit = new Bitmap(12, 10);
|
||||
Graphics g = Graphics.FromImage(bit);
|
||||
g.SetGDIHigh();
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddLines(new Point[]
|
||||
{
|
||||
new Point(1,1),
|
||||
new Point(11,1),
|
||||
new Point(6,10),
|
||||
new Point(1,1)
|
||||
});
|
||||
g.FillPath(new SolidBrush(value), path);
|
||||
g.Dispose();
|
||||
panel1.BackgroundImage = bit;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCCombox" /> class.
|
||||
/// </summary>
|
||||
public UCCombox()
|
||||
{
|
||||
InitializeComponent();
|
||||
lblInput.BackColor = _BackColor;
|
||||
if (this._BoxStyle == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
txtInput.BackColor = _BackColor;
|
||||
base.FillColor = _BackColor;
|
||||
base.RectColor = _BackColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtInput.BackColor = Color.White;
|
||||
base.FillColor = Color.White;
|
||||
base.RectColor = Color.FromArgb(220, 220, 220);
|
||||
}
|
||||
base.BackColor = Color.Transparent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the UCComboBox control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void UCComboBox_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.txtInput.Location = new Point(this.txtInput.Location.X, (this.Height - txtInput.Height) / 2);
|
||||
this.lblInput.Location = new Point(this.lblInput.Location.X, (this.Height - lblInput.Height) / 2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the TextChanged event of the txtInput control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtInput_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
TextValue = txtInput.Text;
|
||||
if (TextChangedEvent != null)
|
||||
{
|
||||
TextChangedEvent(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the click control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
protected virtual void click_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (_frmAnchor == null || _frmAnchor.IsDisposed || _frmAnchor.Visible == false)
|
||||
{
|
||||
|
||||
if (this.Source != null && this.Source.Count > 0)
|
||||
{
|
||||
int intRow = 0;
|
||||
int intCom = 1;
|
||||
var p = this.PointToScreen(this.Location);
|
||||
while (true)
|
||||
{
|
||||
int intScreenHeight = Screen.PrimaryScreen.Bounds.Height;
|
||||
if ((p.Y + this.Height + this.Source.Count / intCom * 50 < intScreenHeight || p.Y - this.Source.Count / intCom * 50 > 0)
|
||||
&& (_dropPanelHeight <= 0 ? true : (this.Source.Count / intCom * 50 <= _dropPanelHeight)))
|
||||
{
|
||||
intRow = this.Source.Count / intCom + (this.Source.Count % intCom != 0 ? 1 : 0);
|
||||
break;
|
||||
}
|
||||
intCom++;
|
||||
}
|
||||
UCTimePanel ucTime = new UCTimePanel();
|
||||
ucTime.IsShowBorder = true;
|
||||
int intWidth = this.Width / intCom;
|
||||
if (intWidth < _ItemWidth)
|
||||
intWidth = _ItemWidth;
|
||||
Size size = new Size(intCom * intWidth, intRow * 50);
|
||||
ucTime.Size = size;
|
||||
ucTime.FirstEvent = true;
|
||||
ucTime.SelectSourceEvent += ucTime_SelectSourceEvent;
|
||||
ucTime.Row = intRow;
|
||||
ucTime.Column = intCom;
|
||||
List<KeyValuePair<string, string>> lst = new List<KeyValuePair<string, string>>();
|
||||
foreach (var item in this.Source)
|
||||
{
|
||||
lst.Add(new KeyValuePair<string, string>(item.Key, item.Value));
|
||||
}
|
||||
ucTime.Source = lst;
|
||||
|
||||
ucTime.SetSelect(_selectedValue);
|
||||
|
||||
_frmAnchor = new Forms.FrmAnchor(this, ucTime);
|
||||
_frmAnchor.Load += (a, b) => { (a as Form).Size = size; };
|
||||
|
||||
_frmAnchor.Show(this.FindForm());
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_frmAnchor.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The FRM anchor
|
||||
/// </summary>
|
||||
Forms.FrmAnchor _frmAnchor;
|
||||
/// <summary>
|
||||
/// Handles the SelectSourceEvent event of the ucTime control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void ucTime_SelectSourceEvent(object sender, EventArgs e)
|
||||
{
|
||||
if (_frmAnchor != null && !_frmAnchor.IsDisposed && _frmAnchor.Visible)
|
||||
{
|
||||
SelectedValue = sender.ToString();
|
||||
_frmAnchor.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Load event of the UCComboBox control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void UCComboBox_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (this._BoxStyle == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
txtInput.BackColor = _BackColor;
|
||||
base.FillColor = _BackColor;
|
||||
base.RectColor = _BackColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtInput.BackColor = Color.White;
|
||||
base.FillColor = Color.White;
|
||||
base.RectColor = Color.FromArgb(220, 220, 220);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
UsingControl/HZHControls/Controls/ComboBox/UCCombox.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>
|
||||
73
UsingControl/HZHControls/Controls/ComboBox/UCComboxGrid.Designer.cs
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-28-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCComboxGrid.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCComboxGrid.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCCombox" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCCombox" />
|
||||
partial class UCComboxGrid
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtInput
|
||||
//
|
||||
this.txtInput.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
//
|
||||
// UCComboxGrid
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.BoxStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.Name = "UCComboxGrid";
|
||||
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
229
UsingControl/HZHControls/Controls/ComboBox/UCComboxGrid.cs
Normal file
@@ -0,0 +1,229 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-28-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCComboxGrid.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using HZH_Controls.Controls;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCComboxGrid.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCCombox" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCCombox" />
|
||||
public partial class UCComboxGrid : UCCombox
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The m row type
|
||||
/// </summary>
|
||||
private Type m_rowType = typeof(UCDataGridViewRow);
|
||||
/// <summary>
|
||||
/// 表格行类型
|
||||
/// </summary>
|
||||
/// <value>The type of the grid row.</value>
|
||||
[Description("表格行类型"), Category("自定义")]
|
||||
public Type GridRowType
|
||||
{
|
||||
get { return m_rowType; }
|
||||
set
|
||||
{
|
||||
m_rowType = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The int width
|
||||
/// </summary>
|
||||
int intWidth = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The m columns
|
||||
/// </summary>
|
||||
private List<DataGridViewColumnEntity> m_columns = null;
|
||||
/// <summary>
|
||||
/// 表格列
|
||||
/// </summary>
|
||||
/// <value>The grid columns.</value>
|
||||
[Description("表格列"), Category("自定义")]
|
||||
public List<DataGridViewColumnEntity> GridColumns
|
||||
{
|
||||
get { return m_columns; }
|
||||
set
|
||||
{
|
||||
m_columns = value;
|
||||
if (value != null)
|
||||
intWidth = value.Sum(p => p.WidthType == SizeType.Absolute ? p.Width : (p.Width < 80 ? 80 : p.Width));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The m data source
|
||||
/// </summary>
|
||||
private List<object> m_dataSource = null;
|
||||
/// <summary>
|
||||
/// 表格数据源
|
||||
/// </summary>
|
||||
/// <value>The grid data source.</value>
|
||||
[Description("表格数据源"), Category("自定义")]
|
||||
public List<object> GridDataSource
|
||||
{
|
||||
get { return m_dataSource; }
|
||||
set { m_dataSource = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m text field
|
||||
/// </summary>
|
||||
private string m_textField;
|
||||
/// <summary>
|
||||
/// 显示值字段名称
|
||||
/// </summary>
|
||||
/// <value>The text field.</value>
|
||||
[Description("显示值字段名称"), Category("自定义")]
|
||||
public string TextField
|
||||
{
|
||||
get { return m_textField; }
|
||||
set
|
||||
{
|
||||
m_textField = value;
|
||||
SetText();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 控件样式
|
||||
/// </summary>
|
||||
/// <value>The box style.</value>
|
||||
[Obsolete("不再可用的属性")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private new ComboBoxStyle BoxStyle
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// The select source
|
||||
/// </summary>
|
||||
private object selectSource = null;
|
||||
/// <summary>
|
||||
/// 选中的数据源
|
||||
/// </summary>
|
||||
/// <value>The select source.</value>
|
||||
[Description("选中的数据源"), Category("自定义")]
|
||||
public object SelectSource
|
||||
{
|
||||
get { return selectSource; }
|
||||
set
|
||||
{
|
||||
selectSource = value;
|
||||
SetText();
|
||||
if (SelectedChangedEvent != null)
|
||||
{
|
||||
SelectedChangedEvent(value, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选中数据源改变事件
|
||||
/// </summary>
|
||||
[Description("选中数据源改变事件"), Category("自定义")]
|
||||
public new event EventHandler SelectedChangedEvent;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCComboxGrid" /> class.
|
||||
/// </summary>
|
||||
public UCComboxGrid()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
/// <summary>
|
||||
/// The m uc panel
|
||||
/// </summary>
|
||||
UCComboxGridPanel m_ucPanel = null;
|
||||
/// <summary>
|
||||
/// The FRM anchor
|
||||
/// </summary>
|
||||
Forms.FrmAnchor _frmAnchor;
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the click control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
protected override void click_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (m_columns == null || m_columns.Count <= 0)
|
||||
return;
|
||||
if (m_ucPanel == null)
|
||||
{
|
||||
var p = this.Parent.PointToScreen(this.Location);
|
||||
int intScreenHeight = Screen.PrimaryScreen.Bounds.Height;
|
||||
int intHeight = Math.Max(p.Y, intScreenHeight - p.Y - this.Height);
|
||||
intHeight -= 100;
|
||||
m_ucPanel = new UCComboxGridPanel();
|
||||
m_ucPanel.ItemClick += m_ucPanel_ItemClick;
|
||||
m_ucPanel.Height = intHeight;
|
||||
m_ucPanel.Width = intWidth;
|
||||
m_ucPanel.Columns = m_columns;
|
||||
m_ucPanel.RowType = m_rowType;
|
||||
if (m_dataSource != null && m_dataSource.Count > 0)
|
||||
{
|
||||
int _intHeight = Math.Min(110 + m_dataSource.Count * 36, m_ucPanel.Height);
|
||||
if (_intHeight <= 0)
|
||||
_intHeight = 100;
|
||||
m_ucPanel.Height = _intHeight;
|
||||
}
|
||||
}
|
||||
m_ucPanel.DataSource = m_dataSource;
|
||||
if (_frmAnchor == null || _frmAnchor.IsDisposed || _frmAnchor.Visible == false)
|
||||
{
|
||||
_frmAnchor = new Forms.FrmAnchor(this, m_ucPanel, isNotFocus: false);
|
||||
_frmAnchor.Show(this.FindForm());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the ItemClick event of the m_ucPanel control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="DataGridViewEventArgs" /> instance containing the event data.</param>
|
||||
void m_ucPanel_ItemClick(object sender, DataGridViewEventArgs e)
|
||||
{
|
||||
_frmAnchor.Hide();
|
||||
SelectSource = sender;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the text.
|
||||
/// </summary>
|
||||
private void SetText()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(m_textField) && selectSource != null)
|
||||
{
|
||||
var pro = selectSource.GetType().GetProperty(m_textField);
|
||||
if (pro != null)
|
||||
{
|
||||
TextValue = pro.GetValue(selectSource, null).ToStringExt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
UsingControl/HZHControls/Controls/ComboBox/UCComboxGrid.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>
|
||||
290
UsingControl/HZHControls/Controls/ComboBox/UCComboxGridPanel.Designer.cs
generated
Normal file
@@ -0,0 +1,290 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-28-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCComboxGridPanel.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCComboxGridPanel.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
partial class UCComboxGridPanel
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.ucControlBase1 = new HZH_Controls.Controls.UCControlBase();
|
||||
this.ucDataGridView1 = new HZH_Controls.Controls.UCDataGridView();
|
||||
this.m_page = new HZH_Controls.Controls.UCPagerControl();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.txtSearch = new HZH_Controls.Controls.UCTextBoxEx();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.ucSplitLine_V2 = new HZH_Controls.Controls.UCSplitLine_V();
|
||||
this.ucSplitLine_V1 = new HZH_Controls.Controls.UCSplitLine_V();
|
||||
this.ucSplitLine_H2 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.panel1.SuspendLayout();
|
||||
this.ucControlBase1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.ucControlBase1);
|
||||
this.panel1.Controls.Add(this.panel2);
|
||||
this.panel1.Controls.Add(this.txtSearch);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(1, 1);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.panel1.Size = new System.Drawing.Size(447, 333);
|
||||
this.panel1.TabIndex = 4;
|
||||
//
|
||||
// ucControlBase1
|
||||
//
|
||||
this.ucControlBase1.ConerRadius = 5;
|
||||
this.ucControlBase1.Controls.Add(this.ucDataGridView1);
|
||||
this.ucControlBase1.Controls.Add(this.m_page);
|
||||
this.ucControlBase1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ucControlBase1.FillColor = System.Drawing.Color.Transparent;
|
||||
this.ucControlBase1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.ucControlBase1.IsRadius = false;
|
||||
this.ucControlBase1.IsShowRect = true;
|
||||
this.ucControlBase1.Location = new System.Drawing.Point(5, 62);
|
||||
this.ucControlBase1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ucControlBase1.Name = "ucControlBase1";
|
||||
this.ucControlBase1.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.ucControlBase1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
|
||||
this.ucControlBase1.RectWidth = 1;
|
||||
this.ucControlBase1.Size = new System.Drawing.Size(437, 266);
|
||||
this.ucControlBase1.TabIndex = 2;
|
||||
this.ucControlBase1.TabStop = false;
|
||||
//
|
||||
// ucDataGridView1
|
||||
//
|
||||
this.ucDataGridView1.AutoScroll = true;
|
||||
this.ucDataGridView1.BackColor = System.Drawing.Color.White;
|
||||
this.ucDataGridView1.Columns = null;
|
||||
this.ucDataGridView1.DataSource = null;
|
||||
this.ucDataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ucDataGridView1.HeadFont = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.ucDataGridView1.HeadHeight = 40;
|
||||
this.ucDataGridView1.HeadPadingLeft = 0;
|
||||
this.ucDataGridView1.HeadTextColor = System.Drawing.Color.Black;
|
||||
this.ucDataGridView1.IsShowCheckBox = false;
|
||||
this.ucDataGridView1.IsShowHead = true;
|
||||
this.ucDataGridView1.Location = new System.Drawing.Point(5, 5);
|
||||
this.ucDataGridView1.Name = "ucDataGridView1";
|
||||
this.ucDataGridView1.RowHeight = 30;
|
||||
this.ucDataGridView1.RowType = typeof(HZH_Controls.Controls.UCDataGridViewRow);
|
||||
this.ucDataGridView1.Size = new System.Drawing.Size(427, 223);
|
||||
this.ucDataGridView1.TabIndex = 0;
|
||||
this.ucDataGridView1.TabStop = false;
|
||||
//
|
||||
// m_page
|
||||
//
|
||||
this.m_page.DataSource = null;
|
||||
this.m_page.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.m_page.Location = new System.Drawing.Point(5, 228);
|
||||
this.m_page.Name = "m_page";
|
||||
this.m_page.PageCount = 0;
|
||||
this.m_page.PageIndex = 1;
|
||||
this.m_page.PageSize = 10;
|
||||
this.m_page.Size = new System.Drawing.Size(427, 33);
|
||||
this.m_page.StartIndex = 0;
|
||||
this.m_page.TabIndex = 1;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(5, 47);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(437, 15);
|
||||
this.panel2.TabIndex = 1;
|
||||
//
|
||||
// txtSearch
|
||||
//
|
||||
this.txtSearch.BackColor = System.Drawing.Color.Transparent;
|
||||
this.txtSearch.ConerRadius = 5;
|
||||
this.txtSearch.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||
this.txtSearch.DecLength = 2;
|
||||
this.txtSearch.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.txtSearch.FillColor = System.Drawing.Color.Empty;
|
||||
this.txtSearch.FocusBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.txtSearch.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtSearch.InputText = "";
|
||||
this.txtSearch.InputType = HZH_Controls.TextInputType.NotControl;
|
||||
this.txtSearch.IsFocusColor = true;
|
||||
this.txtSearch.IsRadius = true;
|
||||
this.txtSearch.IsShowClearBtn = true;
|
||||
this.txtSearch.IsShowKeyboard = false;
|
||||
this.txtSearch.IsShowRect = true;
|
||||
this.txtSearch.IsShowSearchBtn = false;
|
||||
this.txtSearch.KeyBoardType = HZH_Controls.Controls.KeyBoardType.UCKeyBorderAll_EN;
|
||||
this.txtSearch.Location = new System.Drawing.Point(5, 5);
|
||||
this.txtSearch.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.txtSearch.MaxValue = new decimal(new int[] {
|
||||
1000000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtSearch.MinValue = new decimal(new int[] {
|
||||
1000000,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.txtSearch.Name = "txtSearch";
|
||||
this.txtSearch.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.txtSearch.PromptColor = System.Drawing.Color.Gray;
|
||||
this.txtSearch.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtSearch.PromptText = "输入内容模糊搜索";
|
||||
this.txtSearch.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
|
||||
this.txtSearch.RectWidth = 1;
|
||||
this.txtSearch.RegexPattern = "";
|
||||
this.txtSearch.Size = new System.Drawing.Size(437, 42);
|
||||
this.txtSearch.TabIndex = 0;
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
this.timer1.Interval = 1000;
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
//
|
||||
// ucSplitLine_V2
|
||||
//
|
||||
this.ucSplitLine_V2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_V2.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.ucSplitLine_V2.Location = new System.Drawing.Point(448, 1);
|
||||
this.ucSplitLine_V2.Name = "ucSplitLine_V2";
|
||||
this.ucSplitLine_V2.Size = new System.Drawing.Size(1, 333);
|
||||
this.ucSplitLine_V2.TabIndex = 3;
|
||||
this.ucSplitLine_V2.TabStop = false;
|
||||
//
|
||||
// ucSplitLine_V1
|
||||
//
|
||||
this.ucSplitLine_V1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_V1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.ucSplitLine_V1.Location = new System.Drawing.Point(0, 1);
|
||||
this.ucSplitLine_V1.Name = "ucSplitLine_V1";
|
||||
this.ucSplitLine_V1.Size = new System.Drawing.Size(1, 333);
|
||||
this.ucSplitLine_V1.TabIndex = 2;
|
||||
this.ucSplitLine_V1.TabStop = false;
|
||||
//
|
||||
// ucSplitLine_H2
|
||||
//
|
||||
this.ucSplitLine_H2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_H2.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.ucSplitLine_H2.Location = new System.Drawing.Point(0, 334);
|
||||
this.ucSplitLine_H2.Name = "ucSplitLine_H2";
|
||||
this.ucSplitLine_H2.Size = new System.Drawing.Size(449, 1);
|
||||
this.ucSplitLine_H2.TabIndex = 1;
|
||||
this.ucSplitLine_H2.TabStop = false;
|
||||
//
|
||||
// ucSplitLine_H1
|
||||
//
|
||||
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 0);
|
||||
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
|
||||
this.ucSplitLine_H1.Size = new System.Drawing.Size(449, 1);
|
||||
this.ucSplitLine_H1.TabIndex = 0;
|
||||
this.ucSplitLine_H1.TabStop = false;
|
||||
//
|
||||
// UCComboxGridPanel
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.ucSplitLine_V2);
|
||||
this.Controls.Add(this.ucSplitLine_V1);
|
||||
this.Controls.Add(this.ucSplitLine_H2);
|
||||
this.Controls.Add(this.ucSplitLine_H1);
|
||||
this.Name = "UCComboxGridPanel";
|
||||
this.Size = new System.Drawing.Size(449, 335);
|
||||
this.Load += new System.EventHandler(this.UCComboxGridPanel_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.ucControlBase1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The uc split line h1
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H1;
|
||||
/// <summary>
|
||||
/// The uc split line h2
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H2;
|
||||
/// <summary>
|
||||
/// The uc split line v1
|
||||
/// </summary>
|
||||
private UCSplitLine_V ucSplitLine_V1;
|
||||
/// <summary>
|
||||
/// The uc split line v2
|
||||
/// </summary>
|
||||
private UCSplitLine_V ucSplitLine_V2;
|
||||
/// <summary>
|
||||
/// The panel1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
/// <summary>
|
||||
/// The uc control base1
|
||||
/// </summary>
|
||||
private UCControlBase ucControlBase1;
|
||||
/// <summary>
|
||||
/// The uc data grid view1
|
||||
/// </summary>
|
||||
private UCDataGridView ucDataGridView1;
|
||||
/// <summary>
|
||||
/// The panel2
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
/// <summary>
|
||||
/// The timer1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
/// <summary>
|
||||
/// The text search
|
||||
/// </summary>
|
||||
private UCTextBoxEx txtSearch;
|
||||
private UCPagerControl m_page;
|
||||
}
|
||||
}
|
||||
188
UsingControl/HZHControls/Controls/ComboBox/UCComboxGridPanel.cs
Normal file
@@ -0,0 +1,188 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-28-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCComboxGridPanel.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCComboxGridPanel.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
[ToolboxItem(false)]
|
||||
public partial class UCComboxGridPanel : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 项点击事件
|
||||
/// </summary>
|
||||
[Description("项点击事件"), Category("自定义")]
|
||||
public event DataGridViewEventHandler ItemClick;
|
||||
/// <summary>
|
||||
/// The m row type
|
||||
/// </summary>
|
||||
private Type m_rowType = typeof(UCDataGridViewRow);
|
||||
/// <summary>
|
||||
/// 行类型
|
||||
/// </summary>
|
||||
/// <value>The type of the row.</value>
|
||||
[Description("行类型"), Category("自定义")]
|
||||
public Type RowType
|
||||
{
|
||||
get { return m_rowType; }
|
||||
set
|
||||
{
|
||||
m_rowType = value;
|
||||
this.ucDataGridView1.RowType = m_rowType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m columns
|
||||
/// </summary>
|
||||
private List<DataGridViewColumnEntity> m_columns = null;
|
||||
/// <summary>
|
||||
/// 列
|
||||
/// </summary>
|
||||
/// <value>The columns.</value>
|
||||
[Description("列"), Category("自定义")]
|
||||
public List<DataGridViewColumnEntity> Columns
|
||||
{
|
||||
get { return m_columns; }
|
||||
set
|
||||
{
|
||||
m_columns = value;
|
||||
this.ucDataGridView1.Columns = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The m data source
|
||||
/// </summary>
|
||||
private List<object> m_dataSource = null;
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
/// <value>The data source.</value>
|
||||
[Description("数据源"), Category("自定义")]
|
||||
public List<object> DataSource
|
||||
{
|
||||
get { return m_dataSource; }
|
||||
set { m_dataSource = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string last search text
|
||||
/// </summary>
|
||||
private string strLastSearchText = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCComboxGridPanel" /> class.
|
||||
/// </summary>
|
||||
public UCComboxGridPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.txtSearch.txtInput.TextChanged += txtInput_TextChanged;
|
||||
this.ucDataGridView1.ItemClick += ucDataGridView1_ItemClick;
|
||||
m_page.ShowSourceChanged += m_page_ShowSourceChanged;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Handles the ItemClick event of the ucDataGridView1 control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="DataGridViewEventArgs" /> instance containing the event data.</param>
|
||||
void ucDataGridView1_ItemClick(object sender, DataGridViewEventArgs e)
|
||||
{
|
||||
if (ItemClick != null)
|
||||
{
|
||||
ItemClick((sender as IDataGridViewRow).DataSource, null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the TextChanged event of the txtInput control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void txtInput_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
timer1.Enabled = false;
|
||||
timer1.Enabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Load event of the UCComboxGridPanel control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void UCComboxGridPanel_Load(object sender, EventArgs e)
|
||||
{
|
||||
m_page.DataSource = m_dataSource;
|
||||
this.ucDataGridView1.DataSource = m_page.GetCurrentSource();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Tick event of the timer1 control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (strLastSearchText == txtSearch.InputText)
|
||||
{
|
||||
timer1.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
strLastSearchText = txtSearch.InputText;
|
||||
Search(txtSearch.InputText);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searches the specified string text.
|
||||
/// </summary>
|
||||
/// <param name="strText">The string text.</param>
|
||||
private void Search(string strText)
|
||||
{
|
||||
m_page.StartIndex = 0;
|
||||
if (!string.IsNullOrEmpty(strText))
|
||||
{
|
||||
strText = strText.ToLower().Trim();
|
||||
List<object> lst = m_dataSource.FindAll(p => m_columns.Any(c => (c.Format == null ? (p.GetType().GetProperty(c.DataField).GetValue(p, null).ToStringExt()) : c.Format(p.GetType().GetProperty(c.DataField).GetValue(p, null))).ToLower().Contains(strText)));
|
||||
m_page.DataSource = lst;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_page.DataSource = m_dataSource;
|
||||
}
|
||||
m_page.Reload();
|
||||
}
|
||||
|
||||
void m_page_ShowSourceChanged(object currentSource)
|
||||
{
|
||||
this.ucDataGridView1.DataSource = currentSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,45 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="DataGridViewCellEntity.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class DataGridViewCellEntity.
|
||||
/// </summary>
|
||||
public class DataGridViewCellEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
public string Title { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the width.
|
||||
/// </summary>
|
||||
/// <value>The width.</value>
|
||||
public int Width { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the width.
|
||||
/// </summary>
|
||||
/// <value>The type of the width.</value>
|
||||
public System.Windows.Forms.SizeType WidthType { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="DataGridViewCellEventArgs.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class DataGridViewEventArgs.
|
||||
/// Implements the <see cref="System.EventArgs" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.EventArgs" />
|
||||
public class DataGridViewEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the cell control.
|
||||
/// </summary>
|
||||
/// <value>The cell control.</value>
|
||||
public Control CellControl { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the index of the cell.
|
||||
/// </summary>
|
||||
/// <value>The index of the cell.</value>
|
||||
public int CellIndex { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the index of the row.
|
||||
/// </summary>
|
||||
/// <value>The index of the row.</value>
|
||||
public int RowIndex { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="DataGridViewCellEventHandler.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Delegate DataGridViewEventHandler
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="DataGridViewEventArgs" /> instance containing the event data.</param>
|
||||
[Serializable]
|
||||
[ComVisible(true)]
|
||||
public delegate void DataGridViewEventHandler(object sender, DataGridViewEventArgs e);
|
||||
|
||||
/// <summary>
|
||||
/// Delegate DataGridViewRowCustomEventHandler
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="DataGridViewRowCustomEventArgs" /> instance containing the event data.</param>
|
||||
[Serializable]
|
||||
[ComVisible(true)]
|
||||
public delegate void DataGridViewRowCustomEventHandler(object sender, DataGridViewRowCustomEventArgs e);
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="DataGridViewColumnEntity.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class DataGridViewColumnEntity.
|
||||
/// </summary>
|
||||
public class DataGridViewColumnEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the head text.
|
||||
/// </summary>
|
||||
/// <value>The head text.</value>
|
||||
public string HeadText { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the width.
|
||||
/// </summary>
|
||||
/// <value>The width.</value>
|
||||
public int Width { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the width.
|
||||
/// </summary>
|
||||
/// <value>The type of the width.</value>
|
||||
public System.Windows.Forms.SizeType WidthType { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the data field.
|
||||
/// </summary>
|
||||
/// <value>The data field.</value>
|
||||
public string DataField { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the format.
|
||||
/// </summary>
|
||||
/// <value>The format.</value>
|
||||
public Func<object, string> Format { get; set; }
|
||||
/// <summary>
|
||||
/// The text align
|
||||
/// </summary>
|
||||
private ContentAlignment _TextAlign = ContentAlignment.MiddleCenter;
|
||||
/// <summary>
|
||||
/// Gets or sets the text align.
|
||||
/// </summary>
|
||||
/// <value>The text align.</value>
|
||||
public ContentAlignment TextAlign { get { return _TextAlign; } set { _TextAlign = value; } }
|
||||
/// <summary>
|
||||
/// 自定义的单元格控件,一个实现IDataGridViewCustomCell的Control
|
||||
/// </summary>
|
||||
/// <value>The custom cell.</value>
|
||||
private Type customCellType = null;
|
||||
public Type CustomCellType
|
||||
{
|
||||
get
|
||||
{
|
||||
return customCellType;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!typeof(IDataGridViewCustomCell).IsAssignableFrom(value) || !value.IsSubclassOf(typeof(System.Windows.Forms.Control)))
|
||||
throw new Exception("行控件没有实现IDataGridViewCustomCell接口");
|
||||
customCellType = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-27-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="DataGridViewRowCustomEventArgs.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class DataGridViewRowCustomEventArgs.
|
||||
/// Implements the <see cref="System.EventArgs" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.EventArgs" />
|
||||
public class DataGridViewRowCustomEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the event.
|
||||
/// </summary>
|
||||
/// <value>The name of the event.</value>
|
||||
public string EventName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
public interface IDataGridViewCustomCell
|
||||
{
|
||||
/// <summary>
|
||||
/// 绑定行关联的数据
|
||||
/// </summary>
|
||||
/// <param name="obj">The object.</param>
|
||||
void SetBindSource(object obj);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="IDataGridViewRow.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IDataGridViewRow
|
||||
/// </summary>
|
||||
public interface IDataGridViewRow
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when [row custom event].
|
||||
/// </summary>
|
||||
event DataGridViewRowCustomEventHandler RowCustomEvent;
|
||||
/// <summary>
|
||||
/// CheckBox选中事件
|
||||
/// </summary>
|
||||
event DataGridViewEventHandler CheckBoxChangeEvent;
|
||||
/// <summary>
|
||||
/// 点击单元格事件
|
||||
/// </summary>
|
||||
event DataGridViewEventHandler CellClick;
|
||||
/// <summary>
|
||||
/// 数据源改变事件
|
||||
/// </summary>
|
||||
event DataGridViewEventHandler SourceChanged;
|
||||
/// <summary>
|
||||
/// 列参数,用于创建列数和宽度
|
||||
/// </summary>
|
||||
/// <value>The columns.</value>
|
||||
List<DataGridViewColumnEntity> Columns { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is show CheckBox.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is show CheckBox; otherwise, <c>false</c>.</value>
|
||||
bool IsShowCheckBox { get; set; }
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is checked; otherwise, <c>false</c>.</value>
|
||||
bool IsChecked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
/// <value>The data source.</value>
|
||||
object DataSource { get; set; }
|
||||
/// <summary>
|
||||
/// 添加单元格元素,仅做添加控件操作,不做数据绑定,数据绑定使用BindingCells
|
||||
/// </summary>
|
||||
void ReloadCells();
|
||||
/// <summary>
|
||||
/// 绑定数据到Cell
|
||||
/// </summary>
|
||||
/// <returns>返回true则表示已处理过,否则将进行默认绑定(通常只针对有Text值的控件)</returns>
|
||||
void BindingCellData();
|
||||
/// <summary>
|
||||
/// 设置选中状态,通常为设置颜色即可
|
||||
/// </summary>
|
||||
/// <param name="blnSelected">是否选中</param>
|
||||
void SetSelect(bool blnSelected);
|
||||
/// <summary>
|
||||
/// 行高
|
||||
/// </summary>
|
||||
/// <value>The height of the row.</value>
|
||||
int RowHeight { get; set; }
|
||||
/// <summary>
|
||||
/// 行号
|
||||
/// </summary>
|
||||
/// <value>The Index of the row.</value>
|
||||
int RowIndex { get; set; }
|
||||
}
|
||||
}
|
||||
148
UsingControl/HZHControls/Controls/DataGridView/UCDataGridView.Designer.cs
generated
Normal file
@@ -0,0 +1,148 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDataGridView.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDataGridView.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
partial class UCDataGridView
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panHead = new System.Windows.Forms.Panel();
|
||||
this.panColumns = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.panHeadLeft = new System.Windows.Forms.Panel();
|
||||
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.panRow = new System.Windows.Forms.Panel();
|
||||
this.panHead.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panHead
|
||||
//
|
||||
this.panHead.Controls.Add(this.panColumns);
|
||||
this.panHead.Controls.Add(this.panHeadLeft);
|
||||
this.panHead.Controls.Add(this.ucSplitLine_H1);
|
||||
this.panHead.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panHead.Location = new System.Drawing.Point(0, 0);
|
||||
this.panHead.Name = "panHead";
|
||||
this.panHead.Size = new System.Drawing.Size(1061, 40);
|
||||
this.panHead.TabIndex = 0;
|
||||
//
|
||||
// panColumns
|
||||
//
|
||||
this.panColumns.ColumnCount = 1;
|
||||
this.panColumns.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.panColumns.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panColumns.Location = new System.Drawing.Point(0, 0);
|
||||
this.panColumns.Name = "panColumns";
|
||||
this.panColumns.RowCount = 1;
|
||||
this.panColumns.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.panColumns.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.panColumns.Size = new System.Drawing.Size(1061, 39);
|
||||
this.panColumns.TabIndex = 1;
|
||||
//
|
||||
// panHeadLeft
|
||||
//
|
||||
this.panHeadLeft.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.panHeadLeft.Location = new System.Drawing.Point(0, 0);
|
||||
this.panHeadLeft.Name = "panHeadLeft";
|
||||
this.panHeadLeft.Size = new System.Drawing.Size(0, 39);
|
||||
this.panHeadLeft.TabIndex = 2;
|
||||
//
|
||||
// ucSplitLine_H1
|
||||
//
|
||||
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 39);
|
||||
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
|
||||
this.ucSplitLine_H1.Size = new System.Drawing.Size(1061, 1);
|
||||
this.ucSplitLine_H1.TabIndex = 0;
|
||||
this.ucSplitLine_H1.TabStop = false;
|
||||
//
|
||||
// panRow
|
||||
//
|
||||
this.panRow.AutoScroll = true;
|
||||
this.panRow.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panRow.Location = new System.Drawing.Point(0, 40);
|
||||
this.panRow.Name = "panRow";
|
||||
this.panRow.Size = new System.Drawing.Size(1061, 525);
|
||||
this.panRow.TabIndex = 1;
|
||||
//
|
||||
// UCDataGridView
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.AutoScroll = true;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.panRow);
|
||||
this.Controls.Add(this.panHead);
|
||||
this.Name = "UCDataGridView";
|
||||
this.Size = new System.Drawing.Size(1061, 565);
|
||||
this.panHead.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The pan head
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panHead;
|
||||
/// <summary>
|
||||
/// The pan columns
|
||||
/// </summary>
|
||||
private System.Windows.Forms.TableLayoutPanel panColumns;
|
||||
/// <summary>
|
||||
/// The uc split line h1
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H1;
|
||||
/// <summary>
|
||||
/// The pan row
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panRow;
|
||||
/// <summary>
|
||||
/// The pan head left
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panHeadLeft;
|
||||
|
||||
}
|
||||
}
|
||||
714
UsingControl/HZHControls/Controls/DataGridView/UCDataGridView.cs
Normal file
@@ -0,0 +1,714 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDataGridView.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDataGridView.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
public partial class UCDataGridView : UserControl
|
||||
{
|
||||
#region 属性
|
||||
/// <summary>
|
||||
/// The m head pading left
|
||||
/// </summary>
|
||||
private int m_headPadingLeft = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the head pading left.
|
||||
/// </summary>
|
||||
/// <value>The head pading left.</value>
|
||||
[Description("标题左侧间距"), Category("自定义")]
|
||||
public int HeadPadingLeft
|
||||
{
|
||||
get { return m_headPadingLeft; }
|
||||
set
|
||||
{
|
||||
m_headPadingLeft = value;
|
||||
this.panHeadLeft.Width = m_headPadingLeft;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m head font
|
||||
/// </summary>
|
||||
private Font m_headFont = new Font("微软雅黑", 12F);
|
||||
/// <summary>
|
||||
/// 标题字体
|
||||
/// </summary>
|
||||
/// <value>The head font.</value>
|
||||
[Description("标题字体"), Category("自定义")]
|
||||
public Font HeadFont
|
||||
{
|
||||
get { return m_headFont; }
|
||||
set { m_headFont = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The m head text color
|
||||
/// </summary>
|
||||
private Color m_headTextColor = Color.Black;
|
||||
/// <summary>
|
||||
/// 标题字体颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the head text.</value>
|
||||
[Description("标题文字颜色"), Category("自定义")]
|
||||
public Color HeadTextColor
|
||||
{
|
||||
get { return m_headTextColor; }
|
||||
set { m_headTextColor = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m is show head
|
||||
/// </summary>
|
||||
private bool m_isShowHead = true;
|
||||
/// <summary>
|
||||
/// 是否显示标题
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is show head; otherwise, <c>false</c>.</value>
|
||||
[Description("是否显示标题"), Category("自定义")]
|
||||
public bool IsShowHead
|
||||
{
|
||||
get { return m_isShowHead; }
|
||||
set
|
||||
{
|
||||
m_isShowHead = value;
|
||||
panHead.Visible = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The m head height
|
||||
/// </summary>
|
||||
private int m_headHeight = 40;
|
||||
/// <summary>
|
||||
/// 标题高度
|
||||
/// </summary>
|
||||
/// <value>The height of the head.</value>
|
||||
[Description("标题高度"), Category("自定义")]
|
||||
public int HeadHeight
|
||||
{
|
||||
get { return m_headHeight; }
|
||||
set
|
||||
{
|
||||
m_headHeight = value;
|
||||
panHead.Height = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m is show CheckBox
|
||||
/// </summary>
|
||||
private bool m_isShowCheckBox = false;
|
||||
/// <summary>
|
||||
/// 是否显示复选框
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is show CheckBox; otherwise, <c>false</c>.</value>
|
||||
[Description("是否显示选择框"), Category("自定义")]
|
||||
public bool IsShowCheckBox
|
||||
{
|
||||
get { return m_isShowCheckBox; }
|
||||
set
|
||||
{
|
||||
if (value != m_isShowCheckBox)
|
||||
{
|
||||
m_isShowCheckBox = value;
|
||||
LoadColumns();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m row height
|
||||
/// </summary>
|
||||
private int m_rowHeight = 40;
|
||||
/// <summary>
|
||||
/// 行高
|
||||
/// </summary>
|
||||
/// <value>The height of the row.</value>
|
||||
[Description("数据行高"), Category("自定义")]
|
||||
public int RowHeight
|
||||
{
|
||||
get { return m_rowHeight; }
|
||||
set { m_rowHeight = value; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the show count.
|
||||
/// </summary>
|
||||
/// <value>The show count.</value>
|
||||
[Description("当前高度可显示行个数"), Category("自定义")]
|
||||
public int ShowCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.panRow.Height / (m_rowHeight);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m columns
|
||||
/// </summary>
|
||||
private List<DataGridViewColumnEntity> m_columns = null;
|
||||
/// <summary>
|
||||
/// 列
|
||||
/// </summary>
|
||||
/// <value>The columns.</value>
|
||||
[Description("列"), Category("自定义")]
|
||||
public List<DataGridViewColumnEntity> Columns
|
||||
{
|
||||
get { return m_columns; }
|
||||
set
|
||||
{
|
||||
m_columns = value;
|
||||
LoadColumns();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m data source
|
||||
/// </summary>
|
||||
private object m_dataSource = null;
|
||||
/// <summary>
|
||||
/// 数据源,支持列表或table,如果使用翻页控件,请使用翻页控件的DataSource
|
||||
/// </summary>
|
||||
/// <value>The data source.</value>
|
||||
/// <exception cref="Exception">数据源不是有效的数据类型,请使用Datatable或列表</exception>
|
||||
/// <exception cref="System.Exception">数据源不是有效的数据类型,请使用Datatable或列表</exception>
|
||||
[Description("数据源,支持列表或table,如果使用翻页控件,请使用翻页控件的DataSource"), Category("自定义")]
|
||||
public object DataSource
|
||||
{
|
||||
get { return m_dataSource; }
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
if (!(value is DataTable) && (!typeof(IList).IsAssignableFrom(value.GetType())))
|
||||
{
|
||||
throw new Exception("数据源不是有效的数据类型,请使用Datatable或列表");
|
||||
}
|
||||
}
|
||||
m_dataSource = value;
|
||||
if (m_columns != null && m_columns.Count > 0)
|
||||
{
|
||||
ReloadSource();
|
||||
}
|
||||
if (BindingSourceEvent != null)
|
||||
{
|
||||
BindingSourceEvent(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the rows.
|
||||
/// </summary>
|
||||
/// <value>The rows.</value>
|
||||
public List<IDataGridViewRow> Rows { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The m row type
|
||||
/// </summary>
|
||||
private Type m_rowType = typeof(UCDataGridViewRow);
|
||||
/// <summary>
|
||||
/// 行元素类型,默认UCDataGridViewItem
|
||||
/// </summary>
|
||||
/// <value>The type of the row.</value>
|
||||
/// <exception cref="Exception">行控件没有实现IDataGridViewRow接口</exception>
|
||||
/// <exception cref="System.Exception">行控件没有实现IDataGridViewRow接口</exception>
|
||||
[Description("行控件类型,默认UCDataGridViewRow,如果不满足请自定义行控件实现接口IDataGridViewRow"), Category("自定义")]
|
||||
public Type RowType
|
||||
{
|
||||
get { return m_rowType; }
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
return;
|
||||
if (!typeof(IDataGridViewRow).IsAssignableFrom(value) || !value.IsSubclassOf(typeof(Control)))
|
||||
throw new Exception("行控件没有实现IDataGridViewRow接口");
|
||||
m_rowType = value;
|
||||
if (m_columns != null && m_columns.Count > 0)
|
||||
ReloadSource();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m select row
|
||||
/// </summary>
|
||||
IDataGridViewRow m_selectRow = null;
|
||||
/// <summary>
|
||||
/// 选中的节点
|
||||
/// </summary>
|
||||
/// <value>The select row.</value>
|
||||
[Description("选中行"), Category("自定义")]
|
||||
public IDataGridViewRow SelectRow
|
||||
{
|
||||
get { return m_selectRow; }
|
||||
private set { m_selectRow = value; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选中的行,如果显示CheckBox,则以CheckBox选中为准
|
||||
/// </summary>
|
||||
/// <value>The select rows.</value>
|
||||
[Description("选中的行,如果显示CheckBox,则以CheckBox选中为准"), Category("自定义")]
|
||||
public List<IDataGridViewRow> SelectRows
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetSelectRows();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the select rows.
|
||||
/// </summary>
|
||||
/// <returns>List<IDataGridViewRow>.</returns>
|
||||
private List<IDataGridViewRow> GetSelectRows()
|
||||
{
|
||||
List<IDataGridViewRow> lst = new List<IDataGridViewRow>();
|
||||
if (m_isShowCheckBox)
|
||||
{
|
||||
if (Rows != null && Rows.Count > 0)
|
||||
lst.AddRange(Rows.FindAll(p => p.IsChecked));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_selectRow != null)
|
||||
lst.AddRange(new List<IDataGridViewRow>() { m_selectRow });
|
||||
}
|
||||
if (Rows != null && Rows.Count > 0)
|
||||
{
|
||||
foreach (var row in Rows)
|
||||
{
|
||||
Control c = row as Control;
|
||||
UCDataGridView grid = FindChildGrid(c);
|
||||
if (grid != null)
|
||||
lst.AddRange(grid.SelectRows);
|
||||
}
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds the child grid.
|
||||
/// </summary>
|
||||
/// <param name="c">The c.</param>
|
||||
/// <returns>UCDataGridView.</returns>
|
||||
private UCDataGridView FindChildGrid(Control c)
|
||||
{
|
||||
foreach (Control item in c.Controls)
|
||||
{
|
||||
if (item is UCDataGridView)
|
||||
return item as UCDataGridView;
|
||||
else if (item.Controls.Count > 0)
|
||||
{
|
||||
var grid = FindChildGrid(item);
|
||||
if (grid != null)
|
||||
return grid;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
#region 事件
|
||||
/// <summary>
|
||||
/// The head CheckBox change event
|
||||
/// </summary>
|
||||
[Description("选中标题选择框事件"), Category("自定义")]
|
||||
public EventHandler HeadCheckBoxChangeEvent;
|
||||
/// <summary>
|
||||
/// The head column click event
|
||||
/// </summary>
|
||||
[Description("标题点击事件"), Category("自定义")]
|
||||
public EventHandler HeadColumnClickEvent;
|
||||
/// <summary>
|
||||
/// Occurs when [item click].
|
||||
/// </summary>
|
||||
[Description("项点击事件"), Category("自定义")]
|
||||
public event DataGridViewEventHandler ItemClick;
|
||||
/// <summary>
|
||||
/// Occurs when [source changed].
|
||||
/// </summary>
|
||||
[Description("行数据源改变事件"), Category("自定义")]
|
||||
public event DataGridViewEventHandler RowSourceChangedEvent;
|
||||
/// <summary>
|
||||
/// Occurs when [row custom event].
|
||||
/// </summary>
|
||||
[Description("预留的自定义的事件,比如你需要在行上放置删改等按钮时,可以通过此事件传递出来"), Category("自定义")]
|
||||
public event DataGridViewRowCustomEventHandler RowCustomEvent;
|
||||
[Description("绑定数据源后事件"), Category("自定义")]
|
||||
public event EventHandler BindingSourceEvent;
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCDataGridView" /> class.
|
||||
/// </summary>
|
||||
public UCDataGridView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#region 私有方法
|
||||
#region 加载column
|
||||
/// <summary>
|
||||
/// 功能描述:加载column
|
||||
/// 作 者:HZH
|
||||
/// 创建日期:2019-08-08 17:51:50
|
||||
/// 任务编号:POS
|
||||
/// </summary>
|
||||
private void LoadColumns()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DesignMode)
|
||||
{ return; }
|
||||
|
||||
ControlHelper.FreezeControl(this.panHead, true);
|
||||
this.panRow.Controls.Clear();
|
||||
this.panColumns.Controls.Clear();
|
||||
this.panColumns.ColumnStyles.Clear();
|
||||
|
||||
if (m_columns != null && m_columns.Count() > 0)
|
||||
{
|
||||
int intColumnsCount = m_columns.Count();
|
||||
if (m_isShowCheckBox)
|
||||
{
|
||||
intColumnsCount++;
|
||||
}
|
||||
this.panColumns.ColumnCount = intColumnsCount;
|
||||
for (int i = 0; i < intColumnsCount; i++)
|
||||
{
|
||||
Control c = null;
|
||||
if (i == 0 && m_isShowCheckBox)
|
||||
{
|
||||
this.panColumns.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(SizeType.Absolute, 30F));
|
||||
|
||||
UCCheckBox box = new UCCheckBox();
|
||||
box.TextValue = "";
|
||||
box.Size = new Size(30, 30);
|
||||
box.CheckedChangeEvent += (a, b) =>
|
||||
{
|
||||
Rows.ForEach(p => p.IsChecked = box.Checked);
|
||||
if (HeadCheckBoxChangeEvent != null)
|
||||
{
|
||||
HeadCheckBoxChangeEvent(a, b);
|
||||
}
|
||||
};
|
||||
c = box;
|
||||
}
|
||||
else
|
||||
{
|
||||
var item = m_columns[i - (m_isShowCheckBox ? 1 : 0)];
|
||||
this.panColumns.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(item.WidthType, item.Width));
|
||||
Label lbl = new Label();
|
||||
lbl.Name = "dgvColumns_" + i;
|
||||
lbl.Text = item.HeadText;
|
||||
lbl.Font = m_headFont;
|
||||
lbl.ForeColor = m_headTextColor;
|
||||
lbl.TextAlign = ContentAlignment.MiddleCenter;
|
||||
lbl.AutoSize = false;
|
||||
lbl.Dock = DockStyle.Fill;
|
||||
lbl.MouseDown += (a, b) =>
|
||||
{
|
||||
if (HeadColumnClickEvent != null)
|
||||
{
|
||||
HeadColumnClickEvent(a, b);
|
||||
}
|
||||
};
|
||||
c = lbl;
|
||||
}
|
||||
this.panColumns.Controls.Add(c, i, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(this.panHead, false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region 公共函数
|
||||
/// <summary>
|
||||
/// 刷新数据
|
||||
/// </summary>
|
||||
public void ReloadSource()
|
||||
{
|
||||
if (DesignMode)
|
||||
{ return; }
|
||||
try
|
||||
{
|
||||
ControlHelper.FreezeControl(this, true);
|
||||
Rows = new List<IDataGridViewRow>();
|
||||
if (m_columns == null || m_columns.Count <= 0)
|
||||
return;
|
||||
if (m_dataSource != null)
|
||||
{
|
||||
int intIndex = 0;
|
||||
|
||||
int intSourceCount = 0;
|
||||
if (m_dataSource is DataTable)
|
||||
{
|
||||
intSourceCount = (m_dataSource as DataTable).Rows.Count;
|
||||
}
|
||||
else if (typeof(IList).IsAssignableFrom(m_dataSource.GetType()))
|
||||
{
|
||||
intSourceCount = (m_dataSource as IList).Count;
|
||||
}
|
||||
|
||||
foreach (Control item in this.panRow.Controls)
|
||||
{
|
||||
if (intIndex >= intSourceCount)
|
||||
{
|
||||
item.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var row = (item as IDataGridViewRow);
|
||||
row.IsShowCheckBox = m_isShowCheckBox;
|
||||
if (m_dataSource is DataTable)
|
||||
{
|
||||
row.DataSource = (m_dataSource as DataTable).Rows[intIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
row.DataSource = (m_dataSource as IList)[intIndex];
|
||||
}
|
||||
row.BindingCellData();
|
||||
if (row.RowHeight != m_rowHeight)
|
||||
row.RowHeight = m_rowHeight;
|
||||
item.Visible = true;
|
||||
item.BringToFront();
|
||||
|
||||
Rows.Add(row);
|
||||
row.RowIndex = Rows.IndexOf(row);
|
||||
}
|
||||
intIndex++;
|
||||
}
|
||||
|
||||
if (intIndex < intSourceCount)
|
||||
{
|
||||
for (int i = intIndex; i < intSourceCount; i++)
|
||||
{
|
||||
IDataGridViewRow row = (IDataGridViewRow)Activator.CreateInstance(m_rowType);
|
||||
if (m_dataSource is DataTable)
|
||||
{
|
||||
row.DataSource = (m_dataSource as DataTable).Rows[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
row.DataSource = (m_dataSource as IList)[i];
|
||||
}
|
||||
row.Columns = m_columns;
|
||||
List<Control> lstCells = new List<Control>();
|
||||
row.IsShowCheckBox = m_isShowCheckBox;
|
||||
row.ReloadCells();
|
||||
row.BindingCellData();
|
||||
|
||||
Control rowControl = (row as Control);
|
||||
row.RowHeight = m_rowHeight;
|
||||
rowControl.Dock = DockStyle.Top;
|
||||
row.CellClick += (a, b) => { SetSelectRow(rowControl, b); };
|
||||
row.CheckBoxChangeEvent += (a, b) => { SetSelectRow(rowControl, b); };
|
||||
row.RowCustomEvent += (a, b) => { if (RowCustomEvent != null) { RowCustomEvent(a, b); } };
|
||||
row.SourceChanged += RowSourceChanged;
|
||||
Rows.Add(row);
|
||||
row.RowIndex = Rows.IndexOf(row);
|
||||
this.panRow.Controls.Add(rowControl);
|
||||
rowControl.BringToFront();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Control item in this.panRow.Controls)
|
||||
{
|
||||
item.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 快捷键
|
||||
/// </summary>
|
||||
/// <param name="msg">通过引用传递的 <see cref="T:System.Windows.Forms.Message" />,它表示要处理的窗口消息。</param>
|
||||
/// <param name="keyData"><see cref="T:System.Windows.Forms.Keys" /> 值之一,它表示要处理的键。</param>
|
||||
/// <returns>如果字符已由控件处理,则为 true;否则为 false。</returns>
|
||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||
{
|
||||
if (keyData == Keys.Up)
|
||||
{
|
||||
Previous();
|
||||
}
|
||||
else if (keyData == Keys.Down)
|
||||
{
|
||||
Next();
|
||||
}
|
||||
else if (keyData == Keys.Home)
|
||||
{
|
||||
First();
|
||||
}
|
||||
else if (keyData == Keys.End)
|
||||
{
|
||||
End();
|
||||
}
|
||||
return base.ProcessCmdKey(ref msg, keyData);
|
||||
}
|
||||
/// <summary>
|
||||
/// 选中第一个
|
||||
/// </summary>
|
||||
public void First()
|
||||
{
|
||||
if (Rows == null || Rows.Count <= 0)
|
||||
return;
|
||||
Control c = null;
|
||||
c = (Rows[0] as Control);
|
||||
SetSelectRow(c, new DataGridViewEventArgs() { RowIndex = 0 });
|
||||
}
|
||||
/// <summary>
|
||||
/// 选中上一个
|
||||
/// </summary>
|
||||
public void Previous()
|
||||
{
|
||||
if (Rows == null || Rows.Count <= 0)
|
||||
return;
|
||||
Control c = null;
|
||||
|
||||
int index = Rows.IndexOf(m_selectRow);
|
||||
if (index - 1 >= 0)
|
||||
{
|
||||
c = (Rows[index - 1] as Control);
|
||||
SetSelectRow(c, new DataGridViewEventArgs() { RowIndex = index - 1 });
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 选中下一个
|
||||
/// </summary>
|
||||
public void Next()
|
||||
{
|
||||
if (Rows == null || Rows.Count <= 0)
|
||||
return;
|
||||
Control c = null;
|
||||
|
||||
int index = Rows.IndexOf(m_selectRow);
|
||||
if (index + 1 < Rows.Count)
|
||||
{
|
||||
c = (Rows[index + 1] as Control);
|
||||
SetSelectRow(c, new DataGridViewEventArgs() { RowIndex = index + 1 });
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 选中最后一个
|
||||
/// </summary>
|
||||
public void End()
|
||||
{
|
||||
if (Rows == null || Rows.Count <= 0)
|
||||
return;
|
||||
Control c = null;
|
||||
c = (Rows[Rows.Count - 1] as Control);
|
||||
SetSelectRow(c, new DataGridViewEventArgs() { RowIndex = Rows.Count - 1 });
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 事件
|
||||
/// <summary>
|
||||
/// Rows the source changed.
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The <see cref="DataGridViewEventArgs" /> instance containing the event data.</param>
|
||||
void RowSourceChanged(object sender, DataGridViewEventArgs e)
|
||||
{
|
||||
if (RowSourceChangedEvent != null)
|
||||
RowSourceChangedEvent(sender, e);
|
||||
}
|
||||
/// <summary>
|
||||
/// Sets the select row.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="e">The <see cref="DataGridViewEventArgs" /> instance containing the event data.</param>
|
||||
private void SetSelectRow(Control item, DataGridViewEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ControlHelper.FreezeControl(this, true);
|
||||
if (item == null)
|
||||
return;
|
||||
if (item.Visible == false)
|
||||
return;
|
||||
this.FindForm().ActiveControl = this;
|
||||
this.FindForm().ActiveControl = item;
|
||||
if (m_selectRow != item)
|
||||
{
|
||||
if (m_selectRow != null)
|
||||
{
|
||||
m_selectRow.SetSelect(false);
|
||||
}
|
||||
m_selectRow = item as IDataGridViewRow;
|
||||
m_selectRow.SetSelect(true);
|
||||
|
||||
if (this.panRow.Controls.Count > 0)
|
||||
{
|
||||
if (item.Location.Y < 0)
|
||||
{
|
||||
this.panRow.AutoScrollPosition = new Point(0, Math.Abs(this.panRow.Controls[this.panRow.Controls.Count - 1].Location.Y) + item.Location.Y);
|
||||
}
|
||||
else if (item.Location.Y + m_rowHeight > this.panRow.Height)
|
||||
{
|
||||
this.panRow.AutoScrollPosition = new Point(0, Math.Abs(this.panRow.AutoScrollPosition.Y) + item.Location.Y - this.panRow.Height + m_rowHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ItemClick != null)
|
||||
{
|
||||
ItemClick(item, e);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
102
UsingControl/HZHControls/Controls/DataGridView/UCDataGridViewRow.Designer.cs
generated
Normal file
@@ -0,0 +1,102 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDataGridViewRow.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDataGridViewRow.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
partial class UCDataGridViewRow
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.panCells = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ucSplitLine_H1
|
||||
//
|
||||
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 55);
|
||||
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
|
||||
this.ucSplitLine_H1.Size = new System.Drawing.Size(661, 1);
|
||||
this.ucSplitLine_H1.TabIndex = 0;
|
||||
this.ucSplitLine_H1.TabStop = false;
|
||||
//
|
||||
// panCells
|
||||
//
|
||||
this.panCells.ColumnCount = 1;
|
||||
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.panCells.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panCells.Location = new System.Drawing.Point(0, 0);
|
||||
this.panCells.Name = "panCells";
|
||||
this.panCells.RowCount = 1;
|
||||
this.panCells.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.panCells.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.panCells.Size = new System.Drawing.Size(661, 55);
|
||||
this.panCells.TabIndex = 1;
|
||||
//
|
||||
// UCDataGridViewItem
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.panCells);
|
||||
this.Controls.Add(this.ucSplitLine_H1);
|
||||
this.Name = "UCDataGridViewItem";
|
||||
this.Size = new System.Drawing.Size(661, 56);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The uc split line h1
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H1;
|
||||
/// <summary>
|
||||
/// The pan cells
|
||||
/// </summary>
|
||||
private System.Windows.Forms.TableLayoutPanel panCells;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-09-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCDataGridViewRow.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCDataGridViewRow.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// Implements the <see cref="HZH_Controls.Controls.IDataGridViewRow" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
/// <seealso cref="HZH_Controls.Controls.IDataGridViewRow" />
|
||||
[ToolboxItem(false)]
|
||||
public partial class UCDataGridViewRow : UserControl, IDataGridViewRow
|
||||
{
|
||||
|
||||
#region 属性
|
||||
/// <summary>
|
||||
/// CheckBox选中事件
|
||||
/// </summary>
|
||||
public event DataGridViewEventHandler CheckBoxChangeEvent;
|
||||
/// <summary>
|
||||
/// Occurs when [row custom event].
|
||||
/// </summary>
|
||||
public event DataGridViewRowCustomEventHandler RowCustomEvent;
|
||||
/// <summary>
|
||||
/// 点击单元格事件
|
||||
/// </summary>
|
||||
public event DataGridViewEventHandler CellClick;
|
||||
|
||||
/// <summary>
|
||||
/// 数据源改变事件
|
||||
/// </summary>
|
||||
public event DataGridViewEventHandler SourceChanged;
|
||||
|
||||
/// <summary>
|
||||
/// 列参数,用于创建列数和宽度
|
||||
/// </summary>
|
||||
/// <value>The columns.</value>
|
||||
public List<DataGridViewColumnEntity> Columns
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
/// <value>The data source.</value>
|
||||
public object DataSource
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 行号
|
||||
/// </summary>
|
||||
/// <value>The Index of the row.</value>
|
||||
public int RowIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance is show CheckBox.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is show CheckBox; otherwise, <c>false</c>.</value>
|
||||
public bool IsShowCheckBox
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// The m is checked
|
||||
/// </summary>
|
||||
private bool m_isChecked;
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is checked; otherwise, <c>false</c>.</value>
|
||||
public bool IsChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_isChecked;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (m_isChecked != value)
|
||||
{
|
||||
m_isChecked = value;
|
||||
(this.panCells.Controls.Find("check", false)[0] as UCCheckBox).Checked = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The m row height
|
||||
/// </summary>
|
||||
int m_rowHeight = 40;
|
||||
/// <summary>
|
||||
/// 行高
|
||||
/// </summary>
|
||||
/// <value>The height of the row.</value>
|
||||
public int RowHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_rowHeight;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_rowHeight = value;
|
||||
this.Height = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCDataGridViewRow" /> class.
|
||||
/// </summary>
|
||||
public UCDataGridViewRow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据到Cell
|
||||
/// </summary>
|
||||
/// <returns>返回true则表示已处理过,否则将进行默认绑定(通常只针对有Text值的控件)</returns>
|
||||
public void BindingCellData()
|
||||
{
|
||||
if (DataSource != null)
|
||||
{
|
||||
for (int i = 0; i < Columns.Count; i++)
|
||||
{
|
||||
DataGridViewColumnEntity com = Columns[i];
|
||||
var cs = this.panCells.Controls.Find("lbl_" + com.DataField, false);
|
||||
if (cs != null && cs.Length > 0)
|
||||
{
|
||||
if (DataSource is DataRow)
|
||||
{
|
||||
DataRow row=DataSource as DataRow;
|
||||
if (com.Format != null)
|
||||
{
|
||||
cs[0].Text = com.Format(row[com.DataField]);
|
||||
}
|
||||
else
|
||||
{
|
||||
cs[0].Text = row[com.DataField].ToStringExt();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var pro = DataSource.GetType().GetProperty(com.DataField);
|
||||
|
||||
if (pro != null)
|
||||
{
|
||||
var value = pro.GetValue(DataSource, null);
|
||||
if (com.Format != null)
|
||||
{
|
||||
cs[0].Text = com.Format(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
cs[0].Text = value.ToStringExt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (Control item in this.panCells.Controls)
|
||||
{
|
||||
if (item is IDataGridViewCustomCell)
|
||||
{
|
||||
IDataGridViewCustomCell cell = item as IDataGridViewCustomCell;
|
||||
cell.SetBindSource(DataSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the Item control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
void Item_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (CellClick != null)
|
||||
{
|
||||
CellClick(this, new DataGridViewEventArgs()
|
||||
{
|
||||
CellControl = this,
|
||||
CellIndex = (sender as Control).Tag.ToInt(),
|
||||
RowIndex = this.RowIndex
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选中状态,通常为设置颜色即可
|
||||
/// </summary>
|
||||
/// <param name="blnSelected">是否选中</param>
|
||||
public void SetSelect(bool blnSelected)
|
||||
{
|
||||
if (blnSelected)
|
||||
{
|
||||
this.BackColor = Color.FromArgb(255, 247, 245);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.BackColor = Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the cells.
|
||||
/// </summary>
|
||||
public void ReloadCells()
|
||||
{
|
||||
try
|
||||
{
|
||||
ControlHelper.FreezeControl(this, true);
|
||||
this.panCells.Controls.Clear();
|
||||
this.panCells.ColumnStyles.Clear();
|
||||
|
||||
int intColumnsCount = Columns.Count();
|
||||
if (Columns != null && intColumnsCount > 0)
|
||||
{
|
||||
if (IsShowCheckBox)
|
||||
{
|
||||
intColumnsCount++;
|
||||
}
|
||||
this.panCells.ColumnCount = intColumnsCount;
|
||||
for (int i = 0; i < intColumnsCount; i++)
|
||||
{
|
||||
Control c = null;
|
||||
if (i == 0 && IsShowCheckBox)
|
||||
{
|
||||
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(SizeType.Absolute, 30F));
|
||||
|
||||
UCCheckBox box = new UCCheckBox();
|
||||
box.Name = "check";
|
||||
box.TextValue = "";
|
||||
box.Size = new Size(30, 30);
|
||||
box.Dock = DockStyle.Fill;
|
||||
box.CheckedChangeEvent += (a, b) =>
|
||||
{
|
||||
IsChecked = box.Checked;
|
||||
if (CheckBoxChangeEvent != null)
|
||||
{
|
||||
CheckBoxChangeEvent(a, new DataGridViewEventArgs()
|
||||
{
|
||||
RowIndex = this.RowIndex,
|
||||
CellControl = box,
|
||||
CellIndex = 0
|
||||
});
|
||||
}
|
||||
};
|
||||
c = box;
|
||||
}
|
||||
else
|
||||
{
|
||||
var item = Columns[i - (IsShowCheckBox ? 1 : 0)];
|
||||
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(item.WidthType, item.Width));
|
||||
|
||||
if (item.CustomCellType == null)
|
||||
{
|
||||
Label lbl = new Label();
|
||||
lbl.Tag = i - (IsShowCheckBox ? 1 : 0);
|
||||
lbl.Name = "lbl_" + item.DataField;
|
||||
lbl.Font = new Font("微软雅黑", 12);
|
||||
lbl.ForeColor = Color.Black;
|
||||
lbl.AutoSize = false;
|
||||
lbl.Dock = DockStyle.Fill;
|
||||
lbl.TextAlign = item.TextAlign;
|
||||
lbl.MouseDown += (a, b) =>
|
||||
{
|
||||
Item_MouseDown(a, b);
|
||||
};
|
||||
c = lbl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Control cc = (Control)Activator.CreateInstance(item.CustomCellType);
|
||||
cc.Dock = DockStyle.Fill;
|
||||
c = cc;
|
||||
}
|
||||
}
|
||||
this.panCells.Controls.Add(c, i, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlHelper.FreezeControl(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||