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,48 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-15-2019
//
// ***********************************************************************
// <copyright file="IMenuItem.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 IMenuItem
/// </summary>
public interface IMenuItem
{
/// <summary>
/// Occurs when [selected item].
/// </summary>
event EventHandler SelectedItem;
/// <summary>
/// Gets or sets the data source.
/// </summary>
/// <value>The data source.</value>
MenuItemEntity DataSource { get; set; }
/// <summary>
/// 设置样式
/// </summary>
/// <param name="styles">key:属性名称,value:属性值</param>
void SetStyle(Dictionary<string, object> styles);
/// <summary>
/// 设置选中样式
/// </summary>
/// <param name="blnSelected">是否选中</param>
void SetSelectedStyle(bool? blnSelected);
}
}

View File

@@ -0,0 +1,65 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-15-2019
//
// ***********************************************************************
// <copyright file="MenuItemEntity.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>
/// Class MenuItemEntity.
/// </summary>
[Serializable]
public class MenuItemEntity
{
/// <summary>
/// 键
/// </summary>
/// <value>The key.</value>
public string Key { get; set; }
/// <summary>
/// 文字
/// </summary>
/// <value>The text.</value>
public string Text { get; set; }
/// <summary>
/// The m childrens
/// </summary>
private List<MenuItemEntity> m_childrens = new List<MenuItemEntity>();
/// <summary>
/// 子节点
/// </summary>
/// <value>The childrens.</value>
public List<MenuItemEntity> Childrens
{
get
{
return m_childrens ?? (new List<MenuItemEntity>());
}
set
{
m_childrens = value;
}
}
/// <summary>
/// 自定义数据源,一般用于扩展展示,比如定义节点图片等
/// </summary>
/// <value>The data source.</value>
public object DataSource { get; set; }
}
}

View File

@@ -0,0 +1,67 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-15-2019
//
// ***********************************************************************
// <copyright file="UCMenu.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 UCMenu.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
partial class UCMenu
{
/// <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();
//
// UCMenu
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoScroll = true;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(30)))), ((int)(((byte)(39)))));
this.Name = "UCMenu";
this.Size = new System.Drawing.Size(204, 468);
this.ResumeLayout(false);
}
#endregion
}
}

View File

