1、优化LOG显示与引用

2、添加PMA工具,工具内容待完善
3、修复流程树显示
4、添加开源项目,优化UI空间
5、其他BUG更改
This commit is contained in:
liu.wenjie
2021-11-23 15:51:37 +08:00
parent 47f77f5e64
commit a24dda2525
474 changed files with 91916 additions and 6429 deletions

View File

@@ -0,0 +1,43 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-22-2019
//
// ***********************************************************************
// <copyright file="IListViewItem.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://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>
/// Interface IListViewItem
/// </summary>
public interface IListViewItem
{
/// <summary>
/// 数据源
/// </summary>
/// <value>The data source.</value>
object DataSource { get; set; }
/// <summary>
/// 选中项事件
/// </summary>
event EventHandler SelectedItemEvent;
/// <summary>
/// 选中处理,一般用以更改选中效果
/// </summary>
/// <param name="blnSelected">是否选中</param>
void SetSelected(bool blnSelected);
}
}

View File

@@ -0,0 +1,132 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="UCHorizontalList.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCHorizontalList.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
partial class UCHorizontalList
{
/// <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.panMain = new System.Windows.Forms.Panel();
this.panList = new System.Windows.Forms.Panel();
this.panRight = new System.Windows.Forms.Panel();
this.panLeft = new System.Windows.Forms.Panel();
this.panMain.SuspendLayout();
this.SuspendLayout();
//
// panMain
//
this.panMain.Controls.Add(this.panList);
this.panMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.panMain.Location = new System.Drawing.Point(46, 0);
this.panMain.Name = "panMain";
this.panMain.Size = new System.Drawing.Size(422, 53);
this.panMain.TabIndex = 3;
//
// panList
//
this.panList.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.panList.BackColor = System.Drawing.Color.Transparent;
this.panList.Location = new System.Drawing.Point(0, 0);
this.panList.Name = "panList";
this.panList.Size = new System.Drawing.Size(401, 53);
this.panList.TabIndex = 0;
//
// panRight
//
this.panRight.BackgroundImage = global::HZH_Controls.Properties.Resources.chevron_right;
this.panRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.panRight.Dock = System.Windows.Forms.DockStyle.Right;
this.panRight.Location = new System.Drawing.Point(468, 0);
this.panRight.Name = "panRight";
this.panRight.Size = new System.Drawing.Size(46, 53);
this.panRight.TabIndex = 2;
this.panRight.Visible = false;
this.panRight.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panRight_MouseDown);
//
// panLeft
//
this.panLeft.BackgroundImage = global::HZH_Controls.Properties.Resources.chevron_left;
this.panLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.panLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.panLeft.Location = new System.Drawing.Point(0, 0);
this.panLeft.Name = "panLeft";
this.panLeft.Size = new System.Drawing.Size(46, 53);
this.panLeft.TabIndex = 1;
this.panLeft.Visible = false;
this.panLeft.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panLeft_MouseDown);
//
// UCHorizontalList
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.panMain);
this.Controls.Add(this.panRight);
this.Controls.Add(this.panLeft);
this.Name = "UCHorizontalList";
this.Size = new System.Drawing.Size(514, 53);
this.panMain.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The pan left
/// </summary>
private System.Windows.Forms.Panel panLeft;
/// <summary>
/// The pan right
/// </summary>
private System.Windows.Forms.Panel panRight;
/// <summary>
/// The pan main
/// </summary>
private System.Windows.Forms.Panel panMain;
/// <summary>
/// The pan list
/// </summary>
private System.Windows.Forms.Panel panList;
}
}

View File

