mirror of
https://github.com/eggplantlwj/VisionEdit.git
synced 2026-03-24 08:46:35 +08:00
1、优化LOG显示与引用
2、添加PMA工具,工具内容待完善 3、修复流程树显示 4、添加开源项目,优化UI空间 5、其他BUG更改
This commit is contained in:
147
UsingControl/HZHControls/Controls/ComboBox/UCCombox.Designer.cs
generated
Normal file
147
UsingControl/HZHControls/Controls/ComboBox/UCCombox.Designer.cs
generated
Normal file
@@ -0,0 +1,147 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCCombox.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCCombox.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
partial class UCCombox
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.txtInput = new HZH_Controls.Controls.TextBoxEx();
|
||||
this.lblInput = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.panel1.BackgroundImage = global::HZH_Controls.Properties.Resources.ComboBox;
|
||||
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.panel1.Location = new System.Drawing.Point(136, 0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(37, 32);
|
||||
this.panel1.TabIndex = 0;
|
||||
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.click_MouseDown);
|
||||
//
|
||||
// txtInput
|
||||
//
|
||||
this.txtInput.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtInput.BackColor = System.Drawing.Color.White;
|
||||
this.txtInput.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtInput.DecLength = 2;
|
||||
this.txtInput.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtInput.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.txtInput.InputType = HZH_Controls.TextInputType.NotControl;
|
||||
this.txtInput.Location = new System.Drawing.Point(3, 4);
|
||||
this.txtInput.Margin = new System.Windows.Forms.Padding(3, 3, 10, 3);
|
||||
this.txtInput.MaxValue = new decimal(new int[] {
|
||||
1000000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtInput.MinValue = new decimal(new int[] {
|
||||
1000000,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.txtInput.MyRectangle = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||
this.txtInput.Name = "txtInput";
|
||||
this.txtInput.OldText = null;
|
||||
this.txtInput.PromptColor = System.Drawing.Color.Silver;
|
||||
this.txtInput.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtInput.PromptText = "";
|
||||
this.txtInput.RegexPattern = "";
|
||||
this.txtInput.Size = new System.Drawing.Size(133, 24);
|
||||
this.txtInput.TabIndex = 1;
|
||||
this.txtInput.TextChanged += new System.EventHandler(this.txtInput_TextChanged);
|
||||
//
|
||||
// lblInput
|
||||
//
|
||||
this.lblInput.AutoSize = true;
|
||||
this.lblInput.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.lblInput.Location = new System.Drawing.Point(3, 6);
|
||||
this.lblInput.Name = "lblInput";
|
||||
this.lblInput.Size = new System.Drawing.Size(0, 20);
|
||||
this.lblInput.TabIndex = 2;
|
||||
this.lblInput.Visible = false;
|
||||
this.lblInput.MouseDown += new System.Windows.Forms.MouseEventHandler(this.click_MouseDown);
|
||||
//
|
||||
// UCCombox
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.ConerRadius = 5;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.txtInput);
|
||||
this.Controls.Add(this.lblInput);
|
||||
this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.IsRadius = true;
|
||||
this.IsShowRect = true;
|
||||
this.Name = "UCCombox";
|
||||
this.Size = new System.Drawing.Size(173, 32);
|
||||
this.Load += new System.EventHandler(this.UCComboBox_Load);
|
||||
this.SizeChanged += new System.EventHandler(this.UCComboBox_SizeChanged);
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.click_MouseDown);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The panel1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
/// <summary>
|
||||
/// The text input
|
||||
/// </summary>
|
||||
public TextBoxEx txtInput;
|
||||
/// <summary>
|
||||
/// The label input
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Label lblInput;
|
||||
}
|
||||
}
|
||||
586
UsingControl/HZHControls/Controls/ComboBox/UCCombox.cs
Normal file
586
UsingControl/HZHControls/Controls/ComboBox/UCCombox.cs
Normal file
@@ -0,0 +1,586 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-08-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCCombox.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCCombox.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCControlBase" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCControlBase" />
|
||||
[DefaultEvent("SelectedChangedEvent")]
|
||||
public partial class UCCombox : UCControlBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The fore color
|
||||
/// </summary>
|
||||
Color _ForeColor = Color.FromArgb(64, 64, 64);
|
||||
/// <summary>
|
||||
/// 文字颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the fore.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Description("文字颜色"), Category("自定义")]
|
||||
public override Color ForeColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ForeColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ForeColor = value;
|
||||
lblInput.ForeColor = value;
|
||||
txtInput.ForeColor = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 选中事件
|
||||
/// </summary>
|
||||
[Description("选中事件"), Category("自定义")]
|
||||
public event EventHandler SelectedChangedEvent;
|
||||
/// <summary>
|
||||
/// 文本改变事件
|
||||
/// </summary>
|
||||
[Description("文本改变事件"), Category("自定义")]
|
||||
public event EventHandler TextChangedEvent;
|
||||
|
||||
/// <summary>
|
||||
/// The box style
|
||||
/// </summary>
|
||||
private ComboBoxStyle _BoxStyle = ComboBoxStyle.DropDown;
|
||||
/// <summary>
|
||||
/// 控件样式
|
||||
/// </summary>
|
||||
/// <value>The box style.</value>
|
||||
[Description("控件样式"), Category("自定义")]
|
||||
public ComboBoxStyle BoxStyle
|
||||
{
|
||||
get { return _BoxStyle; }
|
||||
set
|
||||
{
|
||||
_BoxStyle = value;
|
||||
if (value == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
lblInput.Visible = true;
|
||||
txtInput.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
lblInput.Visible = false;
|
||||
txtInput.Visible = true;
|
||||
}
|
||||
|
||||
if (this._BoxStyle == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
txtInput.BackColor = _BackColor;
|
||||
base.FillColor = _BackColor;
|
||||
base.RectColor = _BackColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtInput.BackColor = Color.White;
|
||||
base.FillColor = Color.White;
|
||||
base.RectColor = Color.FromArgb(220, 220, 220);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The font
|
||||
/// </summary>
|
||||
private Font _Font = new Font("微软雅黑", 12);
|
||||
/// <summary>
|
||||
/// 字体
|
||||
/// </summary>
|
||||
/// <value>The font.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Description("字体"), Category("自定义")]
|
||||
public new Font Font
|
||||
{
|
||||
get { return _Font; }
|
||||
set
|
||||
{
|
||||
_Font = value;
|
||||
lblInput.Font = value;
|
||||
txtInput.Font = value;
|
||||
txtInput.PromptFont = value;
|
||||
this.txtInput.Location = new Point(this.txtInput.Location.X, (this.Height - txtInput.Height) / 2);
|
||||
this.lblInput.Location = new Point(this.lblInput.Location.X, (this.Height - lblInput.Height) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 当使用边框时填充颜色,当值为背景色或透明色或空值则不填充
|
||||
/// </summary>
|
||||
/// <value>The color of the fill.</value>
|
||||
[Obsolete("不再可用的属性")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private new Color FillColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 边框颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the rect.</value>
|
||||
[Obsolete("不再可用的属性")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private new Color RectColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The text value
|
||||
/// </summary>
|
||||
private string _TextValue;
|
||||
/// <summary>
|
||||
/// 文字
|
||||
/// </summary>
|
||||
/// <value>The text value.</value>
|
||||
[Description("文字"), Category("自定义")]
|
||||
public string TextValue
|
||||
{
|
||||
get { return _TextValue; }
|
||||
set
|
||||
{
|
||||
_TextValue = value;
|
||||
if (lblInput.Text != value)
|
||||
lblInput.Text = value;
|
||||
if (txtInput.Text != value)
|
||||
txtInput.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The source
|
||||
/// </summary>
|
||||
private List<KeyValuePair<string, string>> _source = null;
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
/// <value>The source.</value>
|
||||
[Description("数据源"), Category("自定义")]
|
||||
public List<KeyValuePair<string, string>> Source
|
||||
{
|
||||
get { return _source; }
|
||||
set
|
||||
{
|
||||
_source = value;
|
||||
_selectedIndex = -1;
|
||||
_selectedValue = "";
|
||||
_selectedItem = new KeyValuePair<string, string>();
|
||||
_selectedText = "";
|
||||
lblInput.Text = "";
|
||||
txtInput.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The selected item
|
||||
/// </summary>
|
||||
private KeyValuePair<string, string> _selectedItem = new KeyValuePair<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// The selected index
|
||||
/// </summary>
|
||||
private int _selectedIndex = -1;
|
||||
/// <summary>
|
||||
/// 选中的数据下标
|
||||
/// </summary>
|
||||
/// <value>The index of the selected.</value>
|
||||
[Description("选中的数据下标"), Category("自定义")]
|
||||
public int SelectedIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selectedIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 0 || _source == null || _source.Count <= 0 || value >= _source.Count)
|
||||
{
|
||||
_selectedIndex = -1;
|
||||
_selectedValue = "";
|
||||
_selectedItem = new KeyValuePair<string, string>();
|
||||
SelectedText = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedIndex = value;
|
||||
_selectedItem = _source[value];
|
||||
_selectedValue = _source[value].Key;
|
||||
SelectedText = _source[value].Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The selected value
|
||||
/// </summary>
|
||||
private string _selectedValue = "";
|
||||
/// <summary>
|
||||
/// 选中的值
|
||||
/// </summary>
|
||||
/// <value>The selected value.</value>
|
||||
[Description("选中的值"), Category("自定义")]
|
||||
public string SelectedValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selectedValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_source == null || _source.Count <= 0)
|
||||
{
|
||||
SelectedText = "";
|
||||
_selectedValue = "";
|
||||
_selectedIndex = -1;
|
||||
_selectedItem = new KeyValuePair<string, string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < _source.Count; i++)
|
||||
{
|
||||
if (_source[i].Key == value)
|
||||
{
|
||||
_selectedValue = value;
|
||||
_selectedIndex = i;
|
||||
_selectedItem = _source[i];
|
||||
SelectedText = _source[i].Value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
_selectedValue = "";
|
||||
_selectedIndex = -1;
|
||||
_selectedItem = new KeyValuePair<string, string>();
|
||||
SelectedText = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The selected text
|
||||
/// </summary>
|
||||
private string _selectedText = "";
|
||||
/// <summary>
|
||||
/// 选中的文本
|
||||
/// </summary>
|
||||
/// <value>The selected text.</value>
|
||||
[Description("选中的文本"), Category("自定义")]
|
||||
public string SelectedText
|
||||
{
|
||||
get { return _selectedText; }
|
||||
private set
|
||||
{
|
||||
_selectedText = value;
|
||||
lblInput.Text = _selectedText;
|
||||
txtInput.Text = _selectedText;
|
||||
if (SelectedChangedEvent != null)
|
||||
{
|
||||
SelectedChangedEvent(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The item width
|
||||
/// </summary>
|
||||
private int _ItemWidth = 70;
|
||||
/// <summary>
|
||||
/// 项宽度
|
||||
/// </summary>
|
||||
/// <value>The width of the item.</value>
|
||||
[Description("项宽度"), Category("自定义")]
|
||||
public int ItemWidth
|
||||
{
|
||||
get { return _ItemWidth; }
|
||||
set { _ItemWidth = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The drop panel height
|
||||
/// </summary>
|
||||
private int _dropPanelHeight = -1;
|
||||
/// <summary>
|
||||
/// 下拉面板高度
|
||||
/// </summary>
|
||||
/// <value>The height of the drop panel.</value>
|
||||
[Description("下拉面板高度"), Category("自定义")]
|
||||
public int DropPanelHeight
|
||||
{
|
||||
get { return _dropPanelHeight; }
|
||||
set { _dropPanelHeight = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取或设置控件的背景色。
|
||||
/// </summary>
|
||||
/// <value>The color of the back.</value>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
[Obsolete("不再可用的属性,如需要改变背景色,请使用BackColorExt")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private new Color BackColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.BackColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.BackColor = Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The back color
|
||||
/// </summary>
|
||||
private Color _BackColor = Color.FromArgb(240, 240, 240);
|
||||
/// <summary>
|
||||
/// 背景色
|
||||
/// </summary>
|
||||
/// <value>The back color ext.</value>
|
||||
[Description("背景色"), Category("自定义")]
|
||||
public Color BackColorExt
|
||||
{
|
||||
get
|
||||
{
|
||||
return _BackColor;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == Color.Transparent)
|
||||
return;
|
||||
_BackColor = value;
|
||||
lblInput.BackColor = value;
|
||||
|
||||
if (this._BoxStyle == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
txtInput.BackColor = value;
|
||||
base.FillColor = value;
|
||||
base.RectColor = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtInput.BackColor = Color.White;
|
||||
base.FillColor = Color.White;
|
||||
base.RectColor = Color.FromArgb(220, 220, 220);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The triangle color
|
||||
/// </summary>
|
||||
private Color triangleColor = Color.FromArgb(255, 77, 59);
|
||||
/// <summary>
|
||||
/// 三角颜色
|
||||
/// </summary>
|
||||
/// <value>The color of the triangle.</value>
|
||||
[Description("三角颜色"), Category("自定义")]
|
||||
public Color TriangleColor
|
||||
{
|
||||
get { return triangleColor; }
|
||||
set
|
||||
{
|
||||
triangleColor = value;
|
||||
Bitmap bit = new Bitmap(12, 10);
|
||||
Graphics g = Graphics.FromImage(bit);
|
||||
g.SetGDIHigh();
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddLines(new Point[]
|
||||
{
|
||||
new Point(1,1),
|
||||
new Point(11,1),
|
||||
new Point(6,10),
|
||||
new Point(1,1)
|
||||
});
|
||||
g.FillPath(new SolidBrush(value), path);
|
||||
g.Dispose();
|
||||
panel1.BackgroundImage = bit;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCCombox" /> class.
|
||||
/// </summary>
|
||||
public UCCombox()
|
||||
{
|
||||
InitializeComponent();
|
||||
lblInput.BackColor = _BackColor;
|
||||
if (this._BoxStyle == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
txtInput.BackColor = _BackColor;
|
||||
base.FillColor = _BackColor;
|
||||
base.RectColor = _BackColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtInput.BackColor = Color.White;
|
||||
base.FillColor = Color.White;
|
||||
base.RectColor = Color.FromArgb(220, 220, 220);
|
||||
}
|
||||
base.BackColor = Color.Transparent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the SizeChanged event of the UCComboBox control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void UCComboBox_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.txtInput.Location = new Point(this.txtInput.Location.X, (this.Height - txtInput.Height) / 2);
|
||||
this.lblInput.Location = new Point(this.lblInput.Location.X, (this.Height - lblInput.Height) / 2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the TextChanged event of the txtInput control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void txtInput_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
TextValue = txtInput.Text;
|
||||
if (TextChangedEvent != null)
|
||||
{
|
||||
TextChangedEvent(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the click control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
protected virtual void click_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (_frmAnchor == null || _frmAnchor.IsDisposed || _frmAnchor.Visible == false)
|
||||
{
|
||||
|
||||
if (this.Source != null && this.Source.Count > 0)
|
||||
{
|
||||
int intRow = 0;
|
||||
int intCom = 1;
|
||||
var p = this.PointToScreen(this.Location);
|
||||
while (true)
|
||||
{
|
||||
int intScreenHeight = Screen.PrimaryScreen.Bounds.Height;
|
||||
if ((p.Y + this.Height + this.Source.Count / intCom * 50 < intScreenHeight || p.Y - this.Source.Count / intCom * 50 > 0)
|
||||
&& (_dropPanelHeight <= 0 ? true : (this.Source.Count / intCom * 50 <= _dropPanelHeight)))
|
||||
{
|
||||
intRow = this.Source.Count / intCom + (this.Source.Count % intCom != 0 ? 1 : 0);
|
||||
break;
|
||||
}
|
||||
intCom++;
|
||||
}
|
||||
UCTimePanel ucTime = new UCTimePanel();
|
||||
ucTime.IsShowBorder = true;
|
||||
int intWidth = this.Width / intCom;
|
||||
if (intWidth < _ItemWidth)
|
||||
intWidth = _ItemWidth;
|
||||
Size size = new Size(intCom * intWidth, intRow * 50);
|
||||
ucTime.Size = size;
|
||||
ucTime.FirstEvent = true;
|
||||
ucTime.SelectSourceEvent += ucTime_SelectSourceEvent;
|
||||
ucTime.Row = intRow;
|
||||
ucTime.Column = intCom;
|
||||
List<KeyValuePair<string, string>> lst = new List<KeyValuePair<string, string>>();
|
||||
foreach (var item in this.Source)
|
||||
{
|
||||
lst.Add(new KeyValuePair<string, string>(item.Key, item.Value));
|
||||
}
|
||||
ucTime.Source = lst;
|
||||
|
||||
ucTime.SetSelect(_selectedValue);
|
||||
|
||||
_frmAnchor = new Forms.FrmAnchor(this, ucTime);
|
||||
_frmAnchor.Load += (a, b) => { (a as Form).Size = size; };
|
||||
|
||||
_frmAnchor.Show(this.FindForm());
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_frmAnchor.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The FRM anchor
|
||||
/// </summary>
|
||||
Forms.FrmAnchor _frmAnchor;
|
||||
/// <summary>
|
||||
/// Handles the SelectSourceEvent event of the ucTime control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void ucTime_SelectSourceEvent(object sender, EventArgs e)
|
||||
{
|
||||
if (_frmAnchor != null && !_frmAnchor.IsDisposed && _frmAnchor.Visible)
|
||||
{
|
||||
SelectedValue = sender.ToString();
|
||||
_frmAnchor.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Load event of the UCComboBox control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void UCComboBox_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (this._BoxStyle == ComboBoxStyle.DropDownList)
|
||||
{
|
||||
txtInput.BackColor = _BackColor;
|
||||
base.FillColor = _BackColor;
|
||||
base.RectColor = _BackColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtInput.BackColor = Color.White;
|
||||
base.FillColor = Color.White;
|
||||
base.RectColor = Color.FromArgb(220, 220, 220);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
UsingControl/HZHControls/Controls/ComboBox/UCCombox.resx
Normal file
120
UsingControl/HZHControls/Controls/ComboBox/UCCombox.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
73
UsingControl/HZHControls/Controls/ComboBox/UCComboxGrid.Designer.cs
generated
Normal file
73
UsingControl/HZHControls/Controls/ComboBox/UCComboxGrid.Designer.cs
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-28-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCComboxGrid.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCComboxGrid.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCCombox" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCCombox" />
|
||||
partial class UCComboxGrid
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtInput
|
||||
//
|
||||
this.txtInput.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
//
|
||||
// UCComboxGrid
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.BoxStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.Name = "UCComboxGrid";
|
||||
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
229
UsingControl/HZHControls/Controls/ComboBox/UCComboxGrid.cs
Normal file
229
UsingControl/HZHControls/Controls/ComboBox/UCComboxGrid.cs
Normal file
@@ -0,0 +1,229 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-28-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCComboxGrid.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using HZH_Controls.Controls;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCComboxGrid.
|
||||
/// Implements the <see cref="HZH_Controls.Controls.UCCombox" />
|
||||
/// </summary>
|
||||
/// <seealso cref="HZH_Controls.Controls.UCCombox" />
|
||||
public partial class UCComboxGrid : UCCombox
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The m row type
|
||||
/// </summary>
|
||||
private Type m_rowType = typeof(UCDataGridViewRow);
|
||||
/// <summary>
|
||||
/// 表格行类型
|
||||
/// </summary>
|
||||
/// <value>The type of the grid row.</value>
|
||||
[Description("表格行类型"), Category("自定义")]
|
||||
public Type GridRowType
|
||||
{
|
||||
get { return m_rowType; }
|
||||
set
|
||||
{
|
||||
m_rowType = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The int width
|
||||
/// </summary>
|
||||
int intWidth = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The m columns
|
||||
/// </summary>
|
||||
private List<DataGridViewColumnEntity> m_columns = null;
|
||||
/// <summary>
|
||||
/// 表格列
|
||||
/// </summary>
|
||||
/// <value>The grid columns.</value>
|
||||
[Description("表格列"), Category("自定义")]
|
||||
public List<DataGridViewColumnEntity> GridColumns
|
||||
{
|
||||
get { return m_columns; }
|
||||
set
|
||||
{
|
||||
m_columns = value;
|
||||
if (value != null)
|
||||
intWidth = value.Sum(p => p.WidthType == SizeType.Absolute ? p.Width : (p.Width < 80 ? 80 : p.Width));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The m data source
|
||||
/// </summary>
|
||||
private List<object> m_dataSource = null;
|
||||
/// <summary>
|
||||
/// 表格数据源
|
||||
/// </summary>
|
||||
/// <value>The grid data source.</value>
|
||||
[Description("表格数据源"), Category("自定义")]
|
||||
public List<object> GridDataSource
|
||||
{
|
||||
get { return m_dataSource; }
|
||||
set { m_dataSource = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m text field
|
||||
/// </summary>
|
||||
private string m_textField;
|
||||
/// <summary>
|
||||
/// 显示值字段名称
|
||||
/// </summary>
|
||||
/// <value>The text field.</value>
|
||||
[Description("显示值字段名称"), Category("自定义")]
|
||||
public string TextField
|
||||
{
|
||||
get { return m_textField; }
|
||||
set
|
||||
{
|
||||
m_textField = value;
|
||||
SetText();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 控件样式
|
||||
/// </summary>
|
||||
/// <value>The box style.</value>
|
||||
[Obsolete("不再可用的属性")]
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private new ComboBoxStyle BoxStyle
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// The select source
|
||||
/// </summary>
|
||||
private object selectSource = null;
|
||||
/// <summary>
|
||||
/// 选中的数据源
|
||||
/// </summary>
|
||||
/// <value>The select source.</value>
|
||||
[Description("选中的数据源"), Category("自定义")]
|
||||
public object SelectSource
|
||||
{
|
||||
get { return selectSource; }
|
||||
set
|
||||
{
|
||||
selectSource = value;
|
||||
SetText();
|
||||
if (SelectedChangedEvent != null)
|
||||
{
|
||||
SelectedChangedEvent(value, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选中数据源改变事件
|
||||
/// </summary>
|
||||
[Description("选中数据源改变事件"), Category("自定义")]
|
||||
public new event EventHandler SelectedChangedEvent;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCComboxGrid" /> class.
|
||||
/// </summary>
|
||||
public UCComboxGrid()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
/// <summary>
|
||||
/// The m uc panel
|
||||
/// </summary>
|
||||
UCComboxGridPanel m_ucPanel = null;
|
||||
/// <summary>
|
||||
/// The FRM anchor
|
||||
/// </summary>
|
||||
Forms.FrmAnchor _frmAnchor;
|
||||
/// <summary>
|
||||
/// Handles the MouseDown event of the click control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
|
||||
protected override void click_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (m_columns == null || m_columns.Count <= 0)
|
||||
return;
|
||||
if (m_ucPanel == null)
|
||||
{
|
||||
var p = this.Parent.PointToScreen(this.Location);
|
||||
int intScreenHeight = Screen.PrimaryScreen.Bounds.Height;
|
||||
int intHeight = Math.Max(p.Y, intScreenHeight - p.Y - this.Height);
|
||||
intHeight -= 100;
|
||||
m_ucPanel = new UCComboxGridPanel();
|
||||
m_ucPanel.ItemClick += m_ucPanel_ItemClick;
|
||||
m_ucPanel.Height = intHeight;
|
||||
m_ucPanel.Width = intWidth;
|
||||
m_ucPanel.Columns = m_columns;
|
||||
m_ucPanel.RowType = m_rowType;
|
||||
if (m_dataSource != null && m_dataSource.Count > 0)
|
||||
{
|
||||
int _intHeight = Math.Min(110 + m_dataSource.Count * 36, m_ucPanel.Height);
|
||||
if (_intHeight <= 0)
|
||||
_intHeight = 100;
|
||||
m_ucPanel.Height = _intHeight;
|
||||
}
|
||||
}
|
||||
m_ucPanel.DataSource = m_dataSource;
|
||||
if (_frmAnchor == null || _frmAnchor.IsDisposed || _frmAnchor.Visible == false)
|
||||
{
|
||||
_frmAnchor = new Forms.FrmAnchor(this, m_ucPanel, isNotFocus: false);
|
||||
_frmAnchor.Show(this.FindForm());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the ItemClick event of the m_ucPanel control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="DataGridViewEventArgs" /> instance containing the event data.</param>
|
||||
void m_ucPanel_ItemClick(object sender, DataGridViewEventArgs e)
|
||||
{
|
||||
_frmAnchor.Hide();
|
||||
SelectSource = sender;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the text.
|
||||
/// </summary>
|
||||
private void SetText()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(m_textField) && selectSource != null)
|
||||
{
|
||||
var pro = selectSource.GetType().GetProperty(m_textField);
|
||||
if (pro != null)
|
||||
{
|
||||
TextValue = pro.GetValue(selectSource, null).ToStringExt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
UsingControl/HZHControls/Controls/ComboBox/UCComboxGrid.resx
Normal file
120
UsingControl/HZHControls/Controls/ComboBox/UCComboxGrid.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
290
UsingControl/HZHControls/Controls/ComboBox/UCComboxGridPanel.Designer.cs
generated
Normal file
290
UsingControl/HZHControls/Controls/ComboBox/UCComboxGridPanel.Designer.cs
generated
Normal file
@@ -0,0 +1,290 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-28-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCComboxGridPanel.Designer.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCComboxGridPanel.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
partial class UCComboxGridPanel
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.ucControlBase1 = new HZH_Controls.Controls.UCControlBase();
|
||||
this.ucDataGridView1 = new HZH_Controls.Controls.UCDataGridView();
|
||||
this.m_page = new HZH_Controls.Controls.UCPagerControl();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.txtSearch = new HZH_Controls.Controls.UCTextBoxEx();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.ucSplitLine_V2 = new HZH_Controls.Controls.UCSplitLine_V();
|
||||
this.ucSplitLine_V1 = new HZH_Controls.Controls.UCSplitLine_V();
|
||||
this.ucSplitLine_H2 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
|
||||
this.panel1.SuspendLayout();
|
||||
this.ucControlBase1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.ucControlBase1);
|
||||
this.panel1.Controls.Add(this.panel2);
|
||||
this.panel1.Controls.Add(this.txtSearch);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(1, 1);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.panel1.Size = new System.Drawing.Size(447, 333);
|
||||
this.panel1.TabIndex = 4;
|
||||
//
|
||||
// ucControlBase1
|
||||
//
|
||||
this.ucControlBase1.ConerRadius = 5;
|
||||
this.ucControlBase1.Controls.Add(this.ucDataGridView1);
|
||||
this.ucControlBase1.Controls.Add(this.m_page);
|
||||
this.ucControlBase1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ucControlBase1.FillColor = System.Drawing.Color.Transparent;
|
||||
this.ucControlBase1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.ucControlBase1.IsRadius = false;
|
||||
this.ucControlBase1.IsShowRect = true;
|
||||
this.ucControlBase1.Location = new System.Drawing.Point(5, 62);
|
||||
this.ucControlBase1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.ucControlBase1.Name = "ucControlBase1";
|
||||
this.ucControlBase1.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.ucControlBase1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
|
||||
this.ucControlBase1.RectWidth = 1;
|
||||
this.ucControlBase1.Size = new System.Drawing.Size(437, 266);
|
||||
this.ucControlBase1.TabIndex = 2;
|
||||
this.ucControlBase1.TabStop = false;
|
||||
//
|
||||
// ucDataGridView1
|
||||
//
|
||||
this.ucDataGridView1.AutoScroll = true;
|
||||
this.ucDataGridView1.BackColor = System.Drawing.Color.White;
|
||||
this.ucDataGridView1.Columns = null;
|
||||
this.ucDataGridView1.DataSource = null;
|
||||
this.ucDataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ucDataGridView1.HeadFont = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.ucDataGridView1.HeadHeight = 40;
|
||||
this.ucDataGridView1.HeadPadingLeft = 0;
|
||||
this.ucDataGridView1.HeadTextColor = System.Drawing.Color.Black;
|
||||
this.ucDataGridView1.IsShowCheckBox = false;
|
||||
this.ucDataGridView1.IsShowHead = true;
|
||||
this.ucDataGridView1.Location = new System.Drawing.Point(5, 5);
|
||||
this.ucDataGridView1.Name = "ucDataGridView1";
|
||||
this.ucDataGridView1.RowHeight = 30;
|
||||
this.ucDataGridView1.RowType = typeof(HZH_Controls.Controls.UCDataGridViewRow);
|
||||
this.ucDataGridView1.Size = new System.Drawing.Size(427, 223);
|
||||
this.ucDataGridView1.TabIndex = 0;
|
||||
this.ucDataGridView1.TabStop = false;
|
||||
//
|
||||
// m_page
|
||||
//
|
||||
this.m_page.DataSource = null;
|
||||
this.m_page.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.m_page.Location = new System.Drawing.Point(5, 228);
|
||||
this.m_page.Name = "m_page";
|
||||
this.m_page.PageCount = 0;
|
||||
this.m_page.PageIndex = 1;
|
||||
this.m_page.PageSize = 10;
|
||||
this.m_page.Size = new System.Drawing.Size(427, 33);
|
||||
this.m_page.StartIndex = 0;
|
||||
this.m_page.TabIndex = 1;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(5, 47);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(437, 15);
|
||||
this.panel2.TabIndex = 1;
|
||||
//
|
||||
// txtSearch
|
||||
//
|
||||
this.txtSearch.BackColor = System.Drawing.Color.Transparent;
|
||||
this.txtSearch.ConerRadius = 5;
|
||||
this.txtSearch.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||
this.txtSearch.DecLength = 2;
|
||||
this.txtSearch.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.txtSearch.FillColor = System.Drawing.Color.Empty;
|
||||
this.txtSearch.FocusBorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
|
||||
this.txtSearch.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtSearch.InputText = "";
|
||||
this.txtSearch.InputType = HZH_Controls.TextInputType.NotControl;
|
||||
this.txtSearch.IsFocusColor = true;
|
||||
this.txtSearch.IsRadius = true;
|
||||
this.txtSearch.IsShowClearBtn = true;
|
||||
this.txtSearch.IsShowKeyboard = false;
|
||||
this.txtSearch.IsShowRect = true;
|
||||
this.txtSearch.IsShowSearchBtn = false;
|
||||
this.txtSearch.KeyBoardType = HZH_Controls.Controls.KeyBoardType.UCKeyBorderAll_EN;
|
||||
this.txtSearch.Location = new System.Drawing.Point(5, 5);
|
||||
this.txtSearch.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.txtSearch.MaxValue = new decimal(new int[] {
|
||||
1000000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.txtSearch.MinValue = new decimal(new int[] {
|
||||
1000000,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.txtSearch.Name = "txtSearch";
|
||||
this.txtSearch.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.txtSearch.PromptColor = System.Drawing.Color.Gray;
|
||||
this.txtSearch.PromptFont = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
this.txtSearch.PromptText = "输入内容模糊搜索";
|
||||
this.txtSearch.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
|
||||
this.txtSearch.RectWidth = 1;
|
||||
this.txtSearch.RegexPattern = "";
|
||||
this.txtSearch.Size = new System.Drawing.Size(437, 42);
|
||||
this.txtSearch.TabIndex = 0;
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
this.timer1.Interval = 1000;
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
//
|
||||
// ucSplitLine_V2
|
||||
//
|
||||
this.ucSplitLine_V2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_V2.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.ucSplitLine_V2.Location = new System.Drawing.Point(448, 1);
|
||||
this.ucSplitLine_V2.Name = "ucSplitLine_V2";
|
||||
this.ucSplitLine_V2.Size = new System.Drawing.Size(1, 333);
|
||||
this.ucSplitLine_V2.TabIndex = 3;
|
||||
this.ucSplitLine_V2.TabStop = false;
|
||||
//
|
||||
// ucSplitLine_V1
|
||||
//
|
||||
this.ucSplitLine_V1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_V1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.ucSplitLine_V1.Location = new System.Drawing.Point(0, 1);
|
||||
this.ucSplitLine_V1.Name = "ucSplitLine_V1";
|
||||
this.ucSplitLine_V1.Size = new System.Drawing.Size(1, 333);
|
||||
this.ucSplitLine_V1.TabIndex = 2;
|
||||
this.ucSplitLine_V1.TabStop = false;
|
||||
//
|
||||
// ucSplitLine_H2
|
||||
//
|
||||
this.ucSplitLine_H2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_H2.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.ucSplitLine_H2.Location = new System.Drawing.Point(0, 334);
|
||||
this.ucSplitLine_H2.Name = "ucSplitLine_H2";
|
||||
this.ucSplitLine_H2.Size = new System.Drawing.Size(449, 1);
|
||||
this.ucSplitLine_H2.TabIndex = 1;
|
||||
this.ucSplitLine_H2.TabStop = false;
|
||||
//
|
||||
// ucSplitLine_H1
|
||||
//
|
||||
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
|
||||
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 0);
|
||||
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
|
||||
this.ucSplitLine_H1.Size = new System.Drawing.Size(449, 1);
|
||||
this.ucSplitLine_H1.TabIndex = 0;
|
||||
this.ucSplitLine_H1.TabStop = false;
|
||||
//
|
||||
// UCComboxGridPanel
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.ucSplitLine_V2);
|
||||
this.Controls.Add(this.ucSplitLine_V1);
|
||||
this.Controls.Add(this.ucSplitLine_H2);
|
||||
this.Controls.Add(this.ucSplitLine_H1);
|
||||
this.Name = "UCComboxGridPanel";
|
||||
this.Size = new System.Drawing.Size(449, 335);
|
||||
this.Load += new System.EventHandler(this.UCComboxGridPanel_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.ucControlBase1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The uc split line h1
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H1;
|
||||
/// <summary>
|
||||
/// The uc split line h2
|
||||
/// </summary>
|
||||
private UCSplitLine_H ucSplitLine_H2;
|
||||
/// <summary>
|
||||
/// The uc split line v1
|
||||
/// </summary>
|
||||
private UCSplitLine_V ucSplitLine_V1;
|
||||
/// <summary>
|
||||
/// The uc split line v2
|
||||
/// </summary>
|
||||
private UCSplitLine_V ucSplitLine_V2;
|
||||
/// <summary>
|
||||
/// The panel1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
/// <summary>
|
||||
/// The uc control base1
|
||||
/// </summary>
|
||||
private UCControlBase ucControlBase1;
|
||||
/// <summary>
|
||||
/// The uc data grid view1
|
||||
/// </summary>
|
||||
private UCDataGridView ucDataGridView1;
|
||||
/// <summary>
|
||||
/// The panel2
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
/// <summary>
|
||||
/// The timer1
|
||||
/// </summary>
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
/// <summary>
|
||||
/// The text search
|
||||
/// </summary>
|
||||
private UCTextBoxEx txtSearch;
|
||||
private UCPagerControl m_page;
|
||||
}
|
||||
}
|
||||
188
UsingControl/HZHControls/Controls/ComboBox/UCComboxGridPanel.cs
Normal file
188
UsingControl/HZHControls/Controls/ComboBox/UCComboxGridPanel.cs
Normal file
@@ -0,0 +1,188 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : HZH_Controls
|
||||
// Created : 08-28-2019
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="UCComboxGridPanel.cs">
|
||||
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
|
||||
// </copyright>
|
||||
//
|
||||
// Blog: https://www.cnblogs.com/bfyx
|
||||
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
|
||||
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
|
||||
//
|
||||
// If you use this code, please keep this note.
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HZH_Controls.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Class UCComboxGridPanel.
|
||||
/// Implements the <see cref="System.Windows.Forms.UserControl" />
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Windows.Forms.UserControl" />
|
||||
[ToolboxItem(false)]
|
||||
public partial class UCComboxGridPanel : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 项点击事件
|
||||
/// </summary>
|
||||
[Description("项点击事件"), Category("自定义")]
|
||||
public event DataGridViewEventHandler ItemClick;
|
||||
/// <summary>
|
||||
/// The m row type
|
||||
/// </summary>
|
||||
private Type m_rowType = typeof(UCDataGridViewRow);
|
||||
/// <summary>
|
||||
/// 行类型
|
||||
/// </summary>
|
||||
/// <value>The type of the row.</value>
|
||||
[Description("行类型"), Category("自定义")]
|
||||
public Type RowType
|
||||
{
|
||||
get { return m_rowType; }
|
||||
set
|
||||
{
|
||||
m_rowType = value;
|
||||
this.ucDataGridView1.RowType = m_rowType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The m columns
|
||||
/// </summary>
|
||||
private List<DataGridViewColumnEntity> m_columns = null;
|
||||
/// <summary>
|
||||
/// 列
|
||||
/// </summary>
|
||||
/// <value>The columns.</value>
|
||||
[Description("列"), Category("自定义")]
|
||||
public List<DataGridViewColumnEntity> Columns
|
||||
{
|
||||
get { return m_columns; }
|
||||
set
|
||||
{
|
||||
m_columns = value;
|
||||
this.ucDataGridView1.Columns = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The m data source
|
||||
/// </summary>
|
||||
private List<object> m_dataSource = null;
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
/// <value>The data source.</value>
|
||||
[Description("数据源"), Category("自定义")]
|
||||
public List<object> DataSource
|
||||
{
|
||||
get { return m_dataSource; }
|
||||
set { m_dataSource = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The string last search text
|
||||
/// </summary>
|
||||
private string strLastSearchText = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UCComboxGridPanel" /> class.
|
||||
/// </summary>
|
||||
public UCComboxGridPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.txtSearch.txtInput.TextChanged += txtInput_TextChanged;
|
||||
this.ucDataGridView1.ItemClick += ucDataGridView1_ItemClick;
|
||||
m_page.ShowSourceChanged += m_page_ShowSourceChanged;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Handles the ItemClick event of the ucDataGridView1 control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="DataGridViewEventArgs" /> instance containing the event data.</param>
|
||||
void ucDataGridView1_ItemClick(object sender, DataGridViewEventArgs e)
|
||||
{
|
||||
if (ItemClick != null)
|
||||
{
|
||||
ItemClick((sender as IDataGridViewRow).DataSource, null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the TextChanged event of the txtInput control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
void txtInput_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
timer1.Enabled = false;
|
||||
timer1.Enabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Load event of the UCComboxGridPanel control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void UCComboxGridPanel_Load(object sender, EventArgs e)
|
||||
{
|
||||
m_page.DataSource = m_dataSource;
|
||||
this.ucDataGridView1.DataSource = m_page.GetCurrentSource();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Tick event of the timer1 control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (strLastSearchText == txtSearch.InputText)
|
||||
{
|
||||
timer1.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
strLastSearchText = txtSearch.InputText;
|
||||
Search(txtSearch.InputText);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searches the specified string text.
|
||||
/// </summary>
|
||||
/// <param name="strText">The string text.</param>
|
||||
private void Search(string strText)
|
||||
{
|
||||
m_page.StartIndex = 0;
|
||||
if (!string.IsNullOrEmpty(strText))
|
||||
{
|
||||
strText = strText.ToLower().Trim();
|
||||
List<object> lst = m_dataSource.FindAll(p => m_columns.Any(c => (c.Format == null ? (p.GetType().GetProperty(c.DataField).GetValue(p, null).ToStringExt()) : c.Format(p.GetType().GetProperty(c.DataField).GetValue(p, null))).ToLower().Contains(strText)));
|
||||
m_page.DataSource = lst;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_page.DataSource = m_dataSource;
|
||||
}
|
||||
m_page.Reload();
|
||||
}
|
||||
|
||||
void m_page_ShowSourceChanged(object currentSource)
|
||||
{
|
||||
this.ucDataGridView1.DataSource = currentSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
Reference in New Issue
Block a user