@@ -0,0 +1,396 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-15-2019
//
// ***********************************************************************
// <copyright file="UCMenu.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 UCMenu.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
public partial class UCMenu : UserControl
{
/// <summary>
/// 选中项事件
/// </summary>
public event EventHandler SelectedItem;
/// <summary>
/// The m parent item type
/// </summary>
private Type m_parentItemType = typeof(UCMenuParentItem);
/// <summary>
/// 父类节点类型
/// </summary>
/// <value>The type of the parent item.</value>
/// <exception cref="System.Exception">节点控件没有实现IMenuItem接口</exception>
/// <exception cref="Exception">节点控件没有实现IMenuItem接口</exception>
public Type ParentItemType
{
get { return m_parentItemType; }
set
{
if (value == null)
return;
if (!typeof(IMenuItem).IsAssignableFrom(value) || !value.IsSubclassOf(typeof(Control)))
throw new Exception("节点控件没有实现IMenuItem接口");
m_parentItemType = value;
}
}
/// <summary>
/// The m children item type
/// </summary>
private Type m_childrenItemType = typeof(UCMenuChildrenItem);
/// <summary>
/// 子类节点类型
/// </summary>
/// <value>The type of the children item.</value>
/// <exception cref="System.Exception">节点控件没有实现IMenuItem接口</exception>
/// <exception cref="Exception">节点控件没有实现IMenuItem接口</exception>
public Type ChildrenItemType
{
get { return m_childrenItemType; }
set
{
if (value == null)
return;
if (!typeof(IMenuItem).IsAssignableFrom(value) || !value.IsSubclassOf(typeof(Control)))
throw new Exception("节点控件没有实现IMenuItem接口");
m_childrenItemType = value;
}
}
/// <summary>
/// The m parent item styles
/// </summary>
private Dictionary<string, object> m_parentItemStyles;
/// <summary>
/// 父类节点样式设置key属性名称value属性值
/// </summary>
/// <value>The parent item styles.</value>
public Dictionary<string, object> ParentItemStyles
{
get { return m_parentItemStyles; }
set { m_parentItemStyles = value; }
}
/// <summary>
/// The m children item styles
/// </summary>
private Dictionary<string, object> m_childrenItemStyles;
/// <summary>
/// 子类节点样式设置key属性名称value属性值
/// </summary>
/// <value>The children item styles.</value>
public Dictionary<string, object> ChildrenItemStyles
{
get { return m_childrenItemStyles; }
set { m_childrenItemStyles = value; }
}
/// <summary>
/// The m data source
/// </summary>
private List<MenuItemEntity> m_dataSource;
/// <summary>
/// 数据源
/// </summary>
/// <value>The data source.</value>
public List<MenuItemEntity> DataSource
{
get { return m_dataSource; }
set
{
m_dataSource = value;
ReloadItems();
}
}
/// <summary>
/// The m is show first item
/// </summary>
private bool m_isShowFirstItem = true;
/// <summary>
/// 是否自动展开第一个节点
/// </summary>
/// <value><c>true</c> if this instance is show first item; otherwise, <c>false</c>.</value>
public bool IsShowFirstItem
{
get { return m_isShowFirstItem; }
set { m_isShowFirstItem = value; }
}
/// <summary>
/// The m menu style
/// </summary>
private MenuStyle m_menuStyle = MenuStyle.Fill;
/// <summary>
/// 菜单样式
/// </summary>
/// <value>The menu style.</value>
public MenuStyle MenuStyle
{
get { return m_menuStyle; }
set { m_menuStyle = value; }
}
/// <summary>
/// The m LST parent items
/// </summary>
private List<Control> m_lstParentItems = new List<Control>();
/// <summary>
/// The m select parent item
/// </summary>
private IMenuItem m_selectParentItem = null;
/// <summary>
/// The m select children item
/// </summary>
private IMenuItem m_selectChildrenItem = null;
/// <summary>
/// The m pan children
/// </summary>
private Panel m_panChildren = null;
/// <summary>
/// Reloads the items.
/// </summary>
private void ReloadItems()
{
try
{
ControlHelper.FreezeControl(this, true);
this.Controls.Clear();
m_lstParentItems.Clear();
if (m_dataSource != null && m_dataSource.Count > 0)
{
foreach (var parent in m_dataSource)
{
IMenuItem parentItem = (IMenuItem)Activator.CreateInstance(m_parentItemType);
parentItem.DataSource = parent;
if (m_parentItemStyles != null)
parentItem.SetStyle(m_parentItemStyles);
parentItem.SelectedItem += parentItem_SelectedItem;
Control c = parentItem as Control;
c.Dock = DockStyle.Top;
if (parent.Childrens.Count <= 0)
{
parentItem.SetSelectedStyle(null);
}
this.Controls.Add(c);
this.Controls.SetChildIndex(c, 0);
m_lstParentItems.Add(c);
}
}
m_panChildren = new Panel();
if (m_menuStyle == HZH_Controls.Controls.MenuStyle.Fill)
{
m_panChildren.Dock = DockStyle.Fill;
m_panChildren.Height = 0;
}
else
{
m_panChildren.Dock = DockStyle.Top;
m_panChildren.Height = 0;
}
m_panChildren.AutoScroll = true;
this.Controls.Add(m_panChildren);
}
finally
{
ControlHelper.FreezeControl(this, false);
}
if (m_isShowFirstItem && m_lstParentItems != null && m_lstParentItems.Count > 0)
{
parentItem_SelectedItem(m_lstParentItems[0], null);
}
}
/// <summary>
/// Handles the SelectedItem event of the parentItem 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 parentItem_SelectedItem(object sender, EventArgs e)
{
this.FindForm().ActiveControl = this;
IMenuItem item = sender as IMenuItem;
bool? blnNull = null;
if (m_lstParentItems.Contains(sender as Control))
{
if (m_selectParentItem != item)
{
if (m_selectParentItem != null)
{
m_selectParentItem.SetSelectedStyle((m_selectParentItem.DataSource == null || m_selectParentItem.DataSource.Childrens == null || m_selectParentItem.DataSource.Childrens.Count <= 0) ? blnNull : false);
}
m_selectParentItem = item;
m_selectParentItem.SetSelectedStyle((m_selectParentItem.DataSource == null || m_selectParentItem.DataSource.Childrens == null || m_selectParentItem.DataSource.Childrens.Count <= 0) ? blnNull : true);
SetChildrenControl(m_selectParentItem);
}
else
{
m_selectParentItem.SetSelectedStyle((m_selectParentItem.DataSource == null || m_selectParentItem.DataSource.Childrens == null || m_selectParentItem.DataSource.Childrens.Count <= 0) ? blnNull : false);
m_selectParentItem = null;
SetChildrenControl(m_selectParentItem, false);
}
}
else if (m_panChildren.Controls.Contains(sender as Control))
{
if (m_selectChildrenItem != item)
{
if (m_selectChildrenItem != null)
{
m_selectChildrenItem.SetSelectedStyle((m_selectParentItem.DataSource == null || m_selectParentItem.DataSource.Childrens == null || m_selectParentItem.DataSource.Childrens.Count <= 0) ? blnNull : false);
}
m_selectChildrenItem = item;
m_selectChildrenItem.SetSelectedStyle((m_selectParentItem.DataSource == null || m_selectParentItem.DataSource.Childrens == null || m_selectParentItem.DataSource.Childrens.Count <= 0) ? blnNull : true);
}
}
if (SelectedItem != null)
{
SelectedItem(sender, e);
}
}
/// <summary>
/// Sets the children control.
/// </summary>
/// <param name="menuitem">The menuitem.</param>
/// <param name="blnChildren">if set to <c>true</c> [BLN children].</param>
private void SetChildrenControl(IMenuItem menuitem, bool blnChildren = true)
{
try
{
ControlHelper.FreezeControl(this, true);
if (m_menuStyle == HZH_Controls.Controls.MenuStyle.Fill)
{
if (blnChildren)
{
Control cMenu = menuitem as Control;
int index = m_lstParentItems.IndexOf(cMenu);
for (int i = 0; i <= index; i++)
{
m_lstParentItems[i].Dock = DockStyle.Top;
this.Controls.SetChildIndex(m_lstParentItems[i], 1);
}
for (int i = index + 1; i < m_lstParentItems.Count; i++)
{
m_lstParentItems[i].Dock = DockStyle.Bottom;
this.Controls.SetChildIndex(m_lstParentItems[i], m_lstParentItems.Count);
}
m_panChildren.Controls.Clear();
int intItemHeigth = 0;
foreach (var item in menuitem.DataSource.Childrens)
{
IMenuItem parentItem = (IMenuItem)Activator.CreateInstance(m_childrenItemType);
parentItem.DataSource = item;
if (m_childrenItemStyles != null)
parentItem.SetStyle(m_childrenItemStyles);
parentItem.SelectedItem += parentItem_SelectedItem;
Control c = parentItem as Control;
if (intItemHeigth == 0)
intItemHeigth = c.Height;
c.Dock = DockStyle.Top;
m_panChildren.Controls.Add(c);
m_panChildren.Controls.SetChildIndex(c, 0);
}
//m_panChildren.MinimumSize = new Size(0, menuitem.DataSource.Childrens.Count * intItemHeigth);
}
else
{
m_panChildren.Controls.Clear();
foreach (var item in m_lstParentItems)
{
item.Dock = DockStyle.Top;
this.Controls.SetChildIndex(item, 1);
}
}
}
else
{
if (blnChildren)
{
Control cMenu = menuitem as Control;
int index = m_lstParentItems.IndexOf(cMenu);
this.Controls.SetChildIndex(m_panChildren, m_lstParentItems.Count - index - 1);
m_panChildren.Controls.Clear();
int intItemHeigth = 0;
foreach (var item in menuitem.DataSource.Childrens)
{
IMenuItem parentItem = (IMenuItem)Activator.CreateInstance(m_childrenItemType);
parentItem.DataSource = item;
if (m_childrenItemStyles != null)
parentItem.SetStyle(m_childrenItemStyles);
parentItem.SelectedItem += parentItem_SelectedItem;
Control c = parentItem as Control;
if (intItemHeigth == 0)
intItemHeigth = c.Height;
c.Dock = DockStyle.Top;
m_panChildren.Controls.Add(c);
m_panChildren.Controls.SetChildIndex(c, 0);
}
m_panChildren.Height = menuitem.DataSource.Childrens.Count * intItemHeigth;
}
else
{
m_panChildren.Controls.Clear();
m_panChildren.Height = 0;
}
}
}
finally
{
ControlHelper.FreezeControl(this, false);
}
}
/// <summary>
/// Initializes a new instance of the <see cref="UCMenu" /> class.
/// </summary>
public UCMenu()
{
InitializeComponent();
}
}
/// <summary>
/// Enum MenuStyle
/// </summary>
public enum MenuStyle
{
/// <summary>
/// 平铺
/// </summary>
Fill = 1,
/// <summary>
/// 顶部对齐
/// </summary>
Top = 2,
}
}

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,102 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-15-2019
//
// ***********************************************************************
// <copyright file="UCMenuChildrenItem.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 UCMenuChildrenItem.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
partial class UCMenuChildrenItem
{
/// <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.lblTitle = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// ucSplitLine_H1
//
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(43)))), ((int)(((byte)(54)))));
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 59);
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
this.ucSplitLine_H1.Size = new System.Drawing.Size(200, 1);
this.ucSplitLine_H1.TabIndex = 0;
this.ucSplitLine_H1.TabStop = false;
//
// lblTitle
//
this.lblTitle.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblTitle.Font = new System.Drawing.Font("微软雅黑", 12F);
this.lblTitle.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(145)))), ((int)(((byte)(152)))), ((int)(((byte)(170)))));
this.lblTitle.Location = new System.Drawing.Point(0, 0);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(200, 59);
this.lblTitle.TabIndex = 1;
this.lblTitle.Text = "子项";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// UCMenuChildrenItem
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(30)))), ((int)(((byte)(39)))));
this.Controls.Add(this.lblTitle);
this.Controls.Add(this.ucSplitLine_H1);
this.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "UCMenuChildrenItem";
this.Size = new System.Drawing.Size(200, 60);
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,122 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-15-2019
//
// ***********************************************************************
// <copyright file="UCMenuChildrenItem.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>
/// 子类节点
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// Implements the <see cref="HZH_Controls.Controls.IMenuItem" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
/// <seealso cref="HZH_Controls.Controls.IMenuItem" />
[ToolboxItem(false)]
public partial class UCMenuChildrenItem : UserControl, IMenuItem
{
/// <summary>
/// Occurs when [selected item].
/// </summary>
public event EventHandler SelectedItem;
/// <summary>
/// The m data source
/// </summary>
private MenuItemEntity m_dataSource;
/// <summary>
/// Gets or sets the data source.
/// </summary>
/// <value>The data source.</value>
public MenuItemEntity DataSource
{
get
{
return m_dataSource;
}
set
{
m_dataSource = value;
if (value != null)
{
lblTitle.Text = value.Text;
}
}
}
/// <summary>
/// Initializes a new instance of the <see cref="UCMenuChildrenItem" /> class.
/// </summary>
public UCMenuChildrenItem()
{
InitializeComponent();
this.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 (SelectedItem != null)
{
SelectedItem(this, null);
}
}
/// <summary>
/// 设置样式
/// </summary>
/// <param name="styles">key:属性名称,value:属性值</param>
/// <exception cref="System.Exception">菜单元素设置样式异常</exception>
/// <exception cref="Exception">菜单元素设置样式异常</exception>
public void SetStyle(Dictionary<string, object> styles)
{
Type t = this.GetType();
foreach (var item in styles)
{
var pro = t.GetProperty(item.Key);
if (pro != null && pro.CanWrite)
{
try
{
pro.SetValue(this, item.Value, null);
}
catch (Exception ex)
{
throw new Exception("菜单元素设置样式异常", ex);
}
}
}
}
/// <summary>
/// Sets the selected style.
/// </summary>
/// <param name="blnSelected">if set to <c>true</c> [BLN selected].</param>
public void SetSelectedStyle(bool? blnSelected)
{
}
}
}

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,102 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-15-2019
//
// ***********************************************************************
// <copyright file="UCMenuParentItem.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 UCMenuParentItem.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
partial class UCMenuParentItem
{
/// <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.lblTitle = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// ucSplitLine_H1
//
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(30)))), ((int)(((byte)(39)))));
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 59);
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
this.ucSplitLine_H1.Size = new System.Drawing.Size(200, 1);
this.ucSplitLine_H1.TabIndex = 0;
this.ucSplitLine_H1.TabStop = false;
//
// lblTitle
//
this.lblTitle.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblTitle.ForeColor = System.Drawing.Color.White;
this.lblTitle.Image = global::HZH_Controls.Properties.Resources.sanjiao2;
this.lblTitle.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblTitle.Location = new System.Drawing.Point(0, 0);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(200, 59);
this.lblTitle.TabIndex = 1;
this.lblTitle.Text = "父项";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// UCMenuParentItem
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(29)))), ((int)(((byte)(43)))), ((int)(((byte)(54)))));
this.Controls.Add(this.lblTitle);
this.Controls.Add(this.ucSplitLine_H1);
this.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "UCMenuParentItem";
this.Size = new System.Drawing.Size(200, 60);
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,137 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-15-2019
//
// ***********************************************************************
// <copyright file="UCMenuParentItem.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>
/// 父类节点
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// Implements the <see cref="HZH_Controls.Controls.IMenuItem" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
/// <seealso cref="HZH_Controls.Controls.IMenuItem" />
[ToolboxItem(false)]
public partial class UCMenuParentItem : UserControl, IMenuItem
{
/// <summary>
/// Occurs when [selected item].
/// </summary>
public event EventHandler SelectedItem;
/// <summary>
/// The m data source
/// </summary>
private MenuItemEntity m_dataSource;
/// <summary>
/// Gets or sets the data source.
/// </summary>
/// <value>The data source.</value>
public MenuItemEntity DataSource
{
get
{
return m_dataSource;
}
set
{
m_dataSource = value;
if (value != null)
{
lblTitle.Text = value.Text;
}
}
}
/// <summary>
/// Initializes a new instance of the <see cref="UCMenuParentItem" /> class.
/// </summary>
public UCMenuParentItem()
{
InitializeComponent();
lblTitle.MouseDown += lblTitle_MouseDown;
}
/// <summary>
/// 设置样式
/// </summary>
/// <param name="styles">key:属性名称,value:属性值</param>
/// <exception cref="System.Exception">菜单元素设置样式异常</exception>
/// <exception cref="Exception">菜单元素设置样式异常</exception>
public void SetStyle(Dictionary<string, object> styles)
{
Type t = this.GetType();
foreach (var item in styles)
{
var pro = t.GetProperty(item.Key);
if (pro != null && pro.CanWrite)
{
try
{
pro.SetValue(this, item.Value, null);
}
catch (Exception ex)
{
throw new Exception("菜单元素设置样式异常", ex);
}
}
}
}
/// <summary>
/// 设置选中样式
/// </summary>
/// <param name="blnSelected">是否选中</param>
public void SetSelectedStyle(bool? blnSelected)
{
if (blnSelected.HasValue)
{
if (blnSelected.Value)
{
this.lblTitle.Image = Properties.Resources.sanjiao1;
}
else
{
this.lblTitle.Image = Properties.Resources.sanjiao2;
}
}
else
{
this.lblTitle.Image = null;
}
}
/// <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 (SelectedItem != null)
{
SelectedItem(this, 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>