@@ -0,0 +1,261 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="UCHorizontalList.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://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 UCHorizontalList.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
public partial class UCHorizontalList : UserControl
{
/// <summary>
/// Gets or sets the selected item.
/// </summary>
/// <value>The selected item.</value>
public UCHorizontalListItem SelectedItem { get; set; }
/// <summary>
/// Occurs when [selected item event].
/// </summary>
public event EventHandler SelectedItemEvent;
/// <summary>
/// The m start item index
/// </summary>
private int m_startItemIndex = 0;
/// <summary>
/// The is automatic select first
/// </summary>
private bool isAutoSelectFirst = true;
/// <summary>
/// Gets or sets a value indicating whether this instance is automatic select first.
/// </summary>
/// <value><c>true</c> if this instance is automatic select first; otherwise, <c>false</c>.</value>
public bool IsAutoSelectFirst
{
get { return isAutoSelectFirst; }
set { isAutoSelectFirst = value; }
}
/// <summary>
/// The data source
/// </summary>
private List<KeyValuePair<string, string>> dataSource = null;
/// <summary>
/// Gets or sets the data source.
/// </summary>
/// <value>The data source.</value>
public List<KeyValuePair<string, string>> DataSource
{
get { return dataSource; }
set
{
dataSource = value;
ReloadSource();
}
}
private Color selectedColor = Color.FromArgb(255, 77, 59);
[Description("选中颜色"), Category("自定义")]
public Color SelectedColor
{
get { return selectedColor; }
set { selectedColor = value; }
}
/// <summary>
/// Initializes a new instance of the <see cref="UCHorizontalList" /> class.
/// </summary>
public UCHorizontalList()
{
InitializeComponent();
}
/// <summary>
/// Reloads the source.
/// </summary>
public void ReloadSource()
{
try
{
ControlHelper.FreezeControl(this, true);
this.panList.SuspendLayout();
this.panList.Controls.Clear();
this.panList.Width = this.panMain.Width;
if (DataSource != null)
{
foreach (var item in DataSource)
{
UCHorizontalListItem uc = new UCHorizontalListItem();
uc.SelectedColor = selectedColor;
uc.DataSource = item;
uc.SelectedItem += uc_SelectItem;
this.panList.Controls.Add(uc);
}
}
this.panList.ResumeLayout(true);
if (this.panList.Controls.Count > 0)
this.panList.Width = panMain.Width + this.panList.Controls[0].Location.X * -1;
this.panList.Location = new Point(0, 0);
m_startItemIndex = 0;
if (this.panList.Width > panMain.Width)
panRight.Visible = true;
else
panRight.Visible = false;
panLeft.Visible = false;
panList.SendToBack();
panRight.SendToBack();
if (isAutoSelectFirst && DataSource != null && DataSource.Count > 0)
{
SelectItem((UCHorizontalListItem)this.panList.Controls[0]);
}
}
finally
{
ControlHelper.FreezeControl(this, false);
}
}
/// <summary>
/// Handles the SelectItem event of the uc 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 uc_SelectItem(object sender, EventArgs e)
{
SelectItem(sender as UCHorizontalListItem);
}
/// <summary>
/// Selects the item.
/// </summary>
/// <param name="item">The item.</param>
private void SelectItem(UCHorizontalListItem item)
{
if (SelectedItem != null && !SelectedItem.IsDisposed)
SelectedItem.SetSelect(false);
SelectedItem = item;
SelectedItem.SetSelect(true);
if (SelectedItemEvent != null)
SelectedItemEvent(item, null);
}
/// <summary>
/// Handles the MouseDown event of the panLeft 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 panLeft_MouseDown(object sender, MouseEventArgs e)
{
if (this.panList.Location.X >= 0)
{
this.panList.Location = new Point(0, 0);
return;
}
for (int i = m_startItemIndex; i >= 0; i--)
{
if (this.panList.Controls[i].Location.X < this.panList.Controls[m_startItemIndex].Location.X - panMain.Width)
{
m_startItemIndex = i + 1;
break; ;
}
if (i == 0)
{
m_startItemIndex = 0;
}
}
ResetListLocation();
panRight.Visible = true;
if (this.panList.Location.X >= 0)
{
panLeft.Visible = false;
}
else
{
panLeft.Visible = true;
}
panList.SendToBack();
panRight.SendToBack();
}
/// <summary>
/// Handles the MouseDown event of the panRight 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 panRight_MouseDown(object sender, MouseEventArgs e)
{
if (this.panList.Location.X + this.panList.Width <= this.panMain.Width)
return;
if (this.panList.Controls.Count <= 0)
return;
for (int i = m_startItemIndex; i < this.panList.Controls.Count; i++)
{
if (this.panList.Location.X + this.panList.Controls[i].Location.X + this.panList.Controls[i].Width > panMain.Width)
{
m_startItemIndex = i;
break;
}
}
ResetListLocation();
panLeft.Visible = true;
if (panList.Width + panList.Location.X <= panMain.Width)
panRight.Visible = false;
else
panRight.Visible = true;
panList.SendToBack();
panRight.SendToBack();
}
/// <summary>
/// Resets the list location.
/// </summary>
private void ResetListLocation()
{
if (this.panList.Controls.Count > 0)
{
this.panList.Location = new Point(this.panList.Controls[m_startItemIndex].Location.X * -1, 0);
}
}
/// <summary>
/// Sets the select.
/// </summary>
/// <param name="strKey">The string key.</param>
public void SetSelect(string strKey)
{
foreach (UCHorizontalListItem item in this.panList.Controls)
{
if (item.DataSource.Key == strKey)
{
SelectItem(item);
return;
}
}
}
}
}

View 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>

View File

@@ -0,0 +1,101 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="UCHorizontalListItem.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCHorizontalListItem.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
partial class UCHorizontalListItem
{
/// <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.lblTitle = new System.Windows.Forms.Label();
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
this.SuspendLayout();
//
// lblTitle
//
this.lblTitle.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblTitle.Font = new System.Drawing.Font("微软雅黑", 10F);
this.lblTitle.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.lblTitle.Location = new System.Drawing.Point(1, 0);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10);
this.lblTitle.Size = new System.Drawing.Size(118, 50);
this.lblTitle.TabIndex = 1;
this.lblTitle.Text = "项目名称";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// ucSplitLine_H1
//
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ucSplitLine_H1.Location = new System.Drawing.Point(1, 50);
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
this.ucSplitLine_H1.Size = new System.Drawing.Size(118, 3);
this.ucSplitLine_H1.TabIndex = 0;
this.ucSplitLine_H1.TabStop = false;
//
// UCHorizontalListItem
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.lblTitle);
this.Controls.Add(this.ucSplitLine_H1);
this.Name = "UCHorizontalListItem";
this.Padding = new System.Windows.Forms.Padding(1, 0, 1, 0);
this.Size = new System.Drawing.Size(120, 53);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The uc split line h1
/// </summary>
private UCSplitLine_H ucSplitLine_H1;
/// <summary>
/// The label title
/// </summary>
private System.Windows.Forms.Label lblTitle;
}
}

