Commit 3622c191 HZH

新增DataGridView,分页控件

1 个父辈 ee050c1b
正在显示 147 个修改的文件 包含 2756 行增加2198 行删除
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013 # Visual Studio 2013
VisualStudioVersion = 12.0.21005.1 VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HZH_Controls", "HZH_Controls\HZH_Controls.csproj", "{AF32E163-C577-4CBC-A072-0DC1CE0E1DA3}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HZH_Controls", "HZH_Controls\HZH_Controls.csproj", "{AF32E163-C577-4CBC-A072-0DC1CE0E1DA3}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{53CCD007-AA85-4CCF-AE81-BBB8B1CBEB1F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{53CCD007-AA85-4CCF-AE81-BBB8B1CBEB1F}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AF32E163-C577-4CBC-A072-0DC1CE0E1DA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AF32E163-C577-4CBC-A072-0DC1CE0E1DA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF32E163-C577-4CBC-A072-0DC1CE0E1DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU {AF32E163-C577-4CBC-A072-0DC1CE0E1DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF32E163-C577-4CBC-A072-0DC1CE0E1DA3}.Release|Any CPU.ActiveCfg = Release|Any CPU {AF32E163-C577-4CBC-A072-0DC1CE0E1DA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF32E163-C577-4CBC-A072-0DC1CE0E1DA3}.Release|Any CPU.Build.0 = Release|Any CPU {AF32E163-C577-4CBC-A072-0DC1CE0E1DA3}.Release|Any CPU.Build.0 = Release|Any CPU
{53CCD007-AA85-4CCF-AE81-BBB8B1CBEB1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {53CCD007-AA85-4CCF-AE81-BBB8B1CBEB1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{53CCD007-AA85-4CCF-AE81-BBB8B1CBEB1F}.Debug|Any CPU.Build.0 = Debug|Any CPU {53CCD007-AA85-4CCF-AE81-BBB8B1CBEB1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{53CCD007-AA85-4CCF-AE81-BBB8B1CBEB1F}.Release|Any CPU.ActiveCfg = Release|Any CPU {53CCD007-AA85-4CCF-AE81-BBB8B1CBEB1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{53CCD007-AA85-4CCF-AE81-BBB8B1CBEB1F}.Release|Any CPU.Build.0 = Release|Any CPU {53CCD007-AA85-4CCF-AE81-BBB8B1CBEB1F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
public partial class UCBtnExt public partial class UCBtnExt
{ {
/// <summary> /// <summary>
/// 必需的设计器变量。 /// 必需的设计器变量。
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 清理所有正在使用的资源。 /// 清理所有正在使用的资源。
/// </summary> /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region 组件设计器生成的代码 #region 组件设计器生成的代码
/// <summary> /// <summary>
/// 设计器支持所需的方法 - 不要 /// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// 使用代码编辑器修改此方法的内容。
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UCBtnExt)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UCBtnExt));
this.lbl = new System.Windows.Forms.Label(); this.lbl = new System.Windows.Forms.Label();
this.lblTips = new System.Windows.Forms.Label(); this.lblTips = new System.Windows.Forms.Label();
this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.SuspendLayout(); this.SuspendLayout();
// //
// lbl // lbl
// //
this.lbl.BackColor = System.Drawing.Color.Transparent; this.lbl.BackColor = System.Drawing.Color.Transparent;
this.lbl.Dock = System.Windows.Forms.DockStyle.Fill; this.lbl.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbl.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lbl.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lbl.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.lbl.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lbl.Location = new System.Drawing.Point(0, 0); this.lbl.Location = new System.Drawing.Point(0, 0);
this.lbl.Name = "lbl"; this.lbl.Name = "lbl";
this.lbl.Size = new System.Drawing.Size(184, 60); this.lbl.Size = new System.Drawing.Size(184, 60);
this.lbl.TabIndex = 0; this.lbl.TabIndex = 0;
this.lbl.Text = "自定义按钮"; this.lbl.Text = "自定义按钮";
this.lbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lbl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbl_MouseDown); this.lbl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbl_MouseDown);
// //
// lblTips // lblTips
// //
this.lblTips.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.lblTips.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.lblTips.BackColor = System.Drawing.Color.Transparent; this.lblTips.BackColor = System.Drawing.Color.Transparent;
this.lblTips.Font = new System.Drawing.Font("Arial Unicode MS", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblTips.Font = new System.Drawing.Font("Arial Unicode MS", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTips.ForeColor = System.Drawing.Color.White; this.lblTips.ForeColor = System.Drawing.Color.White;
this.lblTips.ImageIndex = 0; this.lblTips.ImageIndex = 0;
this.lblTips.ImageList = this.imageList1; this.lblTips.ImageList = this.imageList1;
this.lblTips.Location = new System.Drawing.Point(158, 0); this.lblTips.Location = new System.Drawing.Point(158, 0);
this.lblTips.Name = "lblTips"; this.lblTips.Name = "lblTips";
this.lblTips.Size = new System.Drawing.Size(24, 24); this.lblTips.Size = new System.Drawing.Size(24, 24);
this.lblTips.TabIndex = 1; this.lblTips.TabIndex = 1;
this.lblTips.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblTips.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lblTips.Visible = false; this.lblTips.Visible = false;
// //
// imageList1 // imageList1
// //
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "tips.png"); this.imageList1.Images.SetKeyName(0, "tips.png");
// //
// UCBtnExt // UCBtnExt
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.Transparent; this.BackColor = System.Drawing.Color.Transparent;
this.ConerRadius = 5; this.ConerRadius = 5;
this.Controls.Add(this.lblTips); this.Controls.Add(this.lblTips);
this.Controls.Add(this.lbl); this.Controls.Add(this.lbl);
this.Cursor = System.Windows.Forms.Cursors.Hand; this.Cursor = System.Windows.Forms.Cursors.Hand;
this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.IsShowRect = true; this.IsShowRect = true;
this.IsRadius = true; this.IsRadius = true;
this.Margin = new System.Windows.Forms.Padding(0); this.Margin = new System.Windows.Forms.Padding(0);
this.Name = "UCBtnExt"; this.Name = "UCBtnExt";
this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.Size = new System.Drawing.Size(184, 60); this.Size = new System.Drawing.Size(184, 60);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
public System.Windows.Forms.Label lbl; public System.Windows.Forms.Label lbl;
private System.Windows.Forms.Label lblTips; private System.Windows.Forms.Label lblTips;
private System.Windows.Forms.ImageList imageList1; private System.Windows.Forms.ImageList imageList1;
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
[DefaultEvent("BtnClick")] [DefaultEvent("BtnClick")]
public partial class UCBtnExt : UCControlBase public partial class UCBtnExt : UCControlBase
{ {
#region 字段属性 #region 字段属性
[Description("是否显示角标"), Category("自定义")] [Description("是否显示角标"), Category("自定义")]
public bool IsShowTips public bool IsShowTips
{ {
get get
{ {
return this.lblTips.Visible; return this.lblTips.Visible;
} }
set set
{ {
this.lblTips.Visible = value; this.lblTips.Visible = value;
} }
} }
[Description("角标文字"), Category("自定义")] [Description("角标文字"), Category("自定义")]
public string TipsText public string TipsText
{ {
get get
{ {
return this.lblTips.Text; return this.lblTips.Text;
} }
set set
{ {
this.lblTips.Text = value; this.lblTips.Text = value;
} }
} }
private Color _btnBackColor = Color.White; private Color _btnBackColor = Color.White;
[Description("按钮背景色"), Category("自定义")] [Description("按钮背景色"), Category("自定义")]
public Color BtnBackColor public Color BtnBackColor
{ {
get { return _btnBackColor; } get { return _btnBackColor; }
set set
{ {
_btnBackColor = value; _btnBackColor = value;
this.BackColor = value; this.BackColor = value;
} }
} }
private Color _btnForeColor = Color.Black; private Color _btnForeColor = Color.Black;
/// <summary> /// <summary>
/// 按钮字体颜色 /// 按钮字体颜色
/// </summary> /// </summary>
[Description("按钮字体颜色"), Category("自定义")] [Description("按钮字体颜色"), Category("自定义")]
public Color BtnForeColor public Color BtnForeColor
{ {
get { return _btnForeColor; } get { return _btnForeColor; }
set set
{ {
_btnForeColor = value; _btnForeColor = value;
this.lbl.ForeColor = value; this.lbl.ForeColor = value;
} }
} }
private Font _btnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); private Font _btnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
/// <summary> /// <summary>
/// 按钮字体 /// 按钮字体
/// </summary> /// </summary>
[Description("按钮字体"), Category("自定义")] [Description("按钮字体"), Category("自定义")]
public Font BtnFont public Font BtnFont
{ {
get { return _btnFont; } get { return _btnFont; }
set set
{ {
_btnFont = value; _btnFont = value;
this.lbl.Font = value; this.lbl.Font = value;
} }
} }
/// <summary> /// <summary>
/// 按钮点击事件 /// 按钮点击事件
/// </summary> /// </summary>
[Description("按钮点击事件"), Category("自定义")] [Description("按钮点击事件"), Category("自定义")]
public event EventHandler BtnClick; public event EventHandler BtnClick;
private string _btnText; private string _btnText;
/// <summary> /// <summary>
/// 按钮文字 /// 按钮文字
/// </summary> /// </summary>
[Description("按钮文字"), Category("自定义")] [Description("按钮文字"), Category("自定义")]
public string BtnText public string BtnText
{ {
get { return _btnText; } get { return _btnText; }
set set
{ {
_btnText = value; _btnText = value;
lbl.Text = value; lbl.Text = value;
} }
} }
#endregion #endregion
public UCBtnExt() public UCBtnExt()
{ {
InitializeComponent(); InitializeComponent();
this.TabStop = false; this.TabStop = false;
} }
private void lbl_MouseDown(object sender, MouseEventArgs e) private void lbl_MouseDown(object sender, MouseEventArgs e)
{ {
if (this.BtnClick != null) if (this.BtnClick != null)
BtnClick(this, e); BtnClick(this, e);
} }
} }
} }
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
partial class UCBtnFillet partial class UCBtnFillet
{ {
/// <summary> /// <summary>
/// 必需的设计器变量。 /// 必需的设计器变量。
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 清理所有正在使用的资源。 /// 清理所有正在使用的资源。
/// </summary> /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region 组件设计器生成的代码 #region 组件设计器生成的代码
/// <summary> /// <summary>
/// 设计器支持所需的方法 - 不要 /// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// 使用代码编辑器修改此方法的内容。
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.lbl = new System.Windows.Forms.Label(); this.lbl = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// lbl // lbl
// //
this.lbl.Dock = System.Windows.Forms.DockStyle.Fill; this.lbl.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbl.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); this.lbl.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.lbl.Image = global::HZH_Controls.Properties.Resources.alarm; this.lbl.Image = global::HZH_Controls.Properties.Resources.alarm;
this.lbl.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.lbl.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lbl.Location = new System.Drawing.Point(0, 0); this.lbl.Location = new System.Drawing.Point(0, 0);
this.lbl.Name = "lbl"; this.lbl.Name = "lbl";
this.lbl.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0); this.lbl.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0);
this.lbl.Size = new System.Drawing.Size(120, 76); this.lbl.Size = new System.Drawing.Size(120, 76);
this.lbl.TabIndex = 0; this.lbl.TabIndex = 0;
this.lbl.Text = "按钮1 "; this.lbl.Text = "按钮1 ";
this.lbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.lbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lbl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbl_MouseDown); this.lbl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbl_MouseDown);
// //
// UCBtnFillet // UCBtnFillet
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.Transparent; this.BackColor = System.Drawing.Color.Transparent;
this.ConerRadius = 5; this.ConerRadius = 5;
this.Controls.Add(this.lbl); this.Controls.Add(this.lbl);
this.IsShowRect = true; this.IsShowRect = true;
this.IsRadius = true; this.IsRadius = true;
this.Name = "UCBtnFillet"; this.Name = "UCBtnFillet";
this.Size = new System.Drawing.Size(120, 76); this.Size = new System.Drawing.Size(120, 76);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.Label lbl; private System.Windows.Forms.Label lbl;
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
[DefaultEvent("BtnClick")] [DefaultEvent("BtnClick")]
public partial class UCBtnFillet : UCControlBase public partial class UCBtnFillet : UCControlBase
{ {
[Description("按钮点击事件"), Category("自定义")] [Description("按钮点击事件"), Category("自定义")]
public event EventHandler BtnClick; public event EventHandler BtnClick;
[Description("按钮图片"), Category("自定义")] [Description("按钮图片"), Category("自定义")]
public Image BtnImage public Image BtnImage
{ {
get get
{ {
return lbl.Image; return lbl.Image;
} }
set set
{ {
lbl.Image = value; lbl.Image = value;
} }
} }
/// <summary> /// <summary>
/// 按钮文字 /// 按钮文字
/// </summary> /// </summary>
[Description("按钮文字"), Category("自定义")] [Description("按钮文字"), Category("自定义")]
public string BtnText public string BtnText
{ {
get { return lbl.Text; } get { return lbl.Text; }
set set
{ {
lbl.Text = value; lbl.Text = value;
} }
} }
public UCBtnFillet() public UCBtnFillet()
{ {
InitializeComponent(); InitializeComponent();
} }
private void lbl_MouseDown(object sender, MouseEventArgs e) private void lbl_MouseDown(object sender, MouseEventArgs e)
{ {
if (BtnClick != null) if (BtnClick != null)
BtnClick(this, e); BtnClick(this, e);
} }
} }
} }
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
partial class UCBtnImg partial class UCBtnImg
{ {
/// <summary> /// <summary>
/// 必需的设计器变量。 /// 必需的设计器变量。
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 清理所有正在使用的资源。 /// 清理所有正在使用的资源。
/// </summary> /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region 组件设计器生成的代码 #region 组件设计器生成的代码
/// <summary> /// <summary>
/// 设计器支持所需的方法 - 不要 /// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// 使用代码编辑器修改此方法的内容。
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UCBtnImg)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UCBtnImg));
this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.SuspendLayout(); this.SuspendLayout();
// //
// lbl // lbl
// //
//this.lbl.Font = new System.Drawing.Font("微软雅黑", 17F); //this.lbl.Font = new System.Drawing.Font("微软雅黑", 17F);
//this.lbl.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(102))))); //this.lbl.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(102)))));
this.lbl.ImageIndex = 0; this.lbl.ImageIndex = 0;
this.lbl.ImageList = this.imageList1; this.lbl.ImageList = this.imageList1;
this.lbl.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0); this.lbl.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0);
this.lbl.Text = " 自定义按钮"; this.lbl.Text = " 自定义按钮";
this.lbl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.lbl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// imageList1 // imageList1
// //
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "back.png"); this.imageList1.Images.SetKeyName(0, "back.png");
// //
// BtnBack // BtnBack
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Name = "BtnBack"; this.Name = "BtnBack";
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.ImageList imageList1; private System.Windows.Forms.ImageList imageList1;
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public partial class UCBtnImg : UCBtnExt public partial class UCBtnImg : UCBtnExt
{ {
private string _btnText = "自定义按钮"; private string _btnText = "自定义按钮";
/// <summary> /// <summary>
/// 按钮文字 /// 按钮文字
/// </summary> /// </summary>
[Description("按钮文字"), Category("自定义")] [Description("按钮文字"), Category("自定义")]
public new string BtnText public new string BtnText
{ {
get { return _btnText; } get { return _btnText; }
set set
{ {
_btnText = value; _btnText = value;
lbl.Text = " " + value; lbl.Text = " " + value;
lbl.Refresh(); lbl.Refresh();
} }
} }
/// <summary> /// <summary>
/// 图片 /// 图片
/// </summary> /// </summary>
[Description("图片"), Category("自定义")] [Description("图片"), Category("自定义")]
public Image Image public Image Image
{ {
get get
{ {
return this.imageList1.Images[0]; return this.imageList1.Images[0];
} }
set set
{ {
this.imageList1.Images.Clear(); this.imageList1.Images.Clear();
this.imageList1.Images.Add(value); this.imageList1.Images.Add(value);
this.lbl.ImageIndex = 0; this.lbl.ImageIndex = 0;
} }
} }
public UCBtnImg() public UCBtnImg()
{ {
InitializeComponent(); InitializeComponent();
base.BtnForeColor = ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(102))))); base.BtnForeColor = ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(102)))));
base.BtnFont = new System.Drawing.Font("微软雅黑", 17F); base.BtnFont = new System.Drawing.Font("微软雅黑", 17F);
base.BtnText = " 自定义按钮"; base.BtnText = " 自定义按钮";
} }
} }
} }
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
partial class UCCheckBox partial class UCCheckBox
{ {
/// <summary> /// <summary>
/// 必需的设计器变量。 /// 必需的设计器变量。
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 清理所有正在使用的资源。 /// 清理所有正在使用的资源。
/// </summary> /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region 组件设计器生成的代码 #region 组件设计器生成的代码
/// <summary> /// <summary>
/// 设计器支持所需的方法 - 不要 /// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// 使用代码编辑器修改此方法的内容。
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// panel1 // panel1
// //
this.panel1.BackgroundImage = global::HZH_Controls.Properties.Resources.checkbox0; this.panel1.BackgroundImage = global::HZH_Controls.Properties.Resources.checkbox0;
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.panel1.Dock = System.Windows.Forms.DockStyle.Left; this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(1, 1); this.panel1.Location = new System.Drawing.Point(1, 1);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(18, 28); this.panel1.Size = new System.Drawing.Size(18, 28);
this.panel1.TabIndex = 0; this.panel1.TabIndex = 0;
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CheckBox_MouseDown); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CheckBox_MouseDown);
// //
// label1 // label1
// //
this.label1.Dock = System.Windows.Forms.DockStyle.Fill; this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Font = new System.Drawing.Font("微软雅黑", 12F); this.label1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(62)))), ((int)(((byte)(62))))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(62)))), ((int)(((byte)(62)))));
this.label1.Location = new System.Drawing.Point(19, 1); this.label1.Location = new System.Drawing.Point(19, 1);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0); this.label1.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0);
this.label1.Size = new System.Drawing.Size(213, 28); this.label1.Size = new System.Drawing.Size(213, 28);
this.label1.TabIndex = 1; this.label1.TabIndex = 1;
this.label1.Text = "复选框"; this.label1.Text = "复选框";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.label1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CheckBox_MouseDown); this.label1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CheckBox_MouseDown);
// //
// UCCheckBox // UCCheckBox
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.Transparent; this.BackColor = System.Drawing.Color.Transparent;
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.Name = "UCCheckBox"; this.Name = "UCCheckBox";
this.Padding = new System.Windows.Forms.Padding(1); this.Padding = new System.Windows.Forms.Padding(1);
this.Size = new System.Drawing.Size(233, 30); this.Size = new System.Drawing.Size(233, 30);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CheckBox_MouseDown); this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.CheckBox_MouseDown);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
[DefaultEvent("CheckedChangeEvent")] [DefaultEvent("CheckedChangeEvent")]
public partial class UCCheckBox : UserControl public partial class UCCheckBox : UserControl
{ {
[Description("选中改变事件"), Category("自定义")] [Description("选中改变事件"), Category("自定义")]
public event EventHandler CheckedChangeEvent; public event EventHandler CheckedChangeEvent;
[Description("字体"), Category("自定义")] [Description("字体"), Category("自定义")]
public override Font Font public override Font Font
{ {
get get
{ {
return base.Font; return base.Font;
} }
set set
{ {
base.Font = value; base.Font = value;
label1.Font = value; label1.Font = value;
} }
} }
private Color _ForeColor = Color.FromArgb(62, 62, 62); private Color _ForeColor = Color.FromArgb(62, 62, 62);
[Description("字体颜色"), Category("自定义")] [Description("字体颜色"), Category("自定义")]
public new Color ForeColor public new Color ForeColor
{ {
get { return _ForeColor; } get { return _ForeColor; }
set set
{ {
label1.ForeColor = value; label1.ForeColor = value;
_ForeColor = value; _ForeColor = value;
} }
} }
private string _Text = "复选框"; private string _Text = "复选框";
[Description("文本"), Category("自定义")] [Description("文本"), Category("自定义")]
public string TextValue public string TextValue
{ {
get { return _Text; } get { return _Text; }
set set
{ {
label1.Text = value; label1.Text = value;
_Text = value; _Text = value;
} }
} }
private bool _checked = false; private bool _checked = false;
[Description("是否选中"), Category("自定义")] [Description("是否选中"), Category("自定义")]
public bool Checked public bool Checked
{ {
get get
{ {
return _checked; return _checked;
} }
set set
{ {
if (_checked != value) if (_checked != value)
{ {
_checked = value; _checked = value;
if (base.Enabled) if (base.Enabled)
{ {
if (_checked) if (_checked)
{ {
panel1.BackgroundImage = Properties.Resources.checkbox1; panel1.BackgroundImage = Properties.Resources.checkbox1;
} }
else else
{ {
panel1.BackgroundImage = Properties.Resources.checkbox0; panel1.BackgroundImage = Properties.Resources.checkbox0;
} }
} }
else else
{ {
if (_checked) if (_checked)
{ {
panel1.BackgroundImage = Properties.Resources.checkbox10; panel1.BackgroundImage = Properties.Resources.checkbox10;
} }
else else
{ {
panel1.BackgroundImage = Properties.Resources.checkbox00; panel1.BackgroundImage = Properties.Resources.checkbox00;
} }
} }
if (CheckedChangeEvent != null) if (CheckedChangeEvent != null)
{ {
CheckedChangeEvent(this, null); CheckedChangeEvent(this, null);
} }
} }
} }
} }
public new bool Enabled public new bool Enabled
{ {
get get
{ {
return base.Enabled; return base.Enabled;
} }
set set
{ {
base.Enabled = value; base.Enabled = value;
if (value) if (value)
{ {
if (_checked) if (_checked)
{ {
panel1.BackgroundImage = Properties.Resources.checkbox1; panel1.BackgroundImage = Properties.Resources.checkbox1;
} }
else else
{ {
panel1.BackgroundImage = Properties.Resources.checkbox0; panel1.BackgroundImage = Properties.Resources.checkbox0;
} }
} }
else else
{ {
if (_checked) if (_checked)
{ {
panel1.BackgroundImage = Properties.Resources.checkbox10; panel1.BackgroundImage = Properties.Resources.checkbox10;
} }
else else
{ {
panel1.BackgroundImage = Properties.Resources.checkbox00; panel1.BackgroundImage = Properties.Resources.checkbox00;
} }
} }
} }
} }
public UCCheckBox() public UCCheckBox()
{ {
InitializeComponent(); InitializeComponent();
} }
private void CheckBox_MouseDown(object sender, MouseEventArgs e) private void CheckBox_MouseDown(object sender, MouseEventArgs e)
{ {
Checked = !Checked; Checked = !Checked;
} }
} }
} }
namespace HZH_Controls.Controls
{
partial class UCDataGridViewRow
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
this.panCells = new System.Windows.Forms.TableLayoutPanel();
this.SuspendLayout();
//
// ucSplitLine_H1
//
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 55);
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
this.ucSplitLine_H1.Size = new System.Drawing.Size(661, 1);
this.ucSplitLine_H1.TabIndex = 0;
this.ucSplitLine_H1.TabStop = false;
//
// panCells
//
this.panCells.ColumnCount = 1;
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.panCells.Dock = System.Windows.Forms.DockStyle.Fill;
this.panCells.Location = new System.Drawing.Point(0, 0);
this.panCells.Name = "panCells";
this.panCells.RowCount = 1;
this.panCells.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.panCells.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.panCells.Size = new System.Drawing.Size(661, 55);
this.panCells.TabIndex = 1;
//
// UCDataGridViewItem
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.panCells);
this.Controls.Add(this.ucSplitLine_H1);
this.Name = "UCDataGridViewItem";
this.Size = new System.Drawing.Size(661, 56);
this.ResumeLayout(false);
}
#endregion
private UCSplitLine_H ucSplitLine_H1;
private System.Windows.Forms.TableLayoutPanel panCells;
}
}
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
{
public partial class UCDataGridViewRow : UserControl, IDataGridViewRow
{
#region 属性
public event DataGridViewCellEventHandler CheckBoxChangeEvent;
public event DataGridViewCellEventHandler CellClick;
public event DataGridViewCellEventHandler SourceChanged;
public List<DataGridViewColumnEntity> Columns
{
get;
set;
}
public object DataSource
{
get;
set;
}
public bool IsShowCheckBox
{
get;
set;
}
private bool m_isChecked;
public bool IsChecked
{
get
{
return m_isChecked;
}
set
{
if (m_isChecked != value)
{
m_isChecked = value;
(this.panCells.Controls.Find("check", false)[0] as UCCheckBox).Checked = value;
}
}
}
#endregion
public UCDataGridViewRow()
{
InitializeComponent();
}
public void BindingCellData()
{
for (int i = 0; i < Columns.Count; i++)
{
DataGridViewColumnEntity com = Columns[i];
var cs = this.panCells.Controls.Find("lbl_" + com.DataField, false);
if (cs != null && cs.Length > 0)
{
var pro = DataSource.GetType().GetProperty(com.DataField);
if (pro != null)
cs[0].Text = pro.GetValue(DataSource, null).ToStringExt();
}
}
}
void Item_MouseDown(object sender, MouseEventArgs e)
{
if (CellClick != null)
{
CellClick(sender, new DataGridViewCellEventArgs()
{
CellControl = this,
CellIndex = (sender as Control).Tag.ToInt()
});
}
}
public void SetSelect(bool blnSelected)
{
if (blnSelected)
{
this.BackColor = Color.FromArgb(255, 247, 245);
}
else
{
this.BackColor = Color.Transparent;
}
}
public void ReloadCells()
{
try
{
ControlHelper.FreezeControl(this, true);
this.panCells.Controls.Clear();
this.panCells.ColumnStyles.Clear();
int intColumnsCount = Columns.Count();
if (Columns != null && intColumnsCount > 0)
{
if (IsShowCheckBox)
{
intColumnsCount++;
}
this.panCells.ColumnCount = intColumnsCount;
for (int i = 0; i < intColumnsCount; i++)
{
Control c = null;
if (i == 0 && IsShowCheckBox)
{
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(SizeType.Absolute, 30F));
UCCheckBox box = new UCCheckBox();
box.Name = "check";
box.TextValue = "";
box.Size = new Size(30, 30);
box.Dock = DockStyle.Fill;
box.CheckedChangeEvent += (a, b) =>
{
IsChecked = box.Checked;
if (CheckBoxChangeEvent != null)
{
CheckBoxChangeEvent(a, new DataGridViewCellEventArgs()
{
CellControl = box,
CellIndex = 0
});
}
};
c = box;
}
else
{
var item = Columns[i - (IsShowCheckBox ? 1 : 0)];
this.panCells.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(item.WidthType, item.Width));
Label lbl = new Label();
lbl.Tag = i - (IsShowCheckBox ? 1 : 0);
lbl.Name = "lbl_" + item.DataField;
lbl.Font = new Font("微软雅黑", 12);
lbl.ForeColor = Color.Black;
lbl.AutoSize = false;
lbl.Dock = DockStyle.Fill;
lbl.TextAlign = ContentAlignment.MiddleCenter;
lbl.MouseDown += (a, b) =>
{
Item_MouseDown(a, b);
};
c = lbl;
}
this.panCells.Controls.Add(c, i, 0);
}
}
}
finally
{
ControlHelper.FreezeControl(this, false);
}
}
}
}
<?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>
\ No newline at end of file \ No newline at end of file
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
public enum DateTimePickerType public enum DateTimePickerType
{ {
DateTime = 1, DateTime = 1,
Date = 2, Date = 2,
Time = 4 Time = 4
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
[DefaultEvent("KeyDown")] [DefaultEvent("KeyDown")]
public partial class UCKeyBorderAll : UserControl public partial class UCKeyBorderAll : UserControl
{ {
private KeyBorderCharType _charType = KeyBorderCharType.CHAR; private KeyBorderCharType _charType = KeyBorderCharType.CHAR;
[Description("默认显示样式"), Category("自定义")] [Description("默认显示样式"), Category("自定义")]
public KeyBorderCharType CharType public KeyBorderCharType CharType
{ {
get { return _charType; } get { return _charType; }
set set
{ {
_charType = value; _charType = value;
if (value == KeyBorderCharType.CHAR) if (value == KeyBorderCharType.CHAR)
{ {
if (label37.Text.ToLower() == "abc.") if (label37.Text.ToLower() == "abc.")
{ {
CharOrNum(); CharOrNum();
} }
} }
else else
{ {
if (label37.Text.ToLower() == "?123") if (label37.Text.ToLower() == "?123")
{ {
CharOrNum(); CharOrNum();
} }
} }
} }
} }
[Description("按键点击事件"), Category("自定义")] [Description("按键点击事件"), Category("自定义")]
public event EventHandler KeyClick; public event EventHandler KeyClick;
[Description("回车点击事件"), Category("自定义")] [Description("回车点击事件"), Category("自定义")]
public event EventHandler EnterClick; public event EventHandler EnterClick;
[Description("删除点击事件"), Category("自定义")] [Description("删除点击事件"), Category("自定义")]
public event EventHandler BackspaceClike; public event EventHandler BackspaceClike;
[Description("收起点击事件"), Category("自定义")] [Description("收起点击事件"), Category("自定义")]
public event EventHandler RetractClike; public event EventHandler RetractClike;
public UCKeyBorderAll() public UCKeyBorderAll()
{ {
InitializeComponent(); InitializeComponent();
} }
private void KeyDown_MouseDown(object sender, MouseEventArgs e) private void KeyDown_MouseDown(object sender, MouseEventArgs e)
{ {
Label lbl = sender as Label; Label lbl = sender as Label;
if (string.IsNullOrEmpty(lbl.Text)) if (string.IsNullOrEmpty(lbl.Text))
{ {
return; return;
} }
if (lbl.Text == "大写") if (lbl.Text == "大写")
{ {
ToUper(true); ToUper(true);
lbl.Text = "小写"; lbl.Text = "小写";
} }
else if (lbl.Text == "小写") else if (lbl.Text == "小写")
{ {
ToUper(false); ToUper(false);
lbl.Text = "大写"; lbl.Text = "大写";
} }
else if (lbl.Text == "?123" || lbl.Text == "abc.") else if (lbl.Text == "?123" || lbl.Text == "abc.")
{ {
CharOrNum(); CharOrNum();
} }
else if (lbl.Text == "空格") else if (lbl.Text == "空格")
{ {
SendKeys.Send(" "); SendKeys.Send(" ");
} }
else if (lbl.Text == "删除") else if (lbl.Text == "删除")
{ {
SendKeys.Send("{BACKSPACE}"); SendKeys.Send("{BACKSPACE}");
if (BackspaceClike != null) if (BackspaceClike != null)
BackspaceClike(sender, e); BackspaceClike(sender, e);
} }
else if (lbl.Text == "回车") else if (lbl.Text == "回车")
{ {
SendKeys.Send("{ENTER}"); SendKeys.Send("{ENTER}");
if (EnterClick != null) if (EnterClick != null)
EnterClick(sender, e); EnterClick(sender, e);
} }
else if (lbl.Text == "收起") else if (lbl.Text == "收起")
{ {
if (RetractClike != null) if (RetractClike != null)
RetractClike(sender, e); RetractClike(sender, e);
} }
else else
{ {
SendKeys.Send(lbl.Text); SendKeys.Send(lbl.Text);
} }
if (KeyClick != null) if (KeyClick != null)
KeyClick(sender, e); KeyClick(sender, e);
} }
private void ToUper(bool bln) private void ToUper(bool bln)
{ {
foreach (Control item in this.tableLayoutPanel2.Controls) foreach (Control item in this.tableLayoutPanel2.Controls)
{ {
if (item is Panel) if (item is Panel)
{ {
foreach (Control pc in item.Controls) foreach (Control pc in item.Controls)
{ {
if (pc is Label) if (pc is Label)
{ {
if (pc.Text == "abc.") if (pc.Text == "abc.")
break; break;
if (bln) if (bln)
{ {
pc.Text = pc.Text.ToUpper(); pc.Text = pc.Text.ToUpper();
} }
else else
{ {
pc.Text = pc.Text.ToLower(); pc.Text = pc.Text.ToLower();
} }
break; break;
} }
} }
} }
} }
} }
private void CharOrNum() private void CharOrNum()
{ {
foreach (Control item in this.tableLayoutPanel2.Controls) foreach (Control item in this.tableLayoutPanel2.Controls)
{ {
if (item is Panel) if (item is Panel)
{ {
foreach (Control pc in item.Controls) foreach (Control pc in item.Controls)
{ {
if (pc is Label) if (pc is Label)
{ {
string strTag = pc.Text; string strTag = pc.Text;
pc.Text = pc.Tag.ToString(); pc.Text = pc.Tag.ToString();
pc.Tag = strTag; pc.Tag = strTag;
break; break;
} }
} }
} }
} }
} }
} }
public enum KeyBorderCharType public enum KeyBorderCharType
{ {
CHAR = 1, CHAR = 1,
NUMBER = 2 NUMBER = 2
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
public partial class UCKeyBorderNum : UserControl public partial class UCKeyBorderNum : UserControl
{ {
private bool useCustomEvent = false; private bool useCustomEvent = false;
/// <summary> /// <summary>
/// 是否使用自定义的事件来接收按键,当为true时将不再向系统发送按键请求 /// 是否使用自定义的事件来接收按键,当为true时将不再向系统发送按键请求
/// </summary> /// </summary>
[Description("是否使用自定义的事件来接收按键,当为true时将不再向系统发送按键请求"), Category("自定义")] [Description("是否使用自定义的事件来接收按键,当为true时将不再向系统发送按键请求"), Category("自定义")]
public bool UseCustomEvent public bool UseCustomEvent
{ {
get { return useCustomEvent; } get { return useCustomEvent; }
set { useCustomEvent = value; } set { useCustomEvent = value; }
} }
[Description("数字点击事件"),Category("自定义")] [Description("数字点击事件"),Category("自定义")]
public event EventHandler NumClick; public event EventHandler NumClick;
[Description("删除点击事件"), Category("自定义")] [Description("删除点击事件"), Category("自定义")]
public event EventHandler BackspaceClick; public event EventHandler BackspaceClick;
[Description("回车点击事件"), Category("自定义")] [Description("回车点击事件"), Category("自定义")]
public event EventHandler EnterClick; public event EventHandler EnterClick;
public UCKeyBorderNum() public UCKeyBorderNum()
{ {
InitializeComponent(); InitializeComponent();
} }
private void Num_MouseDown(object sender, MouseEventArgs e) private void Num_MouseDown(object sender, MouseEventArgs e)
{ {
if (NumClick != null) if (NumClick != null)
{ {
NumClick(sender, e); NumClick(sender, e);
} }
if (useCustomEvent) if (useCustomEvent)
return; return;
Label lbl = sender as Label; Label lbl = sender as Label;
SendKeys.Send(lbl.Tag.ToString()); SendKeys.Send(lbl.Tag.ToString());
} }
private void Backspace_MouseDown(object sender, MouseEventArgs e) private void Backspace_MouseDown(object sender, MouseEventArgs e)
{ {
if (BackspaceClick != null) if (BackspaceClick != null)
{ {
BackspaceClick(sender, e); BackspaceClick(sender, e);
} }
if (useCustomEvent) if (useCustomEvent)
return; return;
Label lbl = sender as Label; Label lbl = sender as Label;
SendKeys.Send("{BACKSPACE}"); SendKeys.Send("{BACKSPACE}");
} }
private void Enter_MouseDown(object sender, MouseEventArgs e) private void Enter_MouseDown(object sender, MouseEventArgs e)
{ {
if (EnterClick != null) if (EnterClick != null)
{ {
EnterClick(sender, e); EnterClick(sender, e);
} }
if (useCustomEvent) if (useCustomEvent)
return; return;
SendKeys.Send("{ENTER}"); SendKeys.Send("{ENTER}");
} }
} }
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HZH_Controls.Controls
{
public interface IPageControl
{
/// <summary>
/// 数据源改变时发生
/// </summary>
event PageControlEventHandler ShowChanged;
/// <summary>
/// 数据源
/// </summary>
List<object> DataSource { get; set; }
/// <summary>
/// 显示数量
/// </summary>
int PageSize { get; set; }
/// <summary>
/// 开始下标
/// </summary>
int StartIndex { get; set; }
/// <summary>
/// 第一页
/// </summary>
void FirstPage();
/// <summary>
/// 前一页
/// </summary>
void PreviousPage();
/// <summary>
/// 下一页
/// </summary>
void NextPage();
/// <summary>
/// 最后一页
/// </summary>
void EndPage();
/// <summary>
/// 重新加载
/// </summary>
void Reload();
/// <summary>
/// 获取当前页数据
/// </summary>
/// <returns></returns>
List<object> GetCurrentSource();
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace HZH_Controls.Controls
{
[Serializable]
[ComVisible(true)]
public delegate void PageControlEventHandler(object currentSource);
}
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
partial class UCHorizontalList partial class UCHorizontalList
{ {
/// <summary> /// <summary>
/// 必需的设计器变量。 /// 必需的设计器变量。
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 清理所有正在使用的资源。 /// 清理所有正在使用的资源。
/// </summary> /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region 组件设计器生成的代码 #region 组件设计器生成的代码
/// <summary> /// <summary>
/// 设计器支持所需的方法 - 不要 /// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// 使用代码编辑器修改此方法的内容。
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.panMain = new System.Windows.Forms.Panel(); this.panMain = new System.Windows.Forms.Panel();
this.panList = new System.Windows.Forms.Panel(); this.panList = new System.Windows.Forms.Panel();
this.panRight = new System.Windows.Forms.Panel(); this.panRight = new System.Windows.Forms.Panel();
this.panLeft = new System.Windows.Forms.Panel(); this.panLeft = new System.Windows.Forms.Panel();
this.panMain.SuspendLayout(); this.panMain.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// panMain // panMain
// //
this.panMain.Controls.Add(this.panList); this.panMain.Controls.Add(this.panList);
this.panMain.Dock = System.Windows.Forms.DockStyle.Fill; this.panMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.panMain.Location = new System.Drawing.Point(46, 0); this.panMain.Location = new System.Drawing.Point(46, 0);
this.panMain.Name = "panMain"; this.panMain.Name = "panMain";
this.panMain.Size = new System.Drawing.Size(422, 53); this.panMain.Size = new System.Drawing.Size(422, 53);
this.panMain.TabIndex = 3; this.panMain.TabIndex = 3;
// //
// panList // panList
// //
this.panList.Anchor = System.Windows.Forms.AnchorStyles.Left; this.panList.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.panList.BackColor = System.Drawing.Color.Transparent; this.panList.BackColor = System.Drawing.Color.Transparent;
this.panList.Location = new System.Drawing.Point(0, 0); this.panList.Location = new System.Drawing.Point(0, 0);
this.panList.Name = "panList"; this.panList.Name = "panList";
this.panList.Size = new System.Drawing.Size(401, 53); this.panList.Size = new System.Drawing.Size(401, 53);
this.panList.TabIndex = 0; this.panList.TabIndex = 0;
// //
// panRight // panRight
// //
this.panRight.BackgroundImage = global::HZH_Controls.Properties.Resources.chevron_right; this.panRight.BackgroundImage = global::HZH_Controls.Properties.Resources.chevron_right;
this.panRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.panRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.panRight.Dock = System.Windows.Forms.DockStyle.Right; this.panRight.Dock = System.Windows.Forms.DockStyle.Right;
this.panRight.Location = new System.Drawing.Point(468, 0); this.panRight.Location = new System.Drawing.Point(468, 0);
this.panRight.Name = "panRight"; this.panRight.Name = "panRight";
this.panRight.Size = new System.Drawing.Size(46, 53); this.panRight.Size = new System.Drawing.Size(46, 53);
this.panRight.TabIndex = 2; this.panRight.TabIndex = 2;
this.panRight.Visible = false; this.panRight.Visible = false;
this.panRight.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panRight_MouseDown); this.panRight.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panRight_MouseDown);
// //
// panLeft // panLeft
// //
this.panLeft.BackgroundImage = global::HZH_Controls.Properties.Resources.chevron_left; this.panLeft.BackgroundImage = global::HZH_Controls.Properties.Resources.chevron_left;
this.panLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.panLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.panLeft.Dock = System.Windows.Forms.DockStyle.Left; this.panLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.panLeft.Location = new System.Drawing.Point(0, 0); this.panLeft.Location = new System.Drawing.Point(0, 0);
this.panLeft.Name = "panLeft"; this.panLeft.Name = "panLeft";
this.panLeft.Size = new System.Drawing.Size(46, 53); this.panLeft.Size = new System.Drawing.Size(46, 53);
this.panLeft.TabIndex = 1; this.panLeft.TabIndex = 1;
this.panLeft.Visible = false; this.panLeft.Visible = false;
this.panLeft.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panLeft_MouseDown); this.panLeft.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panLeft_MouseDown);
// //
// UCHorizontalList // UCHorizontalList
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.panMain); this.Controls.Add(this.panMain);
this.Controls.Add(this.panRight); this.Controls.Add(this.panRight);
this.Controls.Add(this.panLeft); this.Controls.Add(this.panLeft);
this.Name = "UCHorizontalList"; this.Name = "UCHorizontalList";
this.Size = new System.Drawing.Size(514, 53); this.Size = new System.Drawing.Size(514, 53);
this.panMain.ResumeLayout(false); this.panMain.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.Panel panLeft; private System.Windows.Forms.Panel panLeft;
private System.Windows.Forms.Panel panRight; private System.Windows.Forms.Panel panRight;
private System.Windows.Forms.Panel panMain; private System.Windows.Forms.Panel panMain;
private System.Windows.Forms.Panel panList; private System.Windows.Forms.Panel panList;
} }
} }
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
partial class UCHorizontalListItem partial class UCHorizontalListItem
{ {
/// <summary> /// <summary>
/// 必需的设计器变量。 /// 必需的设计器变量。
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 清理所有正在使用的资源。 /// 清理所有正在使用的资源。
/// </summary> /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region 组件设计器生成的代码 #region 组件设计器生成的代码
/// <summary> /// <summary>
/// 设计器支持所需的方法 - 不要 /// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// 使用代码编辑器修改此方法的内容。
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.lblTitle = new System.Windows.Forms.Label(); this.lblTitle = new System.Windows.Forms.Label();
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H(); this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
this.SuspendLayout(); this.SuspendLayout();
// //
// lblTitle // lblTitle
// //
this.lblTitle.Dock = System.Windows.Forms.DockStyle.Fill; this.lblTitle.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblTitle.Font = new System.Drawing.Font("微软雅黑", 10F); this.lblTitle.Font = new System.Drawing.Font("微软雅黑", 10F);
this.lblTitle.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.lblTitle.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.lblTitle.Location = new System.Drawing.Point(1, 0); this.lblTitle.Location = new System.Drawing.Point(1, 0);
this.lblTitle.Name = "lblTitle"; this.lblTitle.Name = "lblTitle";
this.lblTitle.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10); this.lblTitle.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10);
this.lblTitle.Size = new System.Drawing.Size(118, 50); this.lblTitle.Size = new System.Drawing.Size(118, 50);
this.lblTitle.TabIndex = 1; this.lblTitle.TabIndex = 1;
this.lblTitle.Text = "分类名称\r\n分类名称"; this.lblTitle.Text = "分类名称\r\n分类名称";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
// //
// ucSplitLine_H1 // ucSplitLine_H1
// //
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59))))); this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom; this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ucSplitLine_H1.Location = new System.Drawing.Point(1, 50); this.ucSplitLine_H1.Location = new System.Drawing.Point(1, 50);
this.ucSplitLine_H1.Name = "ucSplitLine_H1"; this.ucSplitLine_H1.Name = "ucSplitLine_H1";
this.ucSplitLine_H1.Size = new System.Drawing.Size(118, 3); this.ucSplitLine_H1.Size = new System.Drawing.Size(118, 3);
this.ucSplitLine_H1.TabIndex = 0; this.ucSplitLine_H1.TabIndex = 0;
this.ucSplitLine_H1.TabStop = false; this.ucSplitLine_H1.TabStop = false;
// //
// UCHorizontalListItem // UCHorizontalListItem
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.lblTitle); this.Controls.Add(this.lblTitle);
this.Controls.Add(this.ucSplitLine_H1); this.Controls.Add(this.ucSplitLine_H1);
this.Name = "UCHorizontalListItem"; this.Name = "UCHorizontalListItem";
this.Padding = new System.Windows.Forms.Padding(1, 0, 1, 0); this.Padding = new System.Windows.Forms.Padding(1, 0, 1, 0);
this.Size = new System.Drawing.Size(120, 53); this.Size = new System.Drawing.Size(120, 53);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private UCSplitLine_H ucSplitLine_H1; private UCSplitLine_H ucSplitLine_H1;
private System.Windows.Forms.Label lblTitle; private System.Windows.Forms.Label lblTitle;
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
[ToolboxItem(false)] [ToolboxItem(false)]
public partial class UCHorizontalListItem : UserControl public partial class UCHorizontalListItem : UserControl
{ {
public event EventHandler SelectedItem; public event EventHandler SelectedItem;
private KeyValuePair<string, string> _DataSource = new KeyValuePair<string, string>(); private KeyValuePair<string, string> _DataSource = new KeyValuePair<string, string>();
public KeyValuePair<string, string> DataSource public KeyValuePair<string, string> DataSource
{ {
get { return _DataSource; } get { return _DataSource; }
set set
{ {
_DataSource = value; _DataSource = value;
int intWidth = ControlHelper.GetStringWidth(value.Value, lblTitle.CreateGraphics(), lblTitle.Font); int intWidth = ControlHelper.GetStringWidth(value.Value, lblTitle.CreateGraphics(), lblTitle.Font);
if (intWidth < 50) if (intWidth < 50)
intWidth = 50; intWidth = 50;
this.Width = intWidth +20; this.Width = intWidth +20;
lblTitle.Text = value.Value; lblTitle.Text = value.Value;
SetSelect(false); SetSelect(false);
} }
} }
public UCHorizontalListItem() public UCHorizontalListItem()
{ {
InitializeComponent(); InitializeComponent();
this.Dock = DockStyle.Right; this.Dock = DockStyle.Right;
this.MouseDown += Item_MouseDown; this.MouseDown += Item_MouseDown;
this.lblTitle.MouseDown += Item_MouseDown; this.lblTitle.MouseDown += Item_MouseDown;
this.ucSplitLine_H1.MouseDown += Item_MouseDown; this.ucSplitLine_H1.MouseDown += Item_MouseDown;
} }
void Item_MouseDown(object sender, MouseEventArgs e) void Item_MouseDown(object sender, MouseEventArgs e)
{ {
if (SelectedItem != null) if (SelectedItem != null)
SelectedItem(this, e); SelectedItem(this, e);
} }
public void SetSelect(bool bln) public void SetSelect(bool bln)
{ {
if (bln) if (bln)
{ {
lblTitle.ForeColor = Color.FromArgb(255, 77, 59); lblTitle.ForeColor = Color.FromArgb(255, 77, 59);
ucSplitLine_H1.Visible = true; ucSplitLine_H1.Visible = true;
this.lblTitle.Padding = new Padding(0, 0, 0, 5); this.lblTitle.Padding = new Padding(0, 0, 0, 5);
} }
else else
{ {
lblTitle.ForeColor = Color.FromArgb(64,64,64); lblTitle.ForeColor = Color.FromArgb(64,64,64);
ucSplitLine_H1.Visible = false; ucSplitLine_H1.Visible = false;
this.lblTitle.Padding = new Padding(0, 0, 0, 0); this.lblTitle.Padding = new Padding(0, 0, 0, 0);
} }
} }
} }
} }
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
partial class UCListExt partial class UCListExt
{ {
/// <summary> /// <summary>
/// 必需的设计器变量。 /// 必需的设计器变量。
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 清理所有正在使用的资源。 /// 清理所有正在使用的资源。
/// </summary> /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region 组件设计器生成的代码 #region 组件设计器生成的代码
/// <summary> /// <summary>
/// 设计器支持所需的方法 - 不要 /// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// 使用代码编辑器修改此方法的内容。
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.SuspendLayout(); this.SuspendLayout();
// //
// ListExt // ListExt
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoScroll = true; this.AutoScroll = true;
this.Name = "ListExt"; this.Name = "ListExt";
this.Size = new System.Drawing.Size(336, 368); this.Size = new System.Drawing.Size(336, 368);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
[ToolboxItem(false)] [ToolboxItem(false)]
public partial class UCListItemExt : UserControl public partial class UCListItemExt : UserControl
{ {
[Description("标题"), Category("自定义")] [Description("标题"), Category("自定义")]
public string Title public string Title
{ {
get { return label1.Text; } get { return label1.Text; }
set { label1.Text = value; } set { label1.Text = value; }
} }
[Description("副标题"), Category("自定义")] [Description("副标题"), Category("自定义")]
public string Title2 public string Title2
{ {
get { return label3.Text; } get { return label3.Text; }
set set
{ {
label3.Text = value; label3.Text = value;
label3.Visible = !string.IsNullOrEmpty(value); label3.Visible = !string.IsNullOrEmpty(value);
} }
} }
[Description("标题字体"), Category("自定义")] [Description("标题字体"), Category("自定义")]
public Font TitleFont public Font TitleFont
{ {
get { return label1.Font; } get { return label1.Font; }
set set
{ {
label1.Font = value; label1.Font = value;
} }
} }
[Description("副标题字体"), Category("自定义")] [Description("副标题字体"), Category("自定义")]
public Font Title2Font public Font Title2Font
{ {
get { return label3.Font; } get { return label3.Font; }
set set
{ {
label3.Font = value; label3.Font = value;
} }
} }
[Description("背景色"), Category("自定义")] [Description("背景色"), Category("自定义")]
public Color ItemBackColor public Color ItemBackColor
{ {
get { return this.BackColor; } get { return this.BackColor; }
set set
{ {
this.BackColor = value; this.BackColor = value;
} }
} }
[Description("标题文本色"), Category("自定义")] [Description("标题文本色"), Category("自定义")]
public Color ItemForeColor public Color ItemForeColor
{ {
get { return label1.ForeColor; } get { return label1.ForeColor; }
set { label1.ForeColor = value; } set { label1.ForeColor = value; }
} }
[Description("副标题文本色"), Category("自定义")] [Description("副标题文本色"), Category("自定义")]
public Color ItemForeColor2 public Color ItemForeColor2
{ {
get { return label3.ForeColor; } get { return label3.ForeColor; }
set { label3.ForeColor = value; } set { label3.ForeColor = value; }
} }
[Description("是否显示右侧更多箭头"), Category("自定义")] [Description("是否显示右侧更多箭头"), Category("自定义")]
public bool ShowMoreBtn public bool ShowMoreBtn
{ {
get { return label2.Visible; } get { return label2.Visible; }
set { label2.Visible = value; ; } set { label2.Visible = value; ; }
} }
[Description("项选中事件"), Category("自定义")] [Description("项选中事件"), Category("自定义")]
public event EventHandler ItemClick; public event EventHandler ItemClick;
/// <summary> /// <summary>
/// 数据源 /// 数据源
/// </summary> /// </summary>
public ListEntity DataSource { get; private set; } public ListEntity DataSource { get; private set; }
public UCListItemExt() public UCListItemExt()
{ {
InitializeComponent(); InitializeComponent();
SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
this.UpdateStyles(); this.UpdateStyles();
} }
private void item_MouseDown(object sender, MouseEventArgs e) private void item_MouseDown(object sender, MouseEventArgs e)
{ {
if (ItemClick != null) if (ItemClick != null)
{ {
ItemClick(this, e); ItemClick(this, e);
} }
} }
#region 设置数据 #region 设置数据
/// <summary> /// <summary>
/// 功能描述:设置数据 /// 功能描述:设置数据
/// 作  者:HZH /// 作  者:HZH
/// 创建日期:2019-02-27 11:52:52 /// 创建日期:2019-02-27 11:52:52
/// 任务编号:POS /// 任务编号:POS
/// </summary> /// </summary>
/// <param name="data">data</param> /// <param name="data">data</param>
public void SetData(ListEntity data) public void SetData(ListEntity data)
{ {
this.Title = data.Title; this.Title = data.Title;
this.Title2 = data.Title2; this.Title2 = data.Title2;
this.ShowMoreBtn = data.ShowMoreBtn; this.ShowMoreBtn = data.ShowMoreBtn;
DataSource = data; DataSource = data;
} }
#endregion #endregion
} }
} }
namespace HZH_Controls.Controls namespace HZH_Controls.Controls.List
{ {
partial class UCPagerControl partial class UCPagerControl
{ {
/// <summary> /// <summary>
/// 必需的设计器变量。 /// 必需的设计器变量。
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 清理所有正在使用的资源。 /// 清理所有正在使用的资源。
/// </summary> /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region 组件设计器生成的代码 #region 组件设计器生成的代码
/// <summary> /// <summary>
/// 设计器支持所需的方法 - 不要 /// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// 使用代码编辑器修改此方法的内容。
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.panel2 = new System.Windows.Forms.Panel(); this.panel4 = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel();
this.tableLayoutPanel1.SuspendLayout(); this.panel2 = new System.Windows.Forms.Panel();
this.SuspendLayout(); this.panel1 = new System.Windows.Forms.Panel();
// this.tableLayoutPanel1.SuspendLayout();
// tableLayoutPanel1 this.SuspendLayout();
// //
this.tableLayoutPanel1.ColumnCount = 2; // tableLayoutPanel1
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); //
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel1.ColumnCount = 4;
this.tableLayoutPanel1.Controls.Add(this.panel2, 1, 0); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 0); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Controls.Add(this.panel4, 3, 0);
this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(3); this.tableLayoutPanel1.Controls.Add(this.panel3, 0, 0);
this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.Controls.Add(this.panel2, 2, 0);
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel1.Controls.Add(this.panel1, 1, 0);
this.tableLayoutPanel1.Size = new System.Drawing.Size(304, 58); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.TabIndex = 0; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
// this.tableLayoutPanel1.Name = "tableLayoutPanel1";
// panel2 this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(3);
// this.tableLayoutPanel1.RowCount = 1;
this.panel2.BackgroundImage = global::HZH_Controls.Properties.Resources.rigth; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.panel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.tableLayoutPanel1.Size = new System.Drawing.Size(304, 58);
this.panel2.Location = new System.Drawing.Point(155, 6); this.tableLayoutPanel1.TabIndex = 1;
this.panel2.Name = "panel2"; //
this.panel2.Size = new System.Drawing.Size(143, 46); // panel4
this.panel2.TabIndex = 1; //
this.panel2.Visible = false; this.panel4.BackgroundImage = global::HZH_Controls.Properties.Resources.end;
this.panel2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseDown); this.panel4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
// this.panel4.Location = new System.Drawing.Point(228, 6);
// panel1 this.panel4.Name = "panel4";
// this.panel4.Size = new System.Drawing.Size(68, 46);
this.panel1.BackgroundImage = global::HZH_Controls.Properties.Resources.left; this.panel4.TabIndex = 3;
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.panel4.Visible = false;
this.panel1.Location = new System.Drawing.Point(6, 6); this.panel4.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel4_MouseDown);
this.panel1.Name = "panel1"; //
this.panel1.Size = new System.Drawing.Size(143, 46); // panel3
this.panel1.TabIndex = 0; //
this.panel1.Visible = false; this.panel3.BackgroundImage = global::HZH_Controls.Properties.Resources.first;
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); this.panel3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
// this.panel3.Location = new System.Drawing.Point(6, 6);
// UCPagerControl this.panel3.Name = "panel3";
// this.panel3.Size = new System.Drawing.Size(68, 46);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.panel3.TabIndex = 2;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.panel3.Visible = false;
this.Controls.Add(this.tableLayoutPanel1); this.panel3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel3_MouseDown);
this.Name = "UCPagerControl"; //
this.Size = new System.Drawing.Size(304, 58); // panel2
this.tableLayoutPanel1.ResumeLayout(false); //
this.ResumeLayout(false); this.panel2.BackgroundImage = global::HZH_Controls.Properties.Resources.right;
this.panel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
} this.panel2.Location = new System.Drawing.Point(154, 6);
this.panel2.Name = "panel2";
#endregion this.panel2.Size = new System.Drawing.Size(68, 46);
this.panel2.TabIndex = 1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; this.panel2.Visible = false;
private System.Windows.Forms.Panel panel1; this.panel2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseDown);
private System.Windows.Forms.Panel panel2; //
} // panel1
} //
this.panel1.BackgroundImage = global::HZH_Controls.Properties.Resources.left;
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.panel1.Location = new System.Drawing.Point(80, 6);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(68, 46);
this.panel1.TabIndex = 0;
this.panel1.Visible = false;
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown);
//
// UCPagerControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "UCPagerControl";
this.tableLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel1;
}
}
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls.List
{ {
public partial class UCPagerControl : UserControl public partial class UCPagerControl : UCPagerControlBase
{ {
public delegate void PageClickEvent(List<object> currentSource); public UCPagerControl()
/// <summary> {
/// 关联的数据源 InitializeComponent();
/// </summary> }
public List<object> Source { get; set; }
public event PageClickEvent LeftClick; private void panel1_MouseDown(object sender, MouseEventArgs e)
public event PageClickEvent RightClick; {
public event PageClickEvent ShowChanged; PreviousPage();
private int showCount = 1; }
/// <summary>
/// 每页显示数量 private void panel2_MouseDown(object sender, MouseEventArgs e)
/// </summary> {
public int ShowCount NextPage();
{ }
get { return showCount; }
set { showCount = value; } private void panel3_MouseDown(object sender, MouseEventArgs e)
} {
private int startIndex = 0; FirstPage();
/// <summary> }
/// 开始的下标
/// </summary> private void panel4_MouseDown(object sender, MouseEventArgs e)
public int StartIndex {
{ EndPage();
get { return startIndex; } }
set
{ protected override void ShowBtn(bool blnLeftBtn, bool blnRightBtn)
startIndex = value; {
if (startIndex <= 0) panel1.Visible = panel3.Visible = blnLeftBtn;
startIndex = 0; panel2.Visible = panel4.Visible = blnRightBtn;
} }
} }
}
public UCPagerControl()
{
InitializeComponent();
}
public void NextPage()
{
if (startIndex + showCount >= Source.Count)
{
return;
}
startIndex += showCount;
if (startIndex < 0)
startIndex = 0;
var s = GetCurrentSoutce();
if (RightClick != null)
{
RightClick(s);
}
if (ShowChanged != null)
{
ShowChanged(s);
}
}
public void LastPage()
{
if (startIndex == 0)
return;
startIndex -= showCount;
if (startIndex < 0)
startIndex = 0;
var s = GetCurrentSoutce();
if (LeftClick != null)
{
LeftClick(s);
}
if (ShowChanged != null)
{
ShowChanged(s);
}
}
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
LastPage();
}
private void panel2_MouseDown(object sender, MouseEventArgs e)
{
NextPage();
}
public void Reload()
{
var s = GetCurrentSoutce();
if (ShowChanged != null)
{
ShowChanged(s);
}
}
public List<object> GetCurrentSoutce()
{
int intShowCount = showCount;
if (intShowCount + startIndex > Source.Count)
intShowCount = Source.Count - startIndex;
object[] objs = new object[intShowCount];
Source.CopyTo(startIndex, objs, 0, intShowCount);
var lst = objs.ToList();
if (lst.Count > 0)
{
if (Source.IndexOf(lst[0]) > 0)
{
panel1.Visible = true;
}
else
{
panel1.Visible = false;
}
if (Source.IndexOf(lst[lst.Count - 1]) >= Source.Count - 1)
{
panel2.Visible = false;
}
else
{
panel2.Visible = true;
}
}
else
{
panel1.Visible = false;
panel2.Visible = false;
}
return lst;
}
}
}
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
{
public class UCPagerControlBase : UserControl, IPageControl
{
#region 构造
/// <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();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Name = "UCPagerControlBase";
this.Size = new System.Drawing.Size(304, 58);
this.ResumeLayout(false);
}
#endregion
#endregion
/// <summary>
/// 关联的数据源
/// </summary>
public List<object> DataSource { get; set; }
public event PageControlEventHandler ShowChanged;
private int m_pageSize = 1;
/// <summary>
/// 每页显示数量
/// </summary>
public int PageSize
{
get { return m_pageSize; }
set { m_pageSize = value; }
}
private int startIndex = 0;
/// <summary>
/// 开始的下标
/// </summary>
public int StartIndex
{
get { return startIndex; }
set
{
startIndex = value;
if (startIndex <= 0)
startIndex = 0;
}
}
public UCPagerControlBase()
{
InitializeComponent();
}
public void FirstPage()
{
startIndex = 0;
var s = GetCurrentSource();
if (ShowChanged != null)
{
ShowChanged(s);
}
}
public void PreviousPage()
{
if (startIndex == 0)
return;
startIndex -= m_pageSize;
if (startIndex < 0)
startIndex = 0;
var s = GetCurrentSource();
if (ShowChanged != null)
{
ShowChanged(s);
}
}
public void NextPage()
{
if (startIndex + m_pageSize >= DataSource.Count)
{
return;
}
startIndex += m_pageSize;
if (startIndex < 0)
startIndex = 0;
var s = GetCurrentSource();
if (ShowChanged != null)
{
ShowChanged(s);
}
}
public void EndPage()
{
startIndex = DataSource.Count - 1 - m_pageSize;
if (startIndex < 0)
startIndex = 0;
var s = GetCurrentSource();
if (ShowChanged != null)
{
ShowChanged(s);
}
}
public void Reload()
{
var s = GetCurrentSource();
if (ShowChanged != null)
{
ShowChanged(s);
}
}
public List<object> GetCurrentSource()
{
int intShowCount = m_pageSize;
if (intShowCount + startIndex > DataSource.Count)
intShowCount = DataSource.Count - startIndex;
object[] objs = new object[intShowCount];
DataSource.CopyTo(startIndex, objs, 0, intShowCount);
var lst = objs.ToList();
bool blnLeft = false;
bool blnRight = false;
if (lst.Count > 0)
{
if (DataSource.IndexOf(lst[0]) > 0)
{
blnLeft = true;
}
else
{
blnLeft = false;
}
if (DataSource.IndexOf(lst[lst.Count - 1]) >= DataSource.Count - 1)
{
blnRight = false;
}
else
{
blnRight = true;
}
}
ShowBtn(blnLeft, blnRight);
return lst;
}
/// <summary>
/// 控制按钮显示
/// </summary>
/// <param name="blnLeftBtn"></param>
/// <param name="blnRightBtn"></param>
protected virtual void ShowBtn(bool blnLeftBtn, bool blnRightBtn)
{ }
}
}
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
partial class ProcessExt partial class ProcessExt
{ {
/// <summary> /// <summary>
/// 必需的设计器变量。 /// 必需的设计器变量。
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 清理所有正在使用的资源。 /// 清理所有正在使用的资源。
/// </summary> /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region 组件设计器生成的代码 #region 组件设计器生成的代码
/// <summary> /// <summary>
/// 设计器支持所需的方法 - 不要 /// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// 使用代码编辑器修改此方法的内容。
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.SuspendLayout(); this.SuspendLayout();
// //
// panel1 // panel1
// //
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(23)))), ((int)(((byte)(127)))), ((int)(((byte)(203))))); this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(23)))), ((int)(((byte)(127)))), ((int)(((byte)(203)))));
this.panel1.Dock = System.Windows.Forms.DockStyle.Left; this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(0, 22); this.panel1.Size = new System.Drawing.Size(0, 22);
this.panel1.TabIndex = 0; this.panel1.TabIndex = 0;
// //
// ProcessExt // ProcessExt
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White; this.BackColor = System.Drawing.Color.White;
this.ConerRadius = 5; this.ConerRadius = 5;
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.IsRadius = true; this.IsRadius = true;
this.Name = "ProcessExt"; this.Name = "ProcessExt";
this.Size = new System.Drawing.Size(291, 22); this.Size = new System.Drawing.Size(291, 22);
this.SizeChanged += new System.EventHandler(this.ProcessExt_SizeChanged); this.SizeChanged += new System.EventHandler(this.ProcessExt_SizeChanged);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
public partial class ProcessExt : UCControlBase public partial class ProcessExt : UCControlBase
{ {
private int _value = 0; private int _value = 0;
public int Value public int Value
{ {
get { return this._value; } get { return this._value; }
set set
{ {
if (value < 0) if (value < 0)
return; return;
this._value = value; this._value = value;
SetValue(); SetValue();
} }
} }
private int maxValue = 100; private int maxValue = 100;
public int MaxValue public int MaxValue
{ {
get { return maxValue; } get { return maxValue; }
set set
{ {
if (value <= 0) if (value <= 0)
return; return;
maxValue = value; maxValue = value;
SetValue(); SetValue();
} }
} }
private void SetValue() private void SetValue()
{ {
double dbl = (double)_value / (double)maxValue; double dbl = (double)_value / (double)maxValue;
this.panel1.Width = (int)(this.Width * dbl); this.panel1.Width = (int)(this.Width * dbl);
} }
public ProcessExt() public ProcessExt()
{ {
InitializeComponent(); InitializeComponent();
} }
private void ProcessExt_SizeChanged(object sender, EventArgs e) private void ProcessExt_SizeChanged(object sender, EventArgs e)
{ {
SetValue(); SetValue();
} }
public void Step() public void Step()
{ {
Value++; Value++;
} }
} }
} }
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
partial class UCRadioButton partial class UCRadioButton
{ {
/// <summary> /// <summary>
/// 必需的设计器变量。 /// 必需的设计器变量。
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 清理所有正在使用的资源。 /// 清理所有正在使用的资源。
/// </summary> /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region 组件设计器生成的代码 #region 组件设计器生成的代码
/// <summary> /// <summary>
/// 设计器支持所需的方法 - 不要 /// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// 使用代码编辑器修改此方法的内容。
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.SuspendLayout(); this.SuspendLayout();
// //
// label1 // label1
// //
this.label1.Dock = System.Windows.Forms.DockStyle.Fill; this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Font = new System.Drawing.Font("微软雅黑", 12F); this.label1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(62)))), ((int)(((byte)(62))))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(62)))), ((int)(((byte)(62)))), ((int)(((byte)(62)))));
this.label1.Location = new System.Drawing.Point(18, 0); this.label1.Location = new System.Drawing.Point(18, 0);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0); this.label1.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0);
this.label1.Size = new System.Drawing.Size(215, 30); this.label1.Size = new System.Drawing.Size(215, 30);
this.label1.TabIndex = 3; this.label1.TabIndex = 3;
this.label1.Text = "单选按钮"; this.label1.Text = "单选按钮";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.label1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Radio_MouseDown); this.label1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Radio_MouseDown);
// //
// panel1 // panel1
// //
this.panel1.BackgroundImage = global::HZH_Controls.Properties.Resources.radioButton0; this.panel1.BackgroundImage = global::HZH_Controls.Properties.Resources.radioButton0;
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.panel1.Dock = System.Windows.Forms.DockStyle.Left; this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(18, 30); this.panel1.Size = new System.Drawing.Size(18, 30);
this.panel1.TabIndex = 2; this.panel1.TabIndex = 2;
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Radio_MouseDown); this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Radio_MouseDown);
// //
// UCRadioButton // UCRadioButton
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.Name = "UCRadioButton"; this.Name = "UCRadioButton";
this.Size = new System.Drawing.Size(233, 30); this.Size = new System.Drawing.Size(233, 30);
this.Load += new System.EventHandler(this.UCRadioButton_Load); this.Load += new System.EventHandler(this.UCRadioButton_Load);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Radio_MouseDown); this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Radio_MouseDown);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
} }
} }
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
partial class UCSplitLine_H partial class UCSplitLine_H
{ {
/// <summary> /// <summary>
/// 必需的设计器变量。 /// 必需的设计器变量。
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 清理所有正在使用的资源。 /// 清理所有正在使用的资源。
/// </summary> /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region 组件设计器生成的代码 #region 组件设计器生成的代码
/// <summary> /// <summary>
/// 设计器支持所需的方法 - 不要 /// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// 使用代码编辑器修改此方法的内容。
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.SuspendLayout(); this.SuspendLayout();
// //
// UCSplitLine_H // UCSplitLine_H
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
this.Name = "UCSplitLine_H"; this.Name = "UCSplitLine_H";
this.Size = new System.Drawing.Size(100, 1); this.Size = new System.Drawing.Size(100, 1);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
public partial class UCSplitLine_H : UserControl public partial class UCSplitLine_H : UserControl
{ {
public UCSplitLine_H() public UCSplitLine_H()
{ {
InitializeComponent(); InitializeComponent();
this.TabStop = false; this.TabStop = false;
} }
} }
} }
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
partial class UCSplitLine_V partial class UCSplitLine_V
{ {
/// <summary> /// <summary>
/// 必需的设计器变量。 /// 必需的设计器变量。
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 清理所有正在使用的资源。 /// 清理所有正在使用的资源。
/// </summary> /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region 组件设计器生成的代码 #region 组件设计器生成的代码
/// <summary> /// <summary>
/// 设计器支持所需的方法 - 不要 /// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// 使用代码编辑器修改此方法的内容。
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.SuspendLayout(); this.SuspendLayout();
// //
// UCSplitLine_V // UCSplitLine_V
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
this.Name = "UCSplitLine_V"; this.Name = "UCSplitLine_V";
this.Size = new System.Drawing.Size(1, 100); this.Size = new System.Drawing.Size(1, 100);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
public partial class UCSplitLine_V : UserControl public partial class UCSplitLine_V : UserControl
{ {
public UCSplitLine_V() public UCSplitLine_V()
{ {
InitializeComponent(); InitializeComponent();
this.TabStop = false; this.TabStop = false;
} }
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
public enum KeyBoardType public enum KeyBoardType
{ {
Null = 1, Null = 1,
UCKeyBorderAll_EN = 2, UCKeyBorderAll_EN = 2,
UCKeyBorderAll_Num = 4, UCKeyBorderAll_Num = 4,
UCKeyBorderNum = 8, UCKeyBorderNum = 8,
UCKeyBorderHand = 16 UCKeyBorderHand = 16
} }
} }
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
partial class TextBoxEx partial class TextBoxEx
{ {
/// <summary> /// <summary>
/// 必需的设计器变量。 /// 必需的设计器变量。
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 清理所有正在使用的资源。 /// 清理所有正在使用的资源。
/// </summary> /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region 组件设计器生成的代码 #region 组件设计器生成的代码
/// <summary> /// <summary>
/// 设计器支持所需的方法 - 不要 /// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// 使用代码编辑器修改此方法的内容。
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
components = new System.ComponentModel.Container(); components = new System.ComponentModel.Container();
} }
#endregion #endregion
} }
} }
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
public class win32 public class win32
{ {
public const int WM_MOUSEMOVE = 0x0200; public const int WM_MOUSEMOVE = 0x0200;
public const int WM_LBUTTONDOWN = 0x0201; public const int WM_LBUTTONDOWN = 0x0201;
public const int WM_LBUTTONUP = 0x0202; public const int WM_LBUTTONUP = 0x0202;
public const int WM_RBUTTONDOWN = 0x0204; public const int WM_RBUTTONDOWN = 0x0204;
public const int WM_LBUTTONDBLCLK = 0x0203; public const int WM_LBUTTONDBLCLK = 0x0203;
public const int WM_MOUSELEAVE = 0x02A3; public const int WM_MOUSELEAVE = 0x02A3;
public const int WM_PAINT = 0x000F; public const int WM_PAINT = 0x000F;
public const int WM_ERASEBKGND = 0x0014; public const int WM_ERASEBKGND = 0x0014;
public const int WM_PRINT = 0x0317; public const int WM_PRINT = 0x0317;
//const int EN_HSCROLL = 0x0601; //const int EN_HSCROLL = 0x0601;
//const int EN_VSCROLL = 0x0602; //const int EN_VSCROLL = 0x0602;
public const int WM_HSCROLL = 0x0114; public const int WM_HSCROLL = 0x0114;
public const int WM_VSCROLL = 0x0115; public const int WM_VSCROLL = 0x0115;
public const int EM_GETSEL = 0x00B0; public const int EM_GETSEL = 0x00B0;
public const int EM_LINEINDEX = 0x00BB; public const int EM_LINEINDEX = 0x00BB;
public const int EM_LINEFROMCHAR = 0x00C9; public const int EM_LINEFROMCHAR = 0x00C9;
public const int EM_POSFROMCHAR = 0x00D6; public const int EM_POSFROMCHAR = 0x00D6;
[DllImport("USER32.DLL", EntryPoint = "PostMessage")] [DllImport("USER32.DLL", EntryPoint = "PostMessage")]
public static extern bool PostMessage(IntPtr hwnd, uint msg, public static extern bool PostMessage(IntPtr hwnd, uint msg,
IntPtr wParam, IntPtr lParam); IntPtr wParam, IntPtr lParam);
/* /*
BOOL PostMessage( HWND hWnd, BOOL PostMessage( HWND hWnd,
UINT Msg, UINT Msg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam LPARAM lParam
); );
*/ */
// Put this declaration in your class //IntPtr // Put this declaration in your class //IntPtr
[DllImport("USER32.DLL", EntryPoint = "SendMessage")] [DllImport("USER32.DLL", EntryPoint = "SendMessage")]
public static extern int SendMessage(IntPtr hwnd, int msg, IntPtr wParam, public static extern int SendMessage(IntPtr hwnd, int msg, IntPtr wParam,
IntPtr lParam); IntPtr lParam);
[DllImport("USER32.DLL", EntryPoint = "GetCaretBlinkTime")] [DllImport("USER32.DLL", EntryPoint = "GetCaretBlinkTime")]
public static extern uint GetCaretBlinkTime(); public static extern uint GetCaretBlinkTime();
const int WM_PRINTCLIENT = 0x0318; const int WM_PRINTCLIENT = 0x0318;
const long PRF_CHECKVISIBLE = 0x00000001L; const long PRF_CHECKVISIBLE = 0x00000001L;
const long PRF_NONCLIENT = 0x00000002L; const long PRF_NONCLIENT = 0x00000002L;
const long PRF_CLIENT = 0x00000004L; const long PRF_CLIENT = 0x00000004L;
const long PRF_ERASEBKGND = 0x00000008L; const long PRF_ERASEBKGND = 0x00000008L;
const long PRF_CHILDREN = 0x00000010L; const long PRF_CHILDREN = 0x00000010L;
const long PRF_OWNED = 0x00000020L; const long PRF_OWNED = 0x00000020L;
/* Will clean this up later doing something like this /* Will clean this up later doing something like this
enum CaptureOptions : long enum CaptureOptions : long
{ {
PRF_CHECKVISIBLE= 0x00000001L, PRF_CHECKVISIBLE= 0x00000001L,
PRF_NONCLIENT = 0x00000002L, PRF_NONCLIENT = 0x00000002L,
PRF_CLIENT = 0x00000004L, PRF_CLIENT = 0x00000004L,
PRF_ERASEBKGND = 0x00000008L, PRF_ERASEBKGND = 0x00000008L,
PRF_CHILDREN = 0x00000010L, PRF_CHILDREN = 0x00000010L,
PRF_OWNED = 0x00000020L PRF_OWNED = 0x00000020L
} }
*/ */
public static bool CaptureWindow(System.Windows.Forms.Control control, public static bool CaptureWindow(System.Windows.Forms.Control control,
ref System.Drawing.Bitmap bitmap) ref System.Drawing.Bitmap bitmap)
{ {
//This function captures the contents of a window or control //This function captures the contents of a window or control
Graphics g2 = Graphics.FromImage(bitmap); Graphics g2 = Graphics.FromImage(bitmap);
//PRF_CHILDREN // PRF_NONCLIENT //PRF_CHILDREN // PRF_NONCLIENT
int meint = (int)(PRF_CLIENT | PRF_ERASEBKGND); //| PRF_OWNED ); // ); int meint = (int)(PRF_CLIENT | PRF_ERASEBKGND); //| PRF_OWNED ); // );
System.IntPtr meptr = new System.IntPtr(meint); System.IntPtr meptr = new System.IntPtr(meint);
System.IntPtr hdc = g2.GetHdc(); System.IntPtr hdc = g2.GetHdc();
win32.SendMessage(control.Handle, win32.WM_PRINT, hdc, meptr); win32.SendMessage(control.Handle, win32.WM_PRINT, hdc, meptr);
g2.ReleaseHdc(hdc); g2.ReleaseHdc(hdc);
g2.Dispose(); g2.Dispose();
return true; return true;
} }
} }
} }
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace HZH_Controls.Controls namespace HZH_Controls.Controls
{ {
partial class UCControlBase partial class UCControlBase
{ {
/// <summary> /// <summary>
/// 必需的设计器变量。 /// 必需的设计器变量。
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// 清理所有正在使用的资源。 /// 清理所有正在使用的资源。
/// </summary> /// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region 组件设计器生成的代码 #region 组件设计器生成的代码
/// <summary> /// <summary>
/// 设计器支持所需的方法 - 不要 /// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。 /// 使用代码编辑器修改此方法的内容。
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
components = new System.ComponentModel.Container(); components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
base.SuspendLayout(); base.SuspendLayout();
base.AutoScaleDimensions = new SizeF(9f, 20f); base.AutoScaleDimensions = new SizeF(9f, 20f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.DoubleBuffered = true; this.DoubleBuffered = true;
this.Font = new Font("微软雅黑", 15f, FontStyle.Regular, GraphicsUnit.Pixel); this.Font = new Font("微软雅黑", 15f, FontStyle.Regular, GraphicsUnit.Pixel);
base.Margin = new Padding(4, 5, 4, 5); base.Margin = new Padding(4, 5, 4, 5);
base.Name = "UCBase"; base.Name = "UCBase";
base.Size = new Size(237, 154); base.Size = new Size(237, 154);
base.ResumeLayout(false); base.ResumeLayout(false);
} }
#endregion #endregion
} }
} }
namespace HZH_Controls.Forms namespace HZH_Controls.Forms
{ {
partial class FrmAnchor partial class FrmAnchor
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// Clean up any resources being used. /// Clean up any resources being used.
/// </summary> /// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region Windows Form Designer generated code #region Windows Form Designer generated code
/// <summary> /// <summary>
/// Required method for Designer support - do not modify /// Required method for Designer support - do not modify
/// the contents of this method with the code editor. /// the contents of this method with the code editor.
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmAnchor)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmAnchor));
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout(); this.SuspendLayout();
// //
// timer1 // timer1
// //
this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
// //
// FrmAnchor // FrmAnchor
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(45, 48); this.ClientSize = new System.Drawing.Size(45, 48);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmAnchor"; this.Name = "FrmAnchor";
this.ShowIcon = false; this.ShowIcon = false;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "FrmAnchor"; this.Text = "FrmAnchor";
this.TopMost = true; this.TopMost = true;
this.Load += new System.EventHandler(this.FrmAnchor_Load); this.Load += new System.EventHandler(this.FrmAnchor_Load);
this.VisibleChanged += new System.EventHandler(this.FrmAnchor_VisibleChanged); this.VisibleChanged += new System.EventHandler(this.FrmAnchor_VisibleChanged);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer1;
} }
} }
\ No newline at end of file \ No newline at end of file

1.1 KB | 宽: | 高:

582 字节 | 宽: | 高:

HZH_Controls/HZH_Controls/Resources/left.png
HZH_Controls/HZH_Controls/Resources/left.png
HZH_Controls/HZH_Controls/Resources/left.png
HZH_Controls/HZH_Controls/Resources/left.png
  • 两方对比
  • 交换覆盖
  • 透明覆盖
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!