View File

@@ -0,0 +1,115 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="UCHorizontalListItem.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://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 UCHorizontalListItem.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
[ToolboxItem(false)]
public partial class UCHorizontalListItem : UserControl
{
/// <summary>
/// Occurs when [selected item].
/// </summary>
public event EventHandler SelectedItem;
/// <summary>
/// The data source
/// </summary>
private KeyValuePair<string, string> _DataSource = new KeyValuePair<string, string>();
/// <summary>
/// Gets or sets the data source.
/// </summary>
/// <value>The data source.</value>
public KeyValuePair<string, string> DataSource
{
get { return _DataSource; }
set
{
_DataSource = value;
var g = lblTitle.CreateGraphics();
int intWidth = ControlHelper.GetStringWidth(value.Value, g, lblTitle.Font);
g.Dispose();
if (intWidth < 50)
intWidth = 50;
this.Width = intWidth + 20;
lblTitle.Text = value.Value;
SetSelect(false);
}
}
private Color selectedColor = Color.FromArgb(255, 77, 59);
public Color SelectedColor
{
get { return selectedColor; }
set { selectedColor = value; }
}
/// <summary>
/// Initializes a new instance of the <see cref="UCHorizontalListItem" /> class.
/// </summary>
public UCHorizontalListItem()
{
InitializeComponent();
this.Dock = DockStyle.Right;
this.MouseDown += Item_MouseDown;
this.lblTitle.MouseDown += Item_MouseDown;
this.ucSplitLine_H1.MouseDown += Item_MouseDown;
}
/// <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 (SelectedItem != null)
SelectedItem(this, e);
}
/// <summary>
/// Sets the select.
/// </summary>
/// <param name="bln">if set to <c>true</c> [BLN].</param>
public void SetSelect(bool bln)
{
if (bln)
{
lblTitle.ForeColor = selectedColor;
ucSplitLine_H1.BackColor = selectedColor;
ucSplitLine_H1.Visible = true;
this.lblTitle.Padding = new Padding(0, 0, 0, 5);
}
else
{
lblTitle.ForeColor = Color.FromArgb(64, 64, 64);
ucSplitLine_H1.Visible = false;
this.lblTitle.Padding = new Padding(0, 0, 0, 0);
}
}
}
}

View 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>

View File

@@ -0,0 +1,65 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="UCListExt.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCListExt.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
partial class UCListExt
{
/// <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();
//
// ListExt
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoScroll = true;
this.Name = "ListExt";
this.Size = new System.Drawing.Size(336, 368);
this.ResumeLayout(false);
}
#endregion
}
}

View File

@@ -0,0 +1,359 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="UCListExt.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://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 UCListExt.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
[DefaultEvent("ItemClick")]
public partial class UCListExt : UserControl
{
/// <summary>
/// The title font
/// </summary>
private Font _titleFont = new Font("微软雅黑", 15F);
/// <summary>
/// Gets or sets the title font.
/// </summary>
/// <value>The title font.</value>
[Description("标题字体"), Category("自定义")]
public Font TitleFont
{
get { return _titleFont; }
set { _titleFont = value; }
}
/// <summary>
/// The title2 font
/// </summary>
private Font _title2Font = new Font("微软雅黑", 14F);
/// <summary>
/// Gets or sets the title2 font.
/// </summary>
/// <value>The title2 font.</value>
[Description("副标题字体"), Category("自定义")]
public Font Title2Font
{
get { return _title2Font; }
set { _title2Font = value; }
}
/// <summary>
/// The item back color
/// </summary>
private Color _itemBackColor = Color.White;
/// <summary>
/// Gets or sets the color of the item back.
/// </summary>
/// <value>The color of the item back.</value>
[Description("标题背景色"), Category("自定义")]
public Color ItemBackColor
{
get { return _itemBackColor; }
set { _itemBackColor = value; }
}
/// <summary>
/// The item selected back color
/// </summary>
private Color _itemSelectedBackColor = Color.FromArgb(255, 77, 59);
/// <summary>
/// Gets or sets the color of the item selected back.
/// </summary>
/// <value>The color of the item selected back.</value>
[Description("标题选中背景色"), Category("自定义")]
public Color ItemSelectedBackColor
{
get { return _itemSelectedBackColor; }
set { _itemSelectedBackColor = value; }
}
/// <summary>
/// The item fore color
/// </summary>
private Color _itemForeColor = Color.Black;
/// <summary>
/// Gets or sets the color of the item fore.
/// </summary>
/// <value>The color of the item fore.</value>
[Description("标题文本色"), Category("自定义")]
public Color ItemForeColor
{
get { return _itemForeColor; }
set { _itemForeColor = value; }
}
/// <summary>
/// The item selected fore color
/// </summary>
private Color _itemSelectedForeColor = Color.White;
/// <summary>
/// Gets or sets the color of the item selected fore.
/// </summary>
/// <value>The color of the item selected fore.</value>
[Description("标题选中文本色"), Category("自定义")]
public Color ItemSelectedForeColor
{
get { return _itemSelectedForeColor; }
set { _itemSelectedForeColor = value; }
}
/// <summary>
/// The item fore color2
/// </summary>
private Color _itemForeColor2 = Color.FromArgb(255, 77, 59);
/// <summary>
/// Gets or sets the item fore color2.
/// </summary>
/// <value>The item fore color2.</value>
[Description("副标题文本色"), Category("自定义")]
public Color ItemForeColor2
{
get { return _itemForeColor2; }
set { _itemForeColor2 = value; }
}
/// <summary>
/// The item selected fore color2
/// </summary>
private Color _itemSelectedForeColor2 = Color.White;
/// <summary>
/// Gets or sets the item selected fore color2.
/// </summary>
/// <value>The item selected fore color2.</value>
[Description("副标题选中文本色"), Category("自定义")]
public Color ItemSelectedForeColor2
{
get { return _itemSelectedForeColor2; }
set { _itemSelectedForeColor2 = value; }
}
/// <summary>
/// The item height
/// </summary>
private int _itemHeight = 60;
/// <summary>
/// Gets or sets the height of the item.
/// </summary>
/// <value>The height of the item.</value>
[Description("项高度"), Category("自定义")]
public int ItemHeight
{
get { return _itemHeight; }
set { _itemHeight = value; }
}
/// <summary>
/// The automatic select first
/// </summary>
private bool _autoSelectFirst = true;
/// <summary>
/// Gets or sets a value indicating whether [automatic select first].
/// </summary>
/// <value><c>true</c> if [automatic select first]; otherwise, <c>false</c>.</value>
[Description("自动选中第一项"), Category("自定义")]
public bool AutoSelectFirst
{
get { return _autoSelectFirst; }
set { _autoSelectFirst = value; }
}
/// <summary>
/// Delegate ItemClickEvent
/// </summary>
/// <param name="item">The item.</param>
public delegate void ItemClickEvent(UCListItemExt item);
/// <summary>
/// Occurs when [item click].
/// </summary>
[Description("选中项事件"), Category("自定义")]
public event ItemClickEvent ItemClick;
/// <summary>
/// The selected can click
/// </summary>
private bool _selectedCanClick = false;
/// <summary>
/// Gets or sets a value indicating whether [selected can click].
/// </summary>
/// <value><c>true</c> if [selected can click]; otherwise, <c>false</c>.</value>
[Description("选中后是否可以再次触发点击事件"), Category("自定义")]
public bool SelectedCanClick
{
get { return _selectedCanClick; }
set { _selectedCanClick = value; }
}
private Color splitColor = Color.FromArgb(238, 238, 238);
[Description("分割线颜色"), Category("自定义"), Browsable(true)]
public Color SplitColor
{
get { return splitColor; }
set { splitColor = value; }
}
/// <summary>
/// 选中的节点
/// </summary>
/// <value>The select item.</value>
public UCListItemExt SelectItem
{
get { return _current; }
}
/// <summary>
/// The current
/// </summary>
UCListItemExt _current = null;
/// <summary>
/// Initializes a new instance of the <see cref="UCListExt" /> class.
/// </summary>
public UCListExt()
{
InitializeComponent();
SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
this.UpdateStyles();
}
/// <summary>
/// Sets the list.
/// </summary>
/// <param name="lst">The LST.</param>
public void SetList(List<ListEntity> lst)
{
try
{
ControlHelper.FreezeControl(this, true);
this.Controls.Clear();
this.SuspendLayout();
UCListItemExt _first = null;
for (int i = lst.Count - 1; i >= 0; i--)
{
var item = lst[i];
UCListItemExt li = new UCListItemExt();
li.SplitColor = splitColor;
li.Height = _itemHeight;
li.TitleFont = _titleFont;
li.Title2Font = _title2Font;
li.ItemBackColor = _itemBackColor;
li.ItemForeColor = _itemForeColor;
li.ItemForeColor2 = _itemForeColor2;
li.Dock = DockStyle.Top;
li.SetData(item);
li.ItemClick += (s, e) => { SelectLabel((UCListItemExt)s); };
this.Controls.Add(li);
_first = li;
}
if (_autoSelectFirst)
SelectLabel(_first);
this.ResumeLayout(false);
Timer timer = new Timer();
timer.Interval = 10;
timer.Tick += (a, b) =>
{
timer.Enabled = false;
this.VerticalScroll.Value = 1;
this.VerticalScroll.Value = 0;
this.Refresh();
};
timer.Enabled = true;
}
finally
{
ControlHelper.FreezeControl(this, false);
}
}
/// <summary>
/// Selects the label.
/// </summary>
/// <param name="li">The li.</param>
private void SelectLabel(UCListItemExt li)
{
try
{
HZH_Controls.ControlHelper.FreezeControl(this, true);
this.FindForm().ActiveControl = this;
if (_current != null)
{
if (_current == li && !_selectedCanClick)
return;
_current.ItemBackColor = _itemBackColor;
_current.ItemForeColor = _itemForeColor;
_current.ItemForeColor2 = _itemForeColor2;
}
li.ItemBackColor = _itemSelectedBackColor;
li.ItemForeColor = _itemSelectedForeColor;
li.ItemForeColor2 = _itemSelectedForeColor2;
_current = li;
if (ItemClick != null)
{
ItemClick(li);
}
}
finally
{
HZH_Controls.ControlHelper.FreezeControl(this, false);
}
}
}
/// <summary>
/// 列表实体
/// </summary>
[Serializable]
public class ListEntity
{
/// <summary>
/// 编码,唯一值
/// </summary>
/// <value>The identifier.</value>
public string ID { get; set; }
/// <summary>
/// 大标题
/// </summary>
/// <value>The title.</value>
public string Title { get; set; }
/// <summary>
/// 右侧更多按钮
/// </summary>
/// <value><c>true</c> if [show more BTN]; otherwise, <c>false</c>.</value>
public bool ShowMoreBtn { get; set; }
/// <summary>
/// 右侧副标题
/// </summary>
/// <value>The title2.</value>
public string Title2 { get; set; }
/// <summary>
/// 关联的数据源
/// </summary>
/// <value>The source.</value>
public object Source { get; set; }
}
}

View 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>

View File

@@ -0,0 +1,138 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="UCListItemExt.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCListItemExt.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
partial class UCListItemExt
{
/// <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.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.splitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Padding = new System.Windows.Forms.Padding(15, 0, 0, 0);
this.label1.Size = new System.Drawing.Size(173, 48);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.label1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.item_MouseDown);
//
// label3
//
this.label3.Dock = System.Windows.Forms.DockStyle.Right;
this.label3.Font = new System.Drawing.Font("微软雅黑", 14F);
this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(73)))), ((int)(((byte)(119)))), ((int)(((byte)(232)))));
this.label3.Location = new System.Drawing.Point(173, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(139, 48);
this.label3.TabIndex = 2;
this.label3.Text = "label3";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.item_MouseDown);
//
// splitLine_H1
//
this.splitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
this.splitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.splitLine_H1.Location = new System.Drawing.Point(0, 48);
this.splitLine_H1.MaximumSize = new System.Drawing.Size(0, 1);
this.splitLine_H1.Name = "splitLine_H1";
this.splitLine_H1.Size = new System.Drawing.Size(355, 1);
this.splitLine_H1.TabIndex = 3;
this.splitLine_H1.TabStop = false;
//
// label2
//
this.label2.Dock = System.Windows.Forms.DockStyle.Right;
this.label2.Image = global::HZH_Controls.Properties.Resources.more1;
this.label2.Location = new System.Drawing.Point(312, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(43, 48);
this.label2.TabIndex = 1;
this.label2.Visible = false;
this.label2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.item_MouseDown);
//
// UCListItemExt
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.label1);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.splitLine_H1);
this.Name = "UCListItemExt";
this.Size = new System.Drawing.Size(355, 49);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The label1
/// </summary>
private System.Windows.Forms.Label label1;
/// <summary>
/// The label2
/// </summary>
private System.Windows.Forms.Label label2;
/// <summary>
/// The label3
/// </summary>
private System.Windows.Forms.Label label3;
/// <summary>
/// The split line h1
/// </summary>
private UCSplitLine_H splitLine_H1;
}
}

View File

@@ -0,0 +1,197 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="UCListItemExt.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://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 UCListItemExt.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
[ToolboxItem(false)]
public partial class UCListItemExt : UserControl
{
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>The title.</value>
[Description("标题"), Category("自定义")]
public string Title
{
get { return label1.Text; }
set { label1.Text = value; }
}
/// <summary>
/// Gets or sets the title2.
/// </summary>
/// <value>The title2.</value>
[Description("副标题"), Category("自定义")]
public string Title2
{
get { return label3.Text; }
set
{
label3.Text = value;
label3.Visible = !string.IsNullOrEmpty(value);
var g = label3.CreateGraphics();
var size = g.MeasureString(value, label3.Font);
label3.Width = (int)size.Width + 10;
}
}
/// <summary>
/// Gets or sets the title font.
/// </summary>
/// <value>The title font.</value>
[Description("标题字体"), Category("自定义")]
public Font TitleFont
{
get { return label1.Font; }
set
{
label1.Font = value;
}
}
/// <summary>
/// Gets or sets the title2 font.
/// </summary>
/// <value>The title2 font.</value>
[Description("副标题字体"), Category("自定义")]
public Font Title2Font
{
get { return label3.Font; }
set
{
label3.Font = value;
}
}
/// <summary>
/// Gets or sets the color of the item back.
/// </summary>
/// <value>The color of the item back.</value>
[Description("背景色"), Category("自定义")]
public Color ItemBackColor
{
get { return this.BackColor; }
set
{
this.BackColor = value;
}
}
/// <summary>
/// Gets or sets the color of the item fore.
/// </summary>
/// <value>The color of the item fore.</value>
[Description("标题文本色"), Category("自定义")]
public Color ItemForeColor
{
get { return label1.ForeColor; }
set { label1.ForeColor = value; }
}
/// <summary>
/// Gets or sets the item fore color2.
/// </summary>
/// <value>The item fore color2.</value>
[Description("副标题文本色"), Category("自定义")]
public Color ItemForeColor2
{
get { return label3.ForeColor; }
set { label3.ForeColor = value; }
}
/// <summary>
/// Gets or sets a value indicating whether [show more BTN].
/// </summary>
/// <value><c>true</c> if [show more BTN]; otherwise, <c>false</c>.</value>
[Description("是否显示右侧更多箭头"), Category("自定义")]
public bool ShowMoreBtn
{
get { return label2.Visible; }
set { label2.Visible = value; ; }
}
/// <summary>
/// Occurs when [item click].
/// </summary>
[Description("项选中事件"), Category("自定义")]
public event EventHandler ItemClick;
/// <summary>
/// 数据源
/// </summary>
/// <value>The data source.</value>
public ListEntity DataSource { get; private set; }
[Description("分割线颜色"), Category("自定义")]
public Color SplitColor
{
get { return this.splitLine_H1.BackColor; }
set { this.splitLine_H1.BackColor = value; }
}
/// <summary>
/// Initializes a new instance of the <see cref="UCListItemExt" /> class.
/// </summary>
public UCListItemExt()
{
InitializeComponent();
SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
this.UpdateStyles();
}
/// <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>
private void item_MouseDown(object sender, MouseEventArgs e)
{
if (ItemClick != null)
{
ItemClick(this, e);
}
}
#region
/// <summary>
/// 功能描述:设置数据
/// 作  者:HZH
/// 创建日期:2019-02-27 11:52:52
/// 任务编号:POS
/// </summary>
/// <param name="data">data</param>
public void SetData(ListEntity data)
{
this.Title = data.Title;
this.Title2 = data.Title2;
this.ShowMoreBtn = data.ShowMoreBtn;
DataSource = data;
}
#endregion
}
}

View 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>

View File

@@ -0,0 +1,101 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-22-2019
//
// ***********************************************************************
// <copyright file="UCListView.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCListView.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
partial class UCListView
{
/// <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.panMain = new System.Windows.Forms.FlowLayoutPanel();
this.panPage = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// panMain
//
this.panMain.AutoScroll = true;
this.panMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.panMain.Location = new System.Drawing.Point(0, 0);
this.panMain.Margin = new System.Windows.Forms.Padding(0);
this.panMain.Name = "panMain";
this.panMain.Padding = new System.Windows.Forms.Padding(5);
this.panMain.Size = new System.Drawing.Size(462, 319);
this.panMain.TabIndex = 1;
this.panMain.Resize += new System.EventHandler(this.panMain_Resize);
//
// panPage
//
this.panPage.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panPage.Location = new System.Drawing.Point(0, 319);
this.panPage.Name = "panPage";
this.panPage.Size = new System.Drawing.Size(462, 44);
this.panPage.TabIndex = 0;
this.panPage.Visible = false;
//
// UCListView
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.panMain);
this.Controls.Add(this.panPage);
this.Margin = new System.Windows.Forms.Padding(0);
this.Name = "UCListView";
this.Size = new System.Drawing.Size(462, 363);
this.Load += new System.EventHandler(this.UCListView_Load);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The pan main
/// </summary>
private System.Windows.Forms.FlowLayoutPanel panMain;
/// <summary>
/// The pan page
/// </summary>
private System.Windows.Forms.Panel panPage;
}
}

View File

@@ -0,0 +1,457 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-22-2019
//
// ***********************************************************************
// <copyright file="UCListView.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://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 UCListView.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
[DefaultEvent("SelectedItemEvent")]
public partial class UCListView : UserControl
{
/// <summary>
/// The m int cell width
/// </summary>
int m_intCellWidth = 130;//单元格宽度
/// <summary>
/// The m int cell height
/// </summary>
int m_intCellHeight = 120;//单元格高度
/// <summary>
/// The m item type
/// </summary>
private Type m_itemType = typeof(UCListViewItem);
/// <summary>
/// Gets or sets the type of the item.
/// </summary>
/// <value>The type of the item.</value>
/// <exception cref="System.Exception">单元格控件没有继承实现接口IListViewItem</exception>
/// <exception cref="Exception">单元格控件没有继承实现接口IListViewItem</exception>
[Description("单元格类型如果无法满足您的需求你可以自定义单元格控件并实现接口IListViewItem"), Category("自定义")]
public Type ItemType
{
get { return m_itemType; }
set
{
if (!typeof(IListViewItem).IsAssignableFrom(value) || !value.IsSubclassOf(typeof(Control)))
throw new Exception("单元格控件没有继承实现接口IListViewItem");
m_itemType = value;
}
}
/// <summary>
/// The m page
/// </summary>
private UCPagerControlBase m_page = null;
/// <summary>
/// 翻页控件
/// </summary>
/// <value>The page.</value>
/// <exception cref="System.Exception">翻页控件没有继承UCPagerControlBase</exception>
/// <exception cref="Exception">翻页控件没有继承UCPagerControlBase</exception>
[Description("翻页控件如果UCPagerControl不满足你的需求请自定义翻页控件并继承UCPagerControlBase"), Category("自定义")]
public UCPagerControlBase Page
{
get { return m_page; }
set
{
m_page = value;
if (value != null)
{
if (!typeof(IPageControl).IsAssignableFrom(value.GetType()) || !value.GetType().IsSubclassOf(typeof(UCPagerControlBase)))
throw new Exception("翻页控件没有继承UCPagerControlBase");
this.panMain.AutoScroll = false;
panPage.Visible = true;
this.Controls.SetChildIndex(panMain, 0);
m_page.ShowSourceChanged += m_page_ShowSourceChanged;
m_page.Dock = DockStyle.Fill;
this.panPage.Controls.Clear();
this.panPage.Controls.Add(m_page);
GetCellCount();
this.DataSource = m_page.GetCurrentSource();
}
else
{
this.panMain.AutoScroll = true;
m_page = null;
panPage.Visible = false;
}
}
}
/// <summary>
/// The m data source
/// </summary>
private object m_dataSource = null;
/// <summary>
/// Gets or sets the data source.
/// </summary>
/// <value>The data source.</value>
/// <exception cref="System.Exception">数据源不是有效的数据类型,列表</exception>
/// <exception cref="Exception">数据源不是有效的数据类型,列表</exception>
[Description("数据源,如果使用翻页控件请使用翻页控件的DataSource"), Category("自定义")]
public object DataSource
{
get { return m_dataSource; }
set
{
if (value == null)
{
m_dataSource = value;
ReloadSource();
return;
}
if (!typeof(IList).IsAssignableFrom(value.GetType()))
{
throw new Exception("数据源不是有效的数据类型,列表");
}
m_dataSource = value;
ReloadSource();
}
}
/// <summary>
/// The m int cell count
/// </summary>
int m_intCellCount = 0;//单元格总数
/// <summary>
/// Gets the cell count.
/// </summary>
/// <value>The cell count.</value>
[Description("单元格总数"), Category("自定义")]
public int CellCount
{
get { return m_intCellCount; }
private set
{
m_intCellCount = value;
if (value > 0 && m_page != null)
{
m_page.PageSize = m_intCellCount;
m_page.Reload();
}
}
}
/// <summary>
/// The m selected source
/// </summary>
private List<object> m_selectedSource = new List<object>();
/// <summary>
/// Gets or sets the selected source.
/// </summary>
/// <value>The selected source.</value>
[Description("选中的数据"), Category("自定义")]
public List<object> SelectedSource
{
get { return m_selectedSource; }
set
{
m_selectedSource = value;
ReloadSource();
}
}
/// <summary>
/// The m is multiple
/// </summary>
private bool m_isMultiple = true;
/// <summary>
/// Gets or sets a value indicating whether this instance is multiple.
/// </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>
/// Occurs when [selected item event].
/// </summary>
[Description("选中项事件"), Category("自定义")]
public event EventHandler SelectedItemEvent;
/// <summary>
/// Delegate ReloadGridStyleEventHandle
/// </summary>
/// <param name="intCellCount">The int cell count.</param>
public delegate void ReloadGridStyleEventHandle(int intCellCount);
/// <summary>
/// 样式改变事件
/// </summary>
[Description("样式改变事件"), Category("自定义")]
public event ReloadGridStyleEventHandle ReloadGridStyleEvent;
/// <summary>
/// Initializes a new instance of the <see cref="UCListView" /> class.
/// </summary>
public UCListView()
{
InitializeComponent();
}
/// <summary>
/// ms the page show source changed.
/// </summary>
/// <param name="currentSource">The current source.</param>
void m_page_ShowSourceChanged(object currentSource)
{
this.DataSource = currentSource;
}
#region
/// <summary>
/// 功能描述:重新加载数据源
/// 作  者:HZH
/// 创建日期:2019-06-27 16:47:32
/// 任务编号:POS
/// </summary>
public void ReloadSource()
{
try
{
if (DesignMode)
return;
ControlHelper.FreezeControl(this, true);
if (this.panMain.Controls.Count <= 0)
{
ReloadGridStyle();
}
if (m_dataSource == null || ((IList)m_dataSource).Count <= 0)
{
for (int i = this.panMain.Controls.Count - 1; i >= 0; i--)
{
this.panMain.Controls[i].Visible = false;
}
return;
}
int intCount = Math.Min(((IList)m_dataSource).Count, this.panMain.Controls.Count);
for (int i = 0; i < intCount; i++)
{
((IListViewItem)this.panMain.Controls[i]).DataSource = ((IList)m_dataSource)[i];
if (m_selectedSource.Contains(((IList)m_dataSource)[i]))
{
((IListViewItem)this.panMain.Controls[i]).SetSelected(true);
}
else
{
((IListViewItem)this.panMain.Controls[i]).SetSelected(false);
}
this.panMain.Controls[i].Visible = true;
}
for (int i = this.panMain.Controls.Count - 1; i >= intCount; i--)
{
if (this.panMain.Controls[i].Visible)
this.panMain.Controls[i].Visible = false;
}
}
finally
{
ControlHelper.FreezeControl(this, false);
}
}
#endregion
#region
/// <summary>
/// 功能描述:刷新表格样式
/// 作  者:HZH
/// 创建日期:2019-06-27 16:35:25
/// 任务编号:POS
/// </summary>
public void ReloadGridStyle()
{
if (DesignMode)
return;
Form frmMain = this.FindForm();
if (frmMain != null && !frmMain.IsDisposed && frmMain.Visible && this.Visible)
{
GetCellCount();
try
{
ControlHelper.FreezeControl(this, true);
if (this.panMain.Controls.Count < m_intCellCount)
{
int intControlsCount = this.panMain.Controls.Count;
for (int i = 0; i < m_intCellCount - intControlsCount; i++)
{
Control uc = (Control)Activator.CreateInstance(m_itemType);
uc.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
(uc as IListViewItem).SelectedItemEvent += UCListView_SelectedItemEvent;
uc.Visible = false;
this.panMain.Controls.Add(uc);
}
}
else if (this.panMain.Controls.Count > m_intCellCount)
{
int intControlsCount = this.panMain.Controls.Count;
for (int i = intControlsCount - 1; i > m_intCellCount - 1; i--)
{
this.panMain.Controls.RemoveAt(i);
}
}
foreach (Control item in this.panMain.Controls)
{
item.Size = new Size(m_intCellWidth, m_intCellHeight);
}
}
finally
{
ControlHelper.FreezeControl(this, false);
}
if (ReloadGridStyleEvent != null)
{
ReloadGridStyleEvent(m_intCellCount);
}
}
}
/// <summary>
/// Handles the SelectedItemEvent event of the UCListView 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 UCListView_SelectedItemEvent(object sender, EventArgs e)
{
var selectedItem = sender as IListViewItem;
if (m_selectedSource.Contains(selectedItem.DataSource))
{
m_selectedSource.Remove(selectedItem.DataSource);
selectedItem.SetSelected(false);
}
else
{
if (m_isMultiple)
{
m_selectedSource.Add(selectedItem.DataSource);
selectedItem.SetSelected(true);
}
else
{
if (m_selectedSource.Count > 0)
{
int intCount = Math.Min(((IList)m_dataSource).Count, this.panMain.Controls.Count);
for (int i = 0; i < intCount; i++)
{
var item = ((IListViewItem)this.panMain.Controls[i]);
if (m_selectedSource.Contains(item.DataSource))
{
item.SetSelected(false);
break;
}
}
}
m_selectedSource = new List<object>() { selectedItem.DataSource };
selectedItem.SetSelected(true);
}
}
if (SelectedItemEvent != null)
{
SelectedItemEvent(sender, e);
}
}
#endregion
#region cell总数
/// <summary>
/// 功能描述:获取cell总数
/// 作  者:HZH
/// 创建日期:2019-06-27 16:28:58
/// 任务编号:POS
/// </summary>
private void GetCellCount()
{
if (DesignMode)
return;
if (this.panMain.Width == 0)
return;
Control item = (Control)Activator.CreateInstance(m_itemType);
int intXCount = (this.panMain.Width - 10) / (item.Width + 10);
m_intCellWidth = item.Width + ((this.panMain.Width - 10) % (item.Width + 10)) / intXCount;
int intYCount = (this.panMain.Height - 10) / (item.Height + 10);
m_intCellHeight = item.Height + ((this.panMain.Height - 10) % (item.Height + 10)) / intYCount;
int intCount = intXCount * intYCount;
if (Page == null)
{
if (m_dataSource == null)
{
intCount = 0;
}
else
{
if (((IList)m_dataSource).Count > intCount)
{
intXCount = (this.panMain.Width - 10 - 20) / (item.Width + 10);
m_intCellWidth = item.Width + ((this.panMain.Width - 10 - 20) % (item.Width + 10)) / intXCount;
}
intCount = Math.Max(intCount, ((IList)m_dataSource).Count);
}
}
CellCount = intCount;
}
#endregion
/// <summary>
/// Handles the Resize event of the panMain 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 panMain_Resize(object sender, EventArgs e)
{
ReloadGridStyle();
}
/// <summary>
/// Handles the Load event of the UCListView 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 UCListView_Load(object sender, EventArgs e)
{
}
}
}

View 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>

View File

@@ -0,0 +1,85 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-22-2019
//
// ***********************************************************************
// <copyright file="UCListViewItem.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCListViewItem.
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
partial class UCListViewItem
{
/// <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.lblTitle = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblTitle
//
this.lblTitle.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblTitle.Location = new System.Drawing.Point(0, 0);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(107, 96);
this.lblTitle.TabIndex = 0;
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// UCListViewItem
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.Transparent;
this.Controls.Add(this.lblTitle);
this.FillColor = System.Drawing.Color.White;
this.IsRadius = true;
this.IsShowRect = true;
this.Name = "UCListViewItem";
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
this.Size = new System.Drawing.Size(107, 96);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The label title
/// </summary>
private System.Windows.Forms.Label lblTitle;
}
}

View File

@@ -0,0 +1,97 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-22-2019
//
// ***********************************************************************
// <copyright file="UCListViewItem.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://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 UCListViewItem.
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
/// Implements the <see cref="HZH_Controls.Controls.IListViewItem" />
/// </summary>
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
/// <seealso cref="HZH_Controls.Controls.IListViewItem" />
[ToolboxItem(false)]
public partial class UCListViewItem : UCControlBase, IListViewItem
{
/// <summary>
/// The m data source
/// </summary>
private object m_dataSource;
/// <summary>
/// 数据源
/// </summary>
/// <value>The data source.</value>
public object DataSource
{
get
{
return m_dataSource;
}
set
{
m_dataSource = value;
lblTitle.Text = value.ToString();
}
}
/// <summary>
/// 选中项事件
/// </summary>
public event EventHandler SelectedItemEvent;
/// <summary>
/// Initializes a new instance of the <see cref="UCListViewItem" /> class.
/// </summary>
public UCListViewItem()
{
InitializeComponent();
lblTitle.MouseDown += lblTitle_MouseDown;
}
/// <summary>
/// Handles the MouseDown event of the lblTitle 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 lblTitle_MouseDown(object sender, MouseEventArgs e)
{
if (SelectedItemEvent != null)
{
SelectedItemEvent(this, e);
}
}
/// <summary>
/// Sets the selected.
/// </summary>
/// <param name="blnSelected">if set to <c>true</c> [BLN selected].</param>
public void SetSelected(bool blnSelected)
{
if (blnSelected)
this.FillColor = Color.FromArgb(255, 247, 245);
else
this.FillColor = Color.White;
this.Refresh();
}
}
}

View 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>