first commit

This commit is contained in:
2024-06-24 16:42:15 +08:00
commit b092361d23
1060 changed files with 214684 additions and 0 deletions

View File

@ -0,0 +1,85 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmAnchor.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmAnchor.
/// Implements the <see cref="System.Windows.Forms.Form" />
/// </summary>
/// <seealso cref="System.Windows.Forms.Form" />
partial class FrmAnchor
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmAnchor));
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// FrmAnchor
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(45, 48);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmAnchor";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "FrmAnchor";
this.TopMost = true;
this.Load += new System.EventHandler(this.FrmAnchor_Load);
this.VisibleChanged += new System.EventHandler(this.FrmAnchor_VisibleChanged);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The timer1
/// </summary>
private System.Windows.Forms.Timer timer1;
}
}

View File

@ -0,0 +1,301 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmAnchor.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Forms
{
/// <summary>
/// 功能描述:停靠窗体
/// 作  者:HZH
/// 创建日期:2019-02-27 11:49:03
/// 任务编号:POS
/// </summary>
/// <seealso cref="System.Windows.Forms.Form" />
/// <seealso cref="System.Windows.Forms.IMessageFilter" />
public partial class FrmAnchor : Form, IMessageFilter
{
/// <summary>
/// The m parent control
/// </summary>
Control m_parentControl = null;
/// <summary>
/// The BLN down
/// </summary>
private bool blnDown = true;
/// <summary>
/// The m size
/// </summary>
Size m_size;
/// <summary>
/// The m deviation
/// </summary>
Point? m_deviation;
/// <summary>
/// The m is not focus
/// </summary>
bool m_isNotFocus = true;
#region
/// <summary>
/// 功能描述:构造函数
/// 作  者:HZH
/// 创建日期:2019-02-27 11:49:08
/// 任务编号:POS
/// </summary>
/// <param name="parentControl">父控件</param>
/// <param name="childControl">子控件</param>
/// <param name="deviation">偏移</param>
/// <param name="isNotFocus">是否无焦点窗体</param>
public FrmAnchor(Control parentControl, Control childControl, Point? deviation = null,bool isNotFocus=true)
{
m_isNotFocus = isNotFocus;
m_parentControl = parentControl;
InitializeComponent();
this.Size = childControl.Size;
this.HandleCreated += FrmDownBoard_HandleCreated;
this.HandleDestroyed += FrmDownBoard_HandleDestroyed;
this.Controls.Add(childControl);
childControl.Dock = DockStyle.Fill;
m_size = childControl.Size;
m_deviation = deviation;
if (parentControl.FindForm() != null)
{
Form frmP = parentControl.FindForm();
if (!frmP.IsDisposed)
{
frmP.LocationChanged += frmP_LocationChanged;
}
}
parentControl.LocationChanged += frmP_LocationChanged;
}
/// <summary>
/// Initializes a new instance of the <see cref="FrmAnchor" /> class.
/// </summary>
/// <param name="parentControl">The parent control.</param>
/// <param name="size">The size.</param>
/// <param name="deviation">The deviation.</param>
/// <param name="isNotFocus">if set to <c>true</c> [is not focus].</param>
public FrmAnchor(Control parentControl, Size size, Point? deviation = null, bool isNotFocus = true)
{
m_isNotFocus = isNotFocus;
m_parentControl = parentControl;
InitializeComponent();
this.Size = size;
this.HandleCreated += FrmDownBoard_HandleCreated;
this.HandleDestroyed += FrmDownBoard_HandleDestroyed;
m_size = size;
m_deviation = deviation;
}
/// <summary>
/// Handles the LocationChanged event of the frmP control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
void frmP_LocationChanged(object sender, EventArgs e)
{
this.Hide();
}
#endregion
/// <summary>
/// Handles the HandleDestroyed event of the FrmDownBoard control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void FrmDownBoard_HandleDestroyed(object sender, EventArgs e)
{
Application.RemoveMessageFilter(this);
}
/// <summary>
/// Handles the HandleCreated event of the FrmDownBoard control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void FrmDownBoard_HandleCreated(object sender, EventArgs e)
{
Application.AddMessageFilter(this);
}
#region
/// <summary>
/// Sets the active window.
/// </summary>
/// <param name="handle">The handle.</param>
/// <returns>IntPtr.</returns>
[System.Runtime.InteropServices.DllImport("user32.dll")]
private extern static IntPtr SetActiveWindow(IntPtr handle);
/// <summary>
/// The wm activate
/// </summary>
private const int WM_ACTIVATE = 0x006;
/// <summary>
/// The wm activateapp
/// </summary>
private const int WM_ACTIVATEAPP = 0x01C;
/// <summary>
/// The wm ncactivate
/// </summary>
private const int WM_NCACTIVATE = 0x086;
/// <summary>
/// The wa inactive
/// </summary>
private const int WA_INACTIVE = 0;
/// <summary>
/// The wm mouseactivate
/// </summary>
private const int WM_MOUSEACTIVATE = 0x21;
/// <summary>
/// The ma noactivate
/// </summary>
private const int MA_NOACTIVATE = 3;
/// <summary>
/// WNDs the proc.
/// </summary>
/// <param name="m">要处理的 Windows <see cref="T:System.Windows.Forms.Message" />。</param>
protected override void WndProc(ref Message m)
{
if (m_isNotFocus)
{
if (m.Msg == WM_MOUSEACTIVATE)
{
m.Result = new IntPtr(MA_NOACTIVATE);
return;
}
else if (m.Msg == WM_NCACTIVATE)
{
if (((int)m.WParam & 0xFFFF) != WA_INACTIVE)
{
if (m.LParam != IntPtr.Zero)
{
SetActiveWindow(m.LParam);
}
else
{
SetActiveWindow(IntPtr.Zero);
}
}
}
}
base.WndProc(ref m);
}
#endregion
/// <summary>
/// 在调度消息之前将其筛选出来。
/// </summary>
/// <param name="m">要调度的消息。无法修改此消息。</param>
/// <returns>如果筛选消息并禁止消息被调度,则为 true如果允许消息继续到达下一个筛选器或控件则为 false。</returns>
public bool PreFilterMessage(ref Message m)
{
if (m.Msg != 0x0201 || this.Visible == false)
return false;
var pt = this.PointToClient(MousePosition);
this.Visible = this.ClientRectangle.Contains(pt);
return false;
}
/// <summary>
/// Handles the Load event of the FrmAnchor control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void FrmAnchor_Load(object sender, EventArgs e)
{
}
/// <summary>
/// Handles the VisibleChanged event of the FrmAnchor control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void FrmAnchor_VisibleChanged(object sender, EventArgs e)
{
timer1.Enabled = this.Visible;
if (this.Visible)
{
Screen currentScreen = Screen.FromControl(m_parentControl);
Point p = m_parentControl.Parent.PointToScreen(m_parentControl.Location);
int intX = 0;
int intY = 0;
if (p.Y + m_parentControl.Height + m_size.Height > currentScreen.Bounds.Height)
{
intY = p.Y - m_size.Height - 1;
blnDown = false;
}
else
{
intY = p.Y + m_parentControl.Height + 1;
blnDown = true;
}
if (p.X + m_size.Width > currentScreen.Bounds.Width)
{
intX = currentScreen.Bounds.Width - m_size.Width;
}
else
{
intX = p.X;
}
if (m_deviation.HasValue)
{
intX += m_deviation.Value.X;
intY += m_deviation.Value.Y;
}
this.Location =new Point(intX, intY);
}
}
/// <summary>
/// Handles the Tick event of the timer1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void timer1_Tick(object sender, EventArgs e)
{
if (this.Owner != null)
{
Form frm = this.Owner as Form;
IntPtr _ptr = ControlHelper.GetForegroundWindow();
if (_ptr != frm.Handle && _ptr!=this.Handle)
{
this.Hide();
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,72 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-29-2019
//
// ***********************************************************************
// <copyright file="FrmAnchorTips.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmAnchorTips.
/// Implements the <see cref="System.Windows.Forms.Form" />
/// </summary>
/// <seealso cref="System.Windows.Forms.Form" />
partial class FrmAnchorTips
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmAnchorTips));
this.SuspendLayout();
//
// FrmAnchorTips
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(226, 83);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmAnchorTips";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "FrmAnchorTips";
this.ResumeLayout(false);
}
#endregion
}
}

View File

@ -0,0 +1,725 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-29-2019
//
// ***********************************************************************
// <copyright file="FrmAnchorTips.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using Timer = System.Windows.Forms.Timer;
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmAnchorTips.
/// Implements the <see cref="System.Windows.Forms.Form" />
/// </summary>
/// <seealso cref="System.Windows.Forms.Form" />
public partial class FrmAnchorTips : Form
{
/// <summary>
/// The m string MSG
/// </summary>
private string m_strMsg = string.Empty;
/// <summary>
/// Gets or sets the string MSG.
/// </summary>
/// <value>The string MSG.</value>
public string StrMsg
{
get { return m_strMsg; }
set
{
m_strMsg = value;
if (string.IsNullOrEmpty(value))
return;
ResetForm(value);
}
}
/// <summary>
/// The have handle
/// </summary>
bool haveHandle = false;
/// <summary>
/// The m rect control
/// </summary>
Rectangle m_rectControl;
/// <summary>
/// Gets or sets the rect control.
/// </summary>
/// <value>The rect control.</value>
public Rectangle RectControl
{
get { return m_rectControl; }
set
{
m_rectControl = value;
}
}
/// <summary>
/// The m location
/// </summary>
AnchorTipsLocation m_location;
/// <summary>
/// The m background
/// </summary>
Color? m_background = null;
/// <summary>
/// The m fore color
/// </summary>
Color? m_foreColor = null;
/// <summary>
/// The m font size
/// </summary>
int m_fontSize = 10;
#region English:Constructor
/// <summary>
/// Initializes a new instance of the <see cref="FrmAnchorTips"/> class.
/// </summary>
/// <param name="rectControl">The rect control.</param>
/// <param name="strMsg">The string MSG.</param>
/// <param name="location">The location.</param>
/// <param name="background">The background.</param>
/// <param name="foreColor">Color of the fore.</param>
/// <param name="fontSize">Size of the font.</param>
/// <param name="autoCloseTime">The automatic close time.</param>
private FrmAnchorTips(
Rectangle rectControl,
string strMsg,
AnchorTipsLocation location = AnchorTipsLocation.RIGHT,
Color? background = null,
Color? foreColor = null,
int fontSize = 10,
int autoCloseTime = 5000)
{
InitializeComponent();
m_rectControl = rectControl;
m_location = location;
m_background = background;
m_foreColor = foreColor;
m_fontSize = fontSize;
StrMsg = strMsg;
if (autoCloseTime > 0)
{
Timer t = new Timer();
t.Interval = autoCloseTime;
t.Tick += (a, b) =>
{
this.Close();
};
t.Enabled = true;
}
}
/// <summary>
/// Resets the form.
/// </summary>
/// <param name="strMsg">The string MSG.</param>
private void ResetForm(string strMsg)
{
Graphics g = this.CreateGraphics();
Font _font = new Font("微软雅黑", m_fontSize);
Color _background = m_background == null ? Color.FromArgb(255, 77, 58) : m_background.Value;
Color _foreColor = m_foreColor == null ? Color.White : m_foreColor.Value;
System.Drawing.SizeF sizeText = g.MeasureString(strMsg, _font);
g.Dispose();
var formSize = new Size((int)sizeText.Width + 10, (int)sizeText.Height + 10);
if (formSize.Width < 10)
formSize.Width = 10;
if (formSize.Height < 10)
formSize.Height = 10;
if (m_location == AnchorTipsLocation.LEFT || m_location == AnchorTipsLocation.RIGHT)
{
formSize.Width += 20;
}
else
{
formSize.Height += 20;
}
#region path English:Get the form path
GraphicsPath path = new GraphicsPath();
Rectangle rect;
switch (m_location)
{
case AnchorTipsLocation.TOP:
rect = new Rectangle(1, 1, formSize.Width - 2, formSize.Height - 20 - 1);
this.Location = new Point(m_rectControl.X + (m_rectControl.Width - rect.Width) / 2, m_rectControl.Y - rect.Height - 20);
break;
case AnchorTipsLocation.RIGHT:
rect = new Rectangle(20, 1, formSize.Width - 20 - 1, formSize.Height - 2);
this.Location = new Point(m_rectControl.Right, m_rectControl.Y + (m_rectControl.Height - rect.Height) / 2);
break;
case AnchorTipsLocation.BOTTOM:
rect = new Rectangle(1, 20, formSize.Width - 2, formSize.Height - 20 - 1);
this.Location = new Point(m_rectControl.X + (m_rectControl.Width - rect.Width) / 2, m_rectControl.Bottom);
break;
default:
rect = new Rectangle(1, 1, formSize.Width - 20 - 1, formSize.Height - 2);
this.Location = new Point(m_rectControl.X - rect.Width - 20, m_rectControl.Y + (m_rectControl.Height - rect.Height) / 2);
break;
}
int cornerRadius = 2;
path.AddArc(rect.X, rect.Y, cornerRadius * 2, cornerRadius * 2, 180, 90);//左上角
#region
if (m_location == AnchorTipsLocation.BOTTOM)
{
path.AddLine(rect.X + cornerRadius, rect.Y, rect.Left + rect.Width / 2 - 10, rect.Y);//上
path.AddLine(rect.Left + rect.Width / 2 - 10, rect.Y, rect.Left + rect.Width / 2, rect.Y - 19);//上
path.AddLine(rect.Left + rect.Width / 2, rect.Y - 19, rect.Left + rect.Width / 2 + 10, rect.Y);//上
path.AddLine(rect.Left + rect.Width / 2 + 10, rect.Y, rect.Right - cornerRadius * 2, rect.Y);//上
}
else
{
path.AddLine(rect.X + cornerRadius, rect.Y, rect.Right - cornerRadius * 2, rect.Y);//上
}
#endregion
path.AddArc(rect.X + rect.Width - cornerRadius * 2, rect.Y, cornerRadius * 2, cornerRadius * 2, 270, 90);//右上角
#region
if (m_location == AnchorTipsLocation.LEFT)
{
path.AddLine(rect.Right, rect.Y + cornerRadius * 2, rect.Right, rect.Y + rect.Height / 2 - 10);//右
path.AddLine(rect.Right, rect.Y + rect.Height / 2 - 10, rect.Right + 19, rect.Y + rect.Height / 2);//右
path.AddLine(rect.Right + 19, rect.Y + rect.Height / 2, rect.Right, rect.Y + rect.Height / 2 + 10);//右
path.AddLine(rect.Right, rect.Y + rect.Height / 2 + 10, rect.Right, rect.Y + rect.Height - cornerRadius * 2);//右
}
else
{
path.AddLine(rect.Right, rect.Y + cornerRadius * 2, rect.Right, rect.Y + rect.Height - cornerRadius * 2);//右
}
#endregion
path.AddArc(rect.X + rect.Width - cornerRadius * 2, rect.Y + rect.Height - cornerRadius * 2, cornerRadius * 2, cornerRadius * 2, 0, 90);//右下角
#region
if (m_location == AnchorTipsLocation.TOP)
{
path.AddLine(rect.Right - cornerRadius * 2, rect.Bottom, rect.Left + rect.Width / 2 + 10, rect.Bottom);
path.AddLine(rect.Left + rect.Width / 2 + 10, rect.Bottom, rect.Left + rect.Width / 2, rect.Bottom + 19);
path.AddLine(rect.Left + rect.Width / 2, rect.Bottom + 19, rect.Left + rect.Width / 2 - 10, rect.Bottom);
path.AddLine(rect.Left + rect.Width / 2 - 10, rect.Bottom, rect.X + cornerRadius * 2, rect.Bottom);
}
else
{
path.AddLine(rect.Right - cornerRadius * 2, rect.Bottom, rect.X + cornerRadius * 2, rect.Bottom);
}
#endregion
path.AddArc(rect.X, rect.Bottom - cornerRadius * 2, cornerRadius * 2, cornerRadius * 2, 90, 90);//左下角
#region
if (m_location == AnchorTipsLocation.RIGHT)
{
path.AddLine(rect.Left, rect.Y + cornerRadius * 2, rect.Left, rect.Y + rect.Height / 2 - 10);//左
path.AddLine(rect.Left, rect.Y + rect.Height / 2 - 10, rect.Left - 19, rect.Y + rect.Height / 2);//左
path.AddLine(rect.Left - 19, rect.Y + rect.Height / 2, rect.Left, rect.Y + rect.Height / 2 + 10);//左
path.AddLine(rect.Left, rect.Y + rect.Height / 2 + 10, rect.Left, rect.Y + rect.Height - cornerRadius * 2);//左
}
else
{
path.AddLine(rect.X, rect.Bottom - cornerRadius * 2, rect.X, rect.Y + cornerRadius * 2);//左
}
#endregion
path.CloseFigure();
#endregion
Bitmap bit = new Bitmap(formSize.Width, formSize.Height);
this.Size = formSize;
#region English:Drawing
Graphics gBit = Graphics.FromImage(bit);
gBit.SetGDIHigh();
gBit.FillPath(new SolidBrush(_background), path);
gBit.DrawString(strMsg, _font, new SolidBrush(_foreColor), rect, new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
gBit.Dispose();
#endregion
SetBits(bit);
}
#endregion
#region English:Show a hint
/// <summary>
/// Shows the tips.
/// </summary>
/// <param name="anchorControl">The parent control.</param>
/// <param name="strMsg">The string MSG.</param>
/// <param name="location">The location.</param>
/// <param name="background">The background.</param>
/// <param name="foreColor">Color of the fore.</param>
/// <param name="deviation">The deviation.</param>
/// <param name="fontSize">Size of the font.</param>
/// <param name="autoCloseTime">The automatic close time.</param>
/// <param name="blnTopMost">是否置顶</param>
/// <returns>FrmAnchorTips.</returns>
public static FrmAnchorTips ShowTips(
Control anchorControl,
string strMsg,
AnchorTipsLocation location = AnchorTipsLocation.RIGHT,
Color? background = null,
Color? foreColor = null,
Size? deviation = null,
int fontSize = 10,
int autoCloseTime = 5000,
bool blnTopMost = true)
{
Point p;
if (anchorControl is Form)
{
p = anchorControl.Location;
}
else
{
p = anchorControl.Parent.PointToScreen(anchorControl.Location);
}
if (deviation != null)
{
p = p + deviation.Value;
}
return ShowTips(new Rectangle(p, anchorControl.Size), strMsg, location, background, foreColor, fontSize, autoCloseTime, anchorControl.Parent, blnTopMost);
}
#endregion
#region English:Show a hint
/// <summary>
/// Shows the tips.
/// </summary>
/// <param name="rectControl">The rect control.</param>
/// <param name="strMsg">The string MSG.</param>
/// <param name="location">The location.</param>
/// <param name="background">The background.</param>
/// <param name="foreColor">Color of the fore.</param>
/// <param name="fontSize">Size of the font.</param>
/// <param name="autoCloseTime">The automatic close time.</param>
/// <param name="parentForm">父窗体</param>
/// <param name="blnTopMost">是否置顶</param>
/// <returns>FrmAnchorTips.</returns>
public static FrmAnchorTips ShowTips(
Rectangle rectControl,
string strMsg,
AnchorTipsLocation location = AnchorTipsLocation.RIGHT,
Color? background = null,
Color? foreColor = null,
int fontSize = 10,
int autoCloseTime = 5000,
Control parentControl = null,
bool blnTopMost = true)
{
FrmAnchorTips frm = new FrmAnchorTips(rectControl, strMsg, location, background, foreColor, fontSize, autoCloseTime);
frm.TopMost = blnTopMost;
frm.Show(parentControl);
//if (parentControl != null)
//{
// parentControl.VisibleChanged += (a, b) =>
// {
// try
// {
// Control c = a as Control;
// if (CheckControlClose(c))
// {
// frm.Close();
// }
// }
// catch (Exception ex)
// {
// }
// };
//}
return frm;
}
private static bool CheckControlClose(Control c)
{
if (c.IsDisposed || !c.Visible)
return true;
else if (c.Parent != null)
return CheckControlClose(c.Parent);
else
{
if (c is Form)
return false;
else
return true;
}
}
#endregion
#region Override
/// <summary>
/// 引发 <see cref="E:System.Windows.Forms.Form.Closing" /> 事件。
/// </summary>
/// <param name="e">一个包含事件数据的 <see cref="T:System.ComponentModel.CancelEventArgs" />。</param>
protected override void OnClosing(CancelEventArgs e)
{
e.Cancel = true;
base.OnClosing(e);
haveHandle = false;
this.Dispose();
}
/// <summary>
/// Handles the <see cref="E:HandleCreated" /> event.
/// </summary>
/// <param name="e">包含事件数据的 <see cref="T:System.EventArgs" />。</param>
protected override void OnHandleCreated(EventArgs e)
{
InitializeStyles();
base.OnHandleCreated(e);
haveHandle = true;
}
/// <summary>
/// Gets the create parameters.
/// </summary>
/// <value>The create parameters.</value>
protected override CreateParams CreateParams
{
get
{
CreateParams cParms = base.CreateParams;
cParms.ExStyle |= 0x00080000; // WS_EX_LAYERED
return cParms;
}
}
#endregion
/// <summary>
/// Initializes the styles.
/// </summary>
private void InitializeStyles()
{
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint, true);
UpdateStyles();
}
#region English:Display Forms Based on Pictures
/// <summary>
/// 功能描述:根据图片显示窗体 English:Display Forms Based on Pictures
/// 作  者:HZH
/// 创建日期:2019-08-29 15:31:16
/// 任务编号:
/// </summary>
/// <param name="bitmap">bitmap</param>
/// <exception cref="System.ApplicationException">The picture must be 32bit picture with alpha channel.</exception>
/// <exception cref="ApplicationException">The picture must be 32bit picture with alpha channel.</exception>
private void SetBits(Bitmap bitmap)
{
if (!haveHandle) return;
if (!Bitmap.IsCanonicalPixelFormat(bitmap.PixelFormat) || !Bitmap.IsAlphaPixelFormat(bitmap.PixelFormat))
throw new ApplicationException("The picture must be 32bit picture with alpha channel.");
IntPtr oldBits = IntPtr.Zero;
IntPtr screenDC = Win32.GetDC(IntPtr.Zero);
IntPtr hBitmap = IntPtr.Zero;
IntPtr memDc = Win32.CreateCompatibleDC(screenDC);
try
{
Win32.Point topLoc = new Win32.Point(Left, Top);
Win32.Size bitMapSize = new Win32.Size(bitmap.Width, bitmap.Height);
Win32.BLENDFUNCTION blendFunc = new Win32.BLENDFUNCTION();
Win32.Point srcLoc = new Win32.Point(0, 0);
hBitmap = bitmap.GetHbitmap(Color.FromArgb(0));
oldBits = Win32.SelectObject(memDc, hBitmap);
blendFunc.BlendOp = Win32.AC_SRC_OVER;
blendFunc.SourceConstantAlpha = 255;
blendFunc.AlphaFormat = Win32.AC_SRC_ALPHA;
blendFunc.BlendFlags = 0;
Win32.UpdateLayeredWindow(Handle, screenDC, ref topLoc, ref bitMapSize, memDc, ref srcLoc, 0, ref blendFunc, Win32.ULW_ALPHA);
}
finally
{
if (hBitmap != IntPtr.Zero)
{
Win32.SelectObject(memDc, oldBits);
Win32.DeleteObject(hBitmap);
}
Win32.ReleaseDC(IntPtr.Zero, screenDC);
Win32.DeleteDC(memDc);
}
}
#endregion
#region
/// <summary>
/// Sets the active window.
/// </summary>
/// <param name="handle">The handle.</param>
/// <returns>IntPtr.</returns>
[System.Runtime.InteropServices.DllImport("user32.dll")]
private extern static IntPtr SetActiveWindow(IntPtr handle);
/// <summary>
/// The wm activate
/// </summary>
private const int WM_ACTIVATE = 0x006;
/// <summary>
/// The wm activateapp
/// </summary>
private const int WM_ACTIVATEAPP = 0x01C;
/// <summary>
/// The wm ncactivate
/// </summary>
private const int WM_NCACTIVATE = 0x086;
/// <summary>
/// The wa inactive
/// </summary>
private const int WA_INACTIVE = 0;
/// <summary>
/// The wm mouseactivate
/// </summary>
private const int WM_MOUSEACTIVATE = 0x21;
/// <summary>
/// The ma noactivate
/// </summary>
private const int MA_NOACTIVATE = 3;
/// <summary>
/// WNDs the proc.
/// </summary>
/// <param name="m">要处理的 Windows <see cref="T:System.Windows.Forms.Message" />。</param>
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_MOUSEACTIVATE)
{
m.Result = new IntPtr(MA_NOACTIVATE);
return;
}
else if (m.Msg == WM_NCACTIVATE)
{
if (((int)m.WParam & 0xFFFF) != WA_INACTIVE)
{
if (m.LParam != IntPtr.Zero)
{
SetActiveWindow(m.LParam);
}
else
{
SetActiveWindow(IntPtr.Zero);
}
}
}
base.WndProc(ref m);
}
#endregion
}
/// <summary>
/// Enum AnchorTipsLocation
/// </summary>
public enum AnchorTipsLocation
{
/// <summary>
/// The left
/// </summary>
LEFT,
/// <summary>
/// The top
/// </summary>
TOP,
/// <summary>
/// The right
/// </summary>
RIGHT,
/// <summary>
/// The bottom
/// </summary>
BOTTOM
}
/// <summary>
/// Class Win32.
/// </summary>
class Win32
{
/// <summary>
/// Struct Size
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Size
{
/// <summary>
/// The cx
/// </summary>
public Int32 cx;
/// <summary>
/// The cy
/// </summary>
public Int32 cy;
/// <summary>
/// Initializes a new instance of the <see cref="Size" /> struct.
/// </summary>
/// <param name="x">The x.</param>
/// <param name="y">The y.</param>
public Size(Int32 x, Int32 y)
{
cx = x;
cy = y;
}
}
/// <summary>
/// Struct BLENDFUNCTION
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct BLENDFUNCTION
{
/// <summary>
/// The blend op
/// </summary>
public byte BlendOp;
/// <summary>
/// The blend flags
/// </summary>
public byte BlendFlags;
/// <summary>
/// The source constant alpha
/// </summary>
public byte SourceConstantAlpha;
/// <summary>
/// The alpha format
/// </summary>
public byte AlphaFormat;
}
/// <summary>
/// Struct Point
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Point
{
/// <summary>
/// The x
/// </summary>
public Int32 x;
/// <summary>
/// The y
/// </summary>
public Int32 y;
/// <summary>
/// Initializes a new instance of the <see cref="Point" /> struct.
/// </summary>
/// <param name="x">The x.</param>
/// <param name="y">The y.</param>
public Point(Int32 x, Int32 y)
{
this.x = x;
this.y = y;
}
}
/// <summary>
/// The ac source over
/// </summary>
public const byte AC_SRC_OVER = 0;
/// <summary>
/// The ulw alpha
/// </summary>
public const Int32 ULW_ALPHA = 2;
/// <summary>
/// The ac source alpha
/// </summary>
public const byte AC_SRC_ALPHA = 1;
/// <summary>
/// Creates the compatible dc.
/// </summary>
/// <param name="hDC">The h dc.</param>
/// <returns>IntPtr.</returns>
[DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)]
public static extern IntPtr CreateCompatibleDC(IntPtr hDC);
/// <summary>
/// Gets the dc.
/// </summary>
/// <param name="hWnd">The h WND.</param>
/// <returns>IntPtr.</returns>
[DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]
public static extern IntPtr GetDC(IntPtr hWnd);
/// <summary>
/// Selects the object.
/// </summary>
/// <param name="hDC">The h dc.</param>
/// <param name="hObj">The h object.</param>
/// <returns>IntPtr.</returns>
[DllImport("gdi32.dll", ExactSpelling = true)]
public static extern IntPtr SelectObject(IntPtr hDC, IntPtr hObj);
/// <summary>
/// Releases the dc.
/// </summary>
/// <param name="hWnd">The h WND.</param>
/// <param name="hDC">The h dc.</param>
/// <returns>System.Int32.</returns>
[DllImport("user32.dll", ExactSpelling = true)]
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
/// <summary>
/// Deletes the dc.
/// </summary>
/// <param name="hDC">The h dc.</param>
/// <returns>System.Int32.</returns>
[DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)]
public static extern int DeleteDC(IntPtr hDC);
/// <summary>
/// Deletes the object.
/// </summary>
/// <param name="hObj">The h object.</param>
/// <returns>System.Int32.</returns>
[DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)]
public static extern int DeleteObject(IntPtr hObj);
/// <summary>
/// Updates the layered window.
/// </summary>
/// <param name="hwnd">The HWND.</param>
/// <param name="hdcDst">The HDC DST.</param>
/// <param name="pptDst">The PPT DST.</param>
/// <param name="psize">The psize.</param>
/// <param name="hdcSrc">The HDC source.</param>
/// <param name="pptSrc">The PPT source.</param>
/// <param name="crKey">The cr key.</param>
/// <param name="pblend">The pblend.</param>
/// <param name="dwFlags">The dw flags.</param>
/// <returns>System.Int32.</returns>
[DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]
public static extern int UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref Point pptDst, ref Size psize, IntPtr hdcSrc, ref Point pptSrc, Int32 crKey, ref BLENDFUNCTION pblend, Int32 dwFlags);
/// <summary>
/// Exts the create region.
/// </summary>
/// <param name="lpXform">The lp xform.</param>
/// <param name="nCount">The n count.</param>
/// <param name="rgnData">The RGN data.</param>
/// <returns>IntPtr.</returns>
[DllImport("gdi32.dll", ExactSpelling = true, SetLastError = true)]
public static extern IntPtr ExtCreateRegion(IntPtr lpXform, uint nCount, IntPtr rgnData);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,177 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmBack.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmBack.
/// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmBase" />
partial class FrmBack
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmBack));
this.panTop = new System.Windows.Forms.Panel();
this.lblHelp = new System.Windows.Forms.Label();
this.btnBack1 = new HZH_Controls.Controls.UCBtnImg();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
this.panTop.SuspendLayout();
this.SuspendLayout();
//
// panTop
//
this.panTop.Controls.Add(this.lblHelp);
this.panTop.Controls.Add(this.btnBack1);
this.panTop.Dock = System.Windows.Forms.DockStyle.Top;
this.panTop.Location = new System.Drawing.Point(0, 0);
this.panTop.Name = "panTop";
this.panTop.Size = new System.Drawing.Size(679, 60);
this.panTop.TabIndex = 2;
//
// lblHelp
//
this.lblHelp.BackColor = System.Drawing.Color.Transparent;
this.lblHelp.Dock = System.Windows.Forms.DockStyle.Right;
this.lblHelp.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold);
this.lblHelp.Image = global::HZH_Controls.Properties.Resources.help;
this.lblHelp.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lblHelp.Location = new System.Drawing.Point(612, 0);
this.lblHelp.Name = "lblHelp";
this.lblHelp.Size = new System.Drawing.Size(67, 60);
this.lblHelp.TabIndex = 1;
this.lblHelp.Text = "帮助";
this.lblHelp.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblHelp.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label1_MouseDown);
//
// btnBack1
//
this.btnBack1.BackColor = System.Drawing.Color.Transparent;
this.btnBack1.BtnBackColor = System.Drawing.Color.Transparent;
this.btnBack1.BtnFont = new System.Drawing.Font("微软雅黑", 17F);
this.btnBack1.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(102)))));
this.btnBack1.BtnText = " 自定义按钮";
this.btnBack1.ConerRadius = 5;
this.btnBack1.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnBack1.Dock = System.Windows.Forms.DockStyle.Left;
this.btnBack1.EnabledMouseEffect = false;
this.btnBack1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnBack1.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnBack1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(102)))));
this.btnBack1.Image = ((System.Drawing.Image)(resources.GetObject("btnBack1.Image")));
this.btnBack1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnBack1.ImageFontIcons = null;
this.btnBack1.IsRadius = true;
this.btnBack1.IsShowRect = true;
this.btnBack1.IsShowTips = false;
this.btnBack1.Location = new System.Drawing.Point(0, 0);
this.btnBack1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btnBack1.Name = "btnBack1";
this.btnBack1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnBack1.RectWidth = 1;
this.btnBack1.Size = new System.Drawing.Size(200, 60);
this.btnBack1.TabIndex = 0;
this.btnBack1.TabStop = false;
this.btnBack1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnBack1.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99)))));
this.btnBack1.TipsText = "";
this.btnBack1.BtnClick += new System.EventHandler(this.btnBack1_btnClick);
//
// imageList1
//
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "help.png");
//
// ucSplitLine_H1
//
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Top;
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 60);
this.ucSplitLine_H1.MaximumSize = new System.Drawing.Size(0, 1);
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
this.ucSplitLine_H1.Size = new System.Drawing.Size(679, 1);
this.ucSplitLine_H1.TabIndex = 0;
this.ucSplitLine_H1.TabStop = false;
//
// FrmBack
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.ClientSize = new System.Drawing.Size(679, 477);
this.Controls.Add(this.ucSplitLine_H1);
this.Controls.Add(this.panTop);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmBack";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "FrmTemp1";
this.Load += new System.EventHandler(this.FrmBack_Load);
this.panTop.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The BTN back1
/// </summary>
private Controls.UCBtnImg btnBack1;
/// <summary>
/// The label1
/// </summary>
private System.Windows.Forms.Label lblHelp;
/// <summary>
/// The image list1
/// </summary>
private System.Windows.Forms.ImageList imageList1;
/// <summary>
/// The uc split line h1
/// </summary>
private Controls.UCSplitLine_H ucSplitLine_H1;
/// <summary>
/// The pan top
/// </summary>
private System.Windows.Forms.Panel panTop;
}
}

View File

@ -0,0 +1,126 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmBack.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmBack.
/// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmBase" />
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(System.ComponentModel.Design.IDesigner))]
public partial class FrmBack : FrmBase
{
public override Color ForeColor
{
get { return base.ForeColor; }
set
{
base.ForeColor = value;
if (this.btnBack1 != null)
this.btnBack1.ForeColor = value;
}
}
public override Color BackColor
{
get { return base.BackColor; }
set
{
base.BackColor = value;
if (this.btnBack1 != null)
{
this.btnBack1.FillColor = value;
this.btnBack1.RectColor = value;
}
}
}
[Description("是否显示帮助按钮"), Category("自定义")]
public bool IsShowHelpBTn
{
get { return lblHelp.Visible; }
set
{
lblHelp.Visible = value;
}
}
/// <summary>
/// The FRM title
/// </summary>
private string _frmTitle = "自定义窗体";
/// <summary>
/// 窗体标题
/// </summary>
/// <value>The FRM title.</value>
[Description("窗体标题"), Category("自定义")]
public string FrmTitle
{
get { return _frmTitle; }
set
{
_frmTitle = value;
btnBack1.BtnText = " " + value;
}
}
/// <summary>
/// Occurs when [BTN help click].
/// </summary>
[Description("帮助按钮点击事件"), Category("自定义")]
public event EventHandler BtnHelpClick;
/// <summary>
/// Initializes a new instance of the <see cref="FrmBack" /> class.
/// </summary>
public FrmBack()
{
InitializeComponent();
InitFormMove(this.panTop);
}
/// <summary>
/// Handles the btnClick event of the btnBack1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void btnBack1_btnClick(object sender, EventArgs e)
{
this.Close();
}
/// <summary>
/// Handles the MouseDown event of the label1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
private void label1_MouseDown(object sender, MouseEventArgs e)
{
if (BtnHelpClick != null)
BtnHelpClick(sender, e);
}
private void FrmBack_Load(object sender, EventArgs e)
{
this.btnBack1.ForeColor = ForeColor;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,74 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmBase.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmBase.
/// Implements the <see cref="System.Windows.Forms.Form" />
/// </summary>
/// <seealso cref="System.Windows.Forms.Form" />
partial class FrmBase
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmBase));
this.SuspendLayout();
//
// FrmBase
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.ClientSize = new System.Drawing.Size(331, 371);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(66)))), ((int)(((byte)(66)))));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "FrmBase";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "FrmBase";
this.Load += new System.EventHandler(this.FrmBase_Load);
this.ResumeLayout(false);
}
#endregion
}
}

View File

@ -0,0 +1,624 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmBase.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmBase.
/// Implements the <see cref="System.Windows.Forms.Form" />
/// </summary>
/// <seealso cref="System.Windows.Forms.Form" />
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(System.ComponentModel.Design.IDesigner))]
public partial class FrmBase : Form
{
/// <summary>
/// Gets or sets the hot keys.
/// </summary>
/// <value>The hot keys.</value>
[Description("定义的热键列表"), Category("自定义")]
public Dictionary<int, string> HotKeys { get; set; }
/// <summary>
/// Delegate HotKeyEventHandler
/// </summary>
/// <param name="strHotKey">The string hot key.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public delegate bool HotKeyEventHandler(string strHotKey);
/// <summary>
/// 热键事件
/// </summary>
[Description("热键事件"), Category("自定义")]
public event HotKeyEventHandler HotKeyDown;
#region
/// <summary>
/// 失去焦点关闭
/// </summary>
bool _isLoseFocusClose = false;
/// <summary>
/// 是否重绘边框样式
/// </summary>
private bool _redraw = false;
/// <summary>
/// 是否显示圆角
/// </summary>
private bool _isShowRegion = false;
/// <summary>
/// 边圆角大小
/// </summary>
private int _regionRadius = 10;
/// <summary>
/// 边框颜色
/// </summary>
private Color _borderStyleColor;
/// <summary>
/// 边框宽度
/// </summary>
private int _borderStyleSize;
/// <summary>
/// 边框样式
/// </summary>
private ButtonBorderStyle _borderStyleType;
/// <summary>
/// 是否显示模态
/// </summary>
private bool _isShowMaskDialog = false;
/// <summary>
/// 蒙版窗体
/// </summary>
/// <value><c>true</c> if this instance is show mask dialog; otherwise, <c>false</c>.</value>
[Description("是否显示蒙版窗体")]
public bool IsShowMaskDialog
{
get
{
return this._isShowMaskDialog;
}
set
{
this._isShowMaskDialog = value;
}
}
/// <summary>
/// 边框宽度
/// </summary>
/// <value>The size of the border style.</value>
[Description("边框宽度")]
public int BorderStyleSize
{
get
{
return this._borderStyleSize;
}
set
{
this._borderStyleSize = value;
}
}
/// <summary>
/// 边框颜色
/// </summary>
/// <value>The color of the border style.</value>
[Description("边框颜色")]
public Color BorderStyleColor
{
get
{
return this._borderStyleColor;
}
set
{
this._borderStyleColor = value;
}
}
/// <summary>
/// 边框样式
/// </summary>
/// <value>The type of the border style.</value>
[Description("边框样式")]
public ButtonBorderStyle BorderStyleType
{
get
{
return this._borderStyleType;
}
set
{
this._borderStyleType = value;
}
}
/// <summary>
/// 边框圆角
/// </summary>
/// <value>The region radius.</value>
[Description("边框圆角")]
public int RegionRadius
{
get
{
return this._regionRadius;
}
set
{
this._regionRadius = Math.Max(value, 1);
}
}
/// <summary>
/// 是否显示自定义绘制内容
/// </summary>
/// <value><c>true</c> if this instance is show region; otherwise, <c>false</c>.</value>
[Description("是否显示自定义绘制内容")]
public bool IsShowRegion
{
get
{
return this._isShowRegion;
}
set
{
this._isShowRegion = value;
}
}
/// <summary>
/// 是否显示重绘边框
/// </summary>
/// <value><c>true</c> if redraw; otherwise, <c>false</c>.</value>
[Description("是否显示重绘边框")]
public bool Redraw
{
get
{
return this._redraw;
}
set
{
this._redraw = value;
}
}
/// <summary>
/// The is full size
/// </summary>
private bool _isFullSize = true;
/// <summary>
/// 是否全屏
/// </summary>
/// <value><c>true</c> if this instance is full size; otherwise, <c>false</c>.</value>
[Description("是否全屏")]
public virtual bool IsFullSize
{
get { return _isFullSize; }
set { _isFullSize = value; }
}
/// <summary>
/// 失去焦点自动关闭
/// </summary>
/// <value><c>true</c> if this instance is lose focus close; otherwise, <c>false</c>.</value>
[Description("失去焦点自动关闭")]
public bool IsLoseFocusClose
{
get
{
return this._isLoseFocusClose;
}
set
{
this._isLoseFocusClose = value;
}
}
#endregion
/// <summary>
/// Gets a value indicating whether this instance is desing mode.
/// </summary>
/// <value><c>true</c> if this instance is desing mode; otherwise, <c>false</c>.</value>
private bool IsDesingMode
{
get
{
bool ReturnFlag = false;
if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
ReturnFlag = true;
else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv")
ReturnFlag = true;
return ReturnFlag;
}
}
#region
/// <summary>
/// Initializes a new instance of the <see cref="FrmBase" /> class.
/// </summary>
public FrmBase()
{
InitializeComponent();
base.SetStyle(ControlStyles.UserPaint, true);
base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
base.SetStyle(ControlStyles.DoubleBuffer, true);
//base.HandleCreated += new EventHandler(this.FrmBase_HandleCreated);
//base.HandleDestroyed += new EventHandler(this.FrmBase_HandleDestroyed);
this.KeyDown += FrmBase_KeyDown;
this.FormClosing += FrmBase_FormClosing;
}
/// <summary>
/// Handles the FormClosing event of the FrmBase control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="FormClosingEventArgs" /> instance containing the event data.</param>
void FrmBase_FormClosing(object sender, FormClosingEventArgs e)
{
if (_isLoseFocusClose)
{
MouseHook.OnMouseActivity -= hook_OnMouseActivity;
}
}
/// <summary>
/// Handles the Load event of the FrmBase control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void FrmBase_Load(object sender, EventArgs e)
{
if (!IsDesingMode)
{
if (_isFullSize)
SetFullSize();
}
if (_isLoseFocusClose)
{
MouseHook.OnMouseActivity += hook_OnMouseActivity;
}
}
#endregion
#region
/// <summary>
/// Handles the OnMouseActivity event of the hook control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
void hook_OnMouseActivity(object sender, MouseEventArgs e)
{
try
{
if (this._isLoseFocusClose && e.Clicks > 0)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left || e.Button == System.Windows.Forms.MouseButtons.Right)
{
if (!this.IsDisposed)
{
if (!this.ClientRectangle.Contains(this.PointToClient(e.Location)))
{
base.Close();
}
}
}
}
}
catch { }
}
/// <summary>
/// 全屏
/// </summary>
public void SetFullSize()
{
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
}
/// <summary>
/// Does the escape.
/// </summary>
protected virtual void DoEsc()
{
base.Close();
}
/// <summary>
/// Does the enter.
/// </summary>
protected virtual void DoEnter()
{
}
/// <summary>
/// 设置重绘区域
/// </summary>
public void SetWindowRegion()
{
GraphicsPath path = new GraphicsPath();
Rectangle rect = new Rectangle(-1, -1, base.Width + 1, base.Height);
path = this.GetRoundedRectPath(rect, this._regionRadius);
base.Region = new Region(path);
}
/// <summary>
/// 获取重绘区域
/// </summary>
/// <param name="rect">The rect.</param>
/// <param name="radius">The radius.</param>
/// <returns>GraphicsPath.</returns>
private GraphicsPath GetRoundedRectPath(Rectangle rect, int radius)
{
Rectangle rect2 = new Rectangle(rect.Location, new Size(radius, radius));
GraphicsPath graphicsPath = new GraphicsPath();
graphicsPath.AddArc(rect2, 180f, 90f);
rect2.X = rect.Right - radius;
graphicsPath.AddArc(rect2, 270f, 90f);
rect2.Y = rect.Bottom - radius;
rect2.Width += 1;
rect2.Height += 1;
graphicsPath.AddArc(rect2, 360f, 90f);
rect2.X = rect.Left;
graphicsPath.AddArc(rect2, 90f, 90f);
graphicsPath.CloseFigure();
return graphicsPath;
}
/// <summary>
/// 将窗体显示为具有指定所有者的模式对话框。
/// </summary>
/// <param name="owner">任何实现 <see cref="T:System.Windows.Forms.IWin32Window" />(表示将拥有模式对话框的顶级窗口)的对象。</param>
/// <returns><see cref="T:System.Windows.Forms.DialogResult" /> 值之一。</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
public new DialogResult ShowDialog(IWin32Window owner)
{
try
{
if (this._isShowMaskDialog && owner != null)
{
var frmOwner = (Control)owner;
FrmTransparent _frmTransparent = new FrmTransparent();
_frmTransparent.Width = frmOwner.Width;
_frmTransparent.Height = frmOwner.Height;
Point location = frmOwner.PointToScreen(new Point(0, 0));
_frmTransparent.Location = location;
_frmTransparent.frmchild = this;
_frmTransparent.IsShowMaskDialog = false;
return _frmTransparent.ShowDialog(owner);
}
else
{
return base.ShowDialog(owner);
}
}
catch (NullReferenceException)
{
return System.Windows.Forms.DialogResult.None;
}
}
/// <summary>
/// 将窗体显示为模式对话框,并将当前活动窗口设置为它的所有者。
/// </summary>
/// <returns><see cref="T:System.Windows.Forms.DialogResult" /> 值之一。</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
/// <IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
public new DialogResult ShowDialog()
{
return base.ShowDialog();
}
#endregion
#region
/// <summary>
/// 关闭时发生
/// </summary>
/// <param name="e">一个包含事件数据的 <see cref="T:System.EventArgs" />。</param>
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
if (base.Owner != null && base.Owner is FrmTransparent)
{
(base.Owner as FrmTransparent).Close();
}
}
/// <summary>
/// 快捷键
/// </summary>
/// <param name="msg">通过引用传递的 <see cref="T:System.Windows.Forms.Message" />,它表示要处理的 Win32 消息。</param>
/// <param name="keyData"><see cref="T:System.Windows.Forms.Keys" /> 值之一,它表示要处理的键。</param>
/// <returns>如果控件处理并使用击键,则为 true否则为 false以允许进一步处理。</returns>
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
int num = 256;
int num2 = 260;
bool result;
if (msg.Msg == num | msg.Msg == num2)
{
if (keyData == (Keys)262259)
{
result = true;
return result;
}
if (keyData != Keys.Enter)
{
if (keyData == Keys.Escape)
{
this.DoEsc();
}
}
else
{
this.DoEnter();
}
}
result = false;
if (result)
return result;
else
return base.ProcessCmdKey(ref msg, keyData);
}
/// <summary>
/// Handles the KeyDown event of the FrmBase control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="KeyEventArgs" /> instance containing the event data.</param>
protected void FrmBase_KeyDown(object sender, KeyEventArgs e)
{
if (HotKeyDown != null && HotKeys != null)
{
bool blnCtrl = false;
bool blnAlt = false;
bool blnShift = false;
if (e.Control)
blnCtrl = true;
if (e.Alt)
blnAlt = true;
if (e.Shift)
blnShift = true;
if (HotKeys.ContainsKey(e.KeyValue))
{
string strKey = string.Empty;
if (blnCtrl)
{
strKey += "Ctrl+";
}
if (blnAlt)
{
strKey += "Alt+";
}
if (blnShift)
{
strKey += "Shift+";
}
strKey += HotKeys[e.KeyValue];
if (HotKeyDown(strKey))
{
e.Handled = true;
e.SuppressKeyPress = true;
}
}
}
}
/// <summary>
/// 重绘事件
/// </summary>
/// <param name="e">包含事件数据的 <see cref="T:System.Windows.Forms.PaintEventArgs" />。</param>
protected override void OnPaint(PaintEventArgs e)
{
if (this._isShowRegion)
{
this.SetWindowRegion();
}
base.OnPaint(e);
if (this._redraw)
{
ControlPaint.DrawBorder(e.Graphics, base.ClientRectangle, this._borderStyleColor, this._borderStyleSize, this._borderStyleType, this._borderStyleColor, this._borderStyleSize, this._borderStyleType, this._borderStyleColor, this._borderStyleSize, this._borderStyleType, this._borderStyleColor, this._borderStyleSize, this._borderStyleType);
}
}
#endregion
#region English:Form drag
/// <summary>
/// Releases the capture.
/// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
/// <summary>
/// Sends the message.
/// </summary>
/// <param name="hwnd">The HWND.</param>
/// <param name="wMsg">The w MSG.</param>
/// <param name="wParam">The w parameter.</param>
/// <param name="lParam">The l parameter.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
/// <summary>
/// The wm syscommand
/// </summary>
public const int WM_SYSCOMMAND = 0x0112;
/// <summary>
/// The sc move
/// </summary>
public const int SC_MOVE = 0xF010;
/// <summary>
/// The htcaption
/// </summary>
public const int HTCAPTION = 0x0002;
/// <summary>
/// 通过Windows的API控制窗体的拖动
/// </summary>
/// <param name="hwnd">The HWND.</param>
public static void MouseDown(IntPtr hwnd)
{
ReleaseCapture();
SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
}
#endregion
/// <summary>
/// 在构造函数中调用设置窗体移动
/// </summary>
/// <param name="cs">The cs.</param>
protected void InitFormMove(params Control[] cs)
{
foreach (Control c in cs)
{
if (c != null && !c.IsDisposed)
c.MouseDown += c_MouseDown;
}
}
/// <summary>
/// Handles the MouseDown event of the c control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
void c_MouseDown(object sender, MouseEventArgs e)
{
MouseDown(this.Handle);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,163 @@
namespace HZH_Controls.Forms
{
partial class FrmDefault
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblTitle = new System.Windows.Forms.Label();
this.btnMin = new System.Windows.Forms.Panel();
this.btnMax = new System.Windows.Forms.Panel();
this.btnClose = new System.Windows.Forms.Panel();
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
this.ucSplitLine_V1 = new HZH_Controls.Controls.UCSplitLine_V();
this.ucSplitLine_V2 = new HZH_Controls.Controls.UCSplitLine_V();
this.panel1 = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// lblTitle
//
this.lblTitle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
this.lblTitle.Dock = System.Windows.Forms.DockStyle.Top;
this.lblTitle.Font = new System.Drawing.Font("微软雅黑", 17F);
this.lblTitle.ForeColor = System.Drawing.Color.White;
this.lblTitle.Location = new System.Drawing.Point(0, 0);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(705, 60);
this.lblTitle.TabIndex = 6;
this.lblTitle.Text = "标题";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnMin
//
this.btnMin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnMin.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
this.btnMin.BackgroundImage = global::HZH_Controls.Properties.Resources.;
this.btnMin.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.btnMin.Location = new System.Drawing.Point(602, 0);
this.btnMin.Name = "btnMin";
this.btnMin.Size = new System.Drawing.Size(31, 60);
this.btnMin.TabIndex = 7;
this.btnMin.Click += new System.EventHandler(this.btnMin_Click);
//
// btnMax
//
this.btnMax.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnMax.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
this.btnMax.BackgroundImage = global::HZH_Controls.Properties.Resources.;
this.btnMax.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.btnMax.Location = new System.Drawing.Point(636, 0);
this.btnMax.Name = "btnMax";
this.btnMax.Size = new System.Drawing.Size(31, 60);
this.btnMax.TabIndex = 8;
this.btnMax.Click += new System.EventHandler(this.btnMax_Click);
//
// btnClose
//
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
this.btnClose.BackgroundImage = global::HZH_Controls.Properties.Resources.;
this.btnClose.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.btnClose.Location = new System.Drawing.Point(670, 0);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(31, 60);
this.btnClose.TabIndex = 9;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// ucSplitLine_H1
//
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 545);
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
this.ucSplitLine_H1.Size = new System.Drawing.Size(705, 2);
this.ucSplitLine_H1.TabIndex = 10;
this.ucSplitLine_H1.TabStop = false;
//
// ucSplitLine_V1
//
this.ucSplitLine_V1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
this.ucSplitLine_V1.Dock = System.Windows.Forms.DockStyle.Left;
this.ucSplitLine_V1.Location = new System.Drawing.Point(0, 60);
this.ucSplitLine_V1.Name = "ucSplitLine_V1";
this.ucSplitLine_V1.Size = new System.Drawing.Size(2, 485);
this.ucSplitLine_V1.TabIndex = 11;
this.ucSplitLine_V1.TabStop = false;
//
// ucSplitLine_V2
//
this.ucSplitLine_V2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(158)))), ((int)(((byte)(255)))));
this.ucSplitLine_V2.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitLine_V2.Location = new System.Drawing.Point(703, 60);
this.ucSplitLine_V2.Name = "ucSplitLine_V2";
this.ucSplitLine_V2.Size = new System.Drawing.Size(2, 485);
this.ucSplitLine_V2.TabIndex = 12;
this.ucSplitLine_V2.TabStop = false;
//
// panel1
//
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(2, 60);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(701, 485);
this.panel1.TabIndex = 13;
//
// FrmDefault
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(705, 547);
this.Controls.Add(this.panel1);
this.Controls.Add(this.ucSplitLine_V2);
this.Controls.Add(this.ucSplitLine_V1);
this.Controls.Add(this.ucSplitLine_H1);
this.Controls.Add(this.btnMin);
this.Controls.Add(this.btnMax);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.lblTitle);
this.IsFullSize = false;
this.Name = "FrmDefault";
this.Text = "FrmDefault";
this.Load += new System.EventHandler(this.FrmDefault_Load);
this.Shown += new System.EventHandler(this.FrmDefault_Shown);
this.SizeChanged += new System.EventHandler(this.FrmDefault_SizeChanged);
this.TextChanged += new System.EventHandler(this.FrmDefault_TextChanged);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label lblTitle;
private System.Windows.Forms.Panel btnMin;
private System.Windows.Forms.Panel btnMax;
private System.Windows.Forms.Panel btnClose;
private Controls.UCSplitLine_H ucSplitLine_H1;
private Controls.UCSplitLine_V ucSplitLine_V1;
private Controls.UCSplitLine_V ucSplitLine_V2;
protected System.Windows.Forms.Panel panel1;
}
}

View File

@ -0,0 +1,163 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Forms
{
public partial class FrmDefault : FrmBase
{
private Color _borderColor;
[Description("边框及标题颜色"), Category("自定义")]
public Color BorderColor
{
get { return _borderColor; }
set
{
_borderColor = value;
lblTitle.BackColor = btnMin.BackColor = btnMax.BackColor = btnClose.BackColor = ucSplitLine_H1.BackColor = ucSplitLine_V1.BackColor = ucSplitLine_V2.BackColor;
}
}
private bool _isShowMinBtn = true;
[Description("是否显示最小化按钮"), Category("自定义")]
public bool IsShowMinBtn
{
get { return _isShowMinBtn; }
set
{
_isShowMinBtn = value;
btnMin.Visible = value;
btnMin.BringToFront();
ReloadBtn();
}
}
private bool _isShowMaxBtn = true;
[Description("是否显示最大化按钮"), Category("自定义")]
public bool IsShowMaxBtn
{
get { return _isShowMaxBtn; }
set
{
_isShowMaxBtn = value;
btnMax.Visible = value;
btnMax.BringToFront();
ReloadBtn();
}
}
private bool _isShowCloseBtn = true;
[Description("是否显示关闭按钮"), Category("自定义")]
public bool IsShowCloseBtn
{
get { return _isShowCloseBtn; }
set
{
_isShowCloseBtn = value;
btnClose.Visible = value;
btnClose.BringToFront();
ReloadBtn();
}
}
[Bindable(false)]
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool IsFullSize
{
get { return base.IsFullSize; }
set { base.IsFullSize = value; }
}
public FrmDefault()
{
InitializeComponent();
base.IsFullSize = false;
ReloadBtn();
InitFormMove(this.lblTitle);
}
private void FrmDefault_Load(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized)
{
btnMax.BackgroundImage = Properties.Resources.;
}
else
{
btnMax.BackgroundImage = Properties.Resources.;
}
ReloadBtn();
}
private void ReloadBtn()
{
int r = 0;
if (_isShowCloseBtn)
{
r += 31 + 10;
btnClose.Location = new Point(this.ClientRectangle.Right - r, btnClose.Location.Y);
btnClose.BringToFront();
}
if (_isShowMaxBtn)
{
r += 31 + 10;
btnMax.Location = new Point(this.ClientRectangle.Right - r, btnMax.Location.Y);
btnMax.BringToFront();
}
if (_isShowMinBtn)
{
r += 31 + 10;
btnMin.Location = new Point(this.ClientRectangle.Right - r, btnMin.Location.Y);
btnMin.BringToFront();
}
}
private void FrmDefault_Shown(object sender, EventArgs e)
{
ReloadBtn();
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void FrmDefault_SizeChanged(object sender, EventArgs e)
{
ReloadBtn();
}
private void btnMin_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
bool blnMax = false;
Rectangle nomoRect;
private void btnMax_Click(object sender, EventArgs e)
{
var rect = Screen.GetWorkingArea(this);
if (this.Size == rect.Size)
{
btnMax.BackgroundImage = Properties.Resources.;
this.Size = nomoRect.Size;
this.Location = nomoRect.Location;
}
else
{
btnMax.BackgroundImage = Properties.Resources.;
nomoRect = this.DesktopBounds;
this.Size = rect.Size;
this.Location = rect.Location;
}
}
private void FrmDefault_TextChanged(object sender, EventArgs e)
{
lblTitle.Text = Text;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,283 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmDialog.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmDialog.
/// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmBase" />
partial class FrmDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmDialog));
this.btnClose = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.btnCancel = new HZH_Controls.Controls.UCBtnExt();
this.ucSplitLine_V1 = new HZH_Controls.Controls.UCSplitLine_V();
this.btnOK = new HZH_Controls.Controls.UCBtnExt();
this.lblMsg = new System.Windows.Forms.Label();
this.lblTitle = new System.Windows.Forms.Label();
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
this.ucSplitLine_H2 = new HZH_Controls.Controls.UCSplitLine_H();
this.panel1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// btnClose
//
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.BackgroundImage = global::HZH_Controls.Properties.Resources.dialog_close;
this.btnClose.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.btnClose.Location = new System.Drawing.Point(383, 0);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(28, 60);
this.btnClose.TabIndex = 4;
this.btnClose.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnClose_MouseDown);
//
// panel1
//
this.panel1.Controls.Add(this.tableLayoutPanel1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 214);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(427, 64);
this.panel1.TabIndex = 3;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 3;
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.Absolute, 1F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.btnCancel, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.ucSplitLine_V1, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.btnOK, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(427, 64);
this.tableLayoutPanel1.TabIndex = 5;
//
// btnCancel
//
this.btnCancel.BackColor = System.Drawing.Color.Transparent;
this.btnCancel.BtnBackColor = System.Drawing.Color.Transparent;
this.btnCancel.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(73)))), ((int)(((byte)(119)))), ((int)(((byte)(232)))));
this.btnCancel.BtnText = "取消";
this.btnCancel.ConerRadius = 5;
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancel.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnCancel.FillColor = System.Drawing.Color.White;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnCancel.IsRadius = false;
this.btnCancel.IsShowRect = false;
this.btnCancel.IsShowTips = false;
this.btnCancel.Location = new System.Drawing.Point(214, 0);
this.btnCancel.Margin = new System.Windows.Forms.Padding(0);
this.btnCancel.Name = "btnCancel";
this.btnCancel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnCancel.RectWidth = 1;
this.btnCancel.Size = new System.Drawing.Size(213, 64);
this.btnCancel.TabIndex = 1;
this.btnCancel.TabStop = false;
this.btnCancel.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99)))));
this.btnCancel.TipsText = "";
this.btnCancel.BtnClick += new System.EventHandler(this.btnCancel_BtnClick);
//
// ucSplitLine_V1
//
this.ucSplitLine_V1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
this.ucSplitLine_V1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ucSplitLine_V1.Location = new System.Drawing.Point(213, 15);
this.ucSplitLine_V1.Margin = new System.Windows.Forms.Padding(0, 15, 0, 15);
this.ucSplitLine_V1.Name = "ucSplitLine_V1";
this.ucSplitLine_V1.Size = new System.Drawing.Size(1, 34);
this.ucSplitLine_V1.TabIndex = 2;
this.ucSplitLine_V1.TabStop = false;
//
// btnOK
//
this.btnOK.BackColor = System.Drawing.Color.Transparent;
this.btnOK.BtnBackColor = System.Drawing.Color.Transparent;
this.btnOK.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOK.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnOK.BtnText = "确定";
this.btnOK.ConerRadius = 5;
this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOK.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnOK.FillColor = System.Drawing.Color.White;
this.btnOK.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnOK.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnOK.IsRadius = false;
this.btnOK.IsShowRect = false;
this.btnOK.IsShowTips = false;
this.btnOK.Location = new System.Drawing.Point(0, 0);
this.btnOK.Margin = new System.Windows.Forms.Padding(0);
this.btnOK.Name = "btnOK";
this.btnOK.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnOK.RectWidth = 1;
this.btnOK.Size = new System.Drawing.Size(213, 64);
this.btnOK.TabIndex = 0;
this.btnOK.TabStop = false;
this.btnOK.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99)))));
this.btnOK.TipsText = "";
this.btnOK.BtnClick += new System.EventHandler(this.btnOK_BtnClick);
//
// lblMsg
//
this.lblMsg.BackColor = System.Drawing.Color.White;
this.lblMsg.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblMsg.Font = new System.Drawing.Font("微软雅黑", 12F);
this.lblMsg.Location = new System.Drawing.Point(0, 60);
this.lblMsg.Name = "lblMsg";
this.lblMsg.Padding = new System.Windows.Forms.Padding(20);
this.lblMsg.Size = new System.Drawing.Size(427, 218);
this.lblMsg.TabIndex = 2;
this.lblMsg.Text = "这是一个提示信息。";
//
// lblTitle
//
this.lblTitle.BackColor = System.Drawing.Color.Transparent;
this.lblTitle.Dock = System.Windows.Forms.DockStyle.Top;
this.lblTitle.Font = new System.Drawing.Font("微软雅黑", 17F);
this.lblTitle.Location = new System.Drawing.Point(0, 0);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(427, 60);
this.lblTitle.TabIndex = 0;
this.lblTitle.Text = "提示";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// ucSplitLine_H1
//
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Top;
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 60);
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
this.ucSplitLine_H1.Size = new System.Drawing.Size(427, 1);
this.ucSplitLine_H1.TabIndex = 5;
this.ucSplitLine_H1.TabStop = false;
//
// ucSplitLine_H2
//
this.ucSplitLine_H2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
this.ucSplitLine_H2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ucSplitLine_H2.Location = new System.Drawing.Point(0, 213);
this.ucSplitLine_H2.Name = "ucSplitLine_H2";
this.ucSplitLine_H2.Size = new System.Drawing.Size(427, 1);
this.ucSplitLine_H2.TabIndex = 6;
this.ucSplitLine_H2.TabStop = false;
//
// FrmDialog
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(427, 278);
this.Controls.Add(this.ucSplitLine_H2);
this.Controls.Add(this.ucSplitLine_H1);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.panel1);
this.Controls.Add(this.lblMsg);
this.Controls.Add(this.lblTitle);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.IsFullSize = false;
this.IsShowRegion = true;
this.Name = "FrmDialog";
this.Redraw = true;
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "FrmDialoag";
this.VisibleChanged += new System.EventHandler(this.FrmDialog_VisibleChanged);
this.panel1.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The label title
/// </summary>
private System.Windows.Forms.Label lblTitle;
/// <summary>
/// The BTN ok
/// </summary>
private Controls.UCBtnExt btnOK;
/// <summary>
/// The BTN cancel
/// </summary>
private Controls.UCBtnExt btnCancel;
/// <summary>
/// The label MSG
/// </summary>
private System.Windows.Forms.Label lblMsg;
/// <summary>
/// The panel1
/// </summary>
private System.Windows.Forms.Panel panel1;
/// <summary>
/// The uc split line v1
/// </summary>
private Controls.UCSplitLine_V ucSplitLine_V1;
/// <summary>
/// The BTN close
/// </summary>
private System.Windows.Forms.Panel btnClose;
/// <summary>
/// The table layout panel1
/// </summary>
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
/// <summary>
/// The uc split line h1
/// </summary>
private Controls.UCSplitLine_H ucSplitLine_H1;
/// <summary>
/// The uc split line h2
/// </summary>
private Controls.UCSplitLine_H ucSplitLine_H2;
}
}

View File

@ -0,0 +1,192 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmDialog.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmDialog.
/// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmBase" />
public partial class FrmDialog : FrmBase
{
/// <summary>
/// The BLN enter close
/// </summary>
bool blnEnterClose = true;
/// <summary>
/// Initializes a new instance of the <see cref="FrmDialog" /> class.
/// </summary>
/// <param name="strMessage">The string message.</param>
/// <param name="strTitle">The string title.</param>
/// <param name="blnShowCancel">if set to <c>true</c> [BLN show cancel].</param>
/// <param name="blnShowClose">if set to <c>true</c> [BLN show close].</param>
/// <param name="blnisEnterClose">if set to <c>true</c> [blnis enter close].</param>
private FrmDialog(
string strMessage,
string strTitle,
bool blnShowCancel = false,
bool blnShowClose = false,
bool blnisEnterClose = true)
{
InitializeComponent();
InitFormMove(this.lblTitle);
if (!string.IsNullOrWhiteSpace(strTitle))
lblTitle.Text = strTitle;
lblMsg.Text = strMessage;
if (blnShowCancel)
{
this.tableLayoutPanel1.ColumnStyles[1].Width = 1;
this.tableLayoutPanel1.ColumnStyles[2].Width = 50;
}
else
{
this.tableLayoutPanel1.ColumnStyles[1].Width = 0;
this.tableLayoutPanel1.ColumnStyles[2].Width = 0;
}
//btnCancel.Visible = blnShowCancel;
//ucSplitLine_V1.Visible = blnShowCancel;
btnClose.Visible = blnShowClose;
blnEnterClose = blnisEnterClose;
//if (blnShowCancel)
//{
// btnOK.BtnForeColor = Color.FromArgb(255, 85, 51);
//}
}
#region
/// <summary>
/// 功能描述:显示一个模式信息框
/// 作  者:HZH
/// 创建日期:2019-03-04 15:49:48
/// 任务编号:POS
/// </summary>
/// <param name="owner">owner</param>
/// <param name="strMessage">strMessage</param>
/// <param name="strTitle">strTitle</param>
/// <param name="blnShowCancel">blnShowCancel</param>
/// <param name="isShowMaskDialog">isShowMaskDialog</param>
/// <param name="blnShowClose">blnShowClose</param>
/// <param name="blnIsEnterClose">if set to <c>true</c> [BLN is enter close].</param>
/// <param name="deviationSize">大小偏移,当默认大小过大或过小时,可以进行调整(增量)</param>
/// <returns>返回值</returns>
public static DialogResult ShowDialog(
IWin32Window owner,
string strMessage,
string strTitle = "提示",
bool blnShowCancel = false,
bool isShowMaskDialog = true,
bool blnShowClose = false,
bool blnIsEnterClose = true,
Size? deviationSize = null)
{
DialogResult result = DialogResult.Cancel;
if (owner == null || (owner is Control && (owner as Control).IsDisposed))
{
var frm = new FrmDialog(strMessage, strTitle, blnShowCancel, blnShowClose, blnIsEnterClose)
{
StartPosition = FormStartPosition.CenterScreen,
IsShowMaskDialog = isShowMaskDialog,
TopMost = true
};
if (deviationSize != null)
{
frm.Width += deviationSize.Value.Width;
frm.Height += deviationSize.Value.Height;
}
result = frm.ShowDialog();
}
else
{
if (owner is Control)
{
owner = (owner as Control).FindForm();
}
var frm = new FrmDialog(strMessage, strTitle, blnShowCancel, blnShowClose, blnIsEnterClose)
{
StartPosition = (owner != null) ? FormStartPosition.CenterParent : FormStartPosition.CenterScreen,
IsShowMaskDialog = isShowMaskDialog,
TopMost = true
};
if (deviationSize != null)
{
frm.Width += deviationSize.Value.Width;
frm.Height += deviationSize.Value.Height;
}
result = frm.ShowDialog(owner);
}
return result;
}
#endregion
/// <summary>
/// Handles the BtnClick event of the btnOK control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void btnOK_BtnClick(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
/// <summary>
/// Handles the BtnClick event of the btnCancel control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void btnCancel_BtnClick(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
}
/// <summary>
/// Handles the MouseDown event of the btnClose control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
private void btnClose_MouseDown(object sender, MouseEventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
}
/// <summary>
/// Does the enter.
/// </summary>
protected override void DoEnter()
{
if (blnEnterClose)
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
/// <summary>
/// Handles the VisibleChanged event of the FrmDialog control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void FrmDialog_VisibleChanged(object sender, EventArgs e)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,70 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmInputs.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmInputs.
/// Implements the <see cref="HZH_Controls.Forms.FrmWithOKCancel1" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmWithOKCancel1" />
partial class FrmInputs
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmInputs));
this.SuspendLayout();
//
// FrmInputs
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(427, 310);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmInputs";
this.Text = "FrmInputs";
this.ResumeLayout(false);
}
#endregion
}
}

View File

@ -0,0 +1,171 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmInputs.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HZH_Controls.Controls;
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmInputs.
/// Implements the <see cref="HZH_Controls.Forms.FrmWithOKCancel1" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmWithOKCancel1" />
public partial class FrmInputs : FrmWithOKCancel1
{
/// <summary>
/// Gets the values.
/// </summary>
/// <value>The values.</value>
public string[] Values { get; private set; }
/// <summary>
/// The m mast inputs
/// </summary>
private Dictionary<int, string> m_mastInputs = new Dictionary<int, string>();
#region
/// <summary>
/// 功能描述:构造函数
/// 作  者:HZH
/// 创建日期:2019-08-05 10:57:26
/// 任务编号:POS
/// </summary>
/// <param name="strTitle">窗体标题</param>
/// <param name="inPutLabels">The in put labels.</param>
/// <param name="inTypes">输入项对应输入类型key:输入项名称,如不设置默认不控制输入</param>
/// <param name="regexs">输入项对应正则规则当imTypes=Regex时有效key:输入项名称,如不设置默认不控制输入</param>
/// <param name="keyBoards">文本框键盘key:输入项名称,如不设置默认英文键盘</param>
/// <param name="mastInputs">必填输入项名称</param>
/// <param name="defaultValues">输入项默认值key:输入项名称</param>
/// <exception cref="System.Exception">输入数量不能为空</exception>
/// <exception cref="Exception">输入数量不能为空</exception>
public FrmInputs(
string strTitle,
string[] inPutLabels,
Dictionary<string, TextInputType> inTypes = null,
Dictionary<string, string> regexs = null,
Dictionary<string, HZH_Controls.Controls.KeyBoardType> keyBoards = null,
List<string> mastInputs = null,
Dictionary<string, string> defaultValues = null)
{
InitializeComponent();
this.Title = strTitle;
if (inPutLabels.Length <= 0)
{
throw new Exception("输入数量不能为空");
}
try
{
Values = new string[inPutLabels.Length];
HZH_Controls.ControlHelper.FreezeControl(this, true);
for (int i = inPutLabels.Length - 1; i >= 0; i--)
{
Panel p = new Panel();
p.Dock = DockStyle.Top;
p.Height = 62;
p.Padding = new Padding(10);
HZH_Controls.Controls.UCTextBoxEx txt = new Controls.UCTextBoxEx();
txt.Dock = DockStyle.Fill;
txt.IsShowKeyboard = true;
txt.IsShowClearBtn = true;
txt.Name = "txt_" + i;
txt.TabIndex = i;
if (inTypes != null && inTypes.ContainsKey(inPutLabels[i]))
{
txt.InputType = inTypes[inPutLabels[i]];
if (txt.InputType == TextInputType.Regex && regexs != null && regexs.ContainsKey(inPutLabels[i]))
txt.RegexPattern = regexs[inPutLabels[i]];
}
if (keyBoards != null && keyBoards.ContainsKey(inPutLabels[i]))
txt.KeyBoardType = keyBoards[inPutLabels[i]];
if (mastInputs != null && mastInputs.Contains(inPutLabels[i]))
{
m_mastInputs[i] = inPutLabels[i];
}
if (defaultValues != null && defaultValues.ContainsKey(inPutLabels[i]))
txt.InputText = defaultValues[inPutLabels[i]];
p.Controls.Add(txt);
Label lbl = new Label();
lbl.Text = inPutLabels[i];
lbl.Padding = new System.Windows.Forms.Padding(0, 0, 5, 0);
lbl.TextAlign = ContentAlignment.MiddleRight;
lbl.AutoSize = false;
lbl.Width = 120;
lbl.Dock = DockStyle.Left;
lbl.Font = new System.Drawing.Font("微软雅黑", 12);
p.Controls.Add(lbl);
Label lblT = new Label();
if (mastInputs != null && mastInputs.Contains(inPutLabels[i]))
{
lblT.Text = "*";
}
else
{
lblT.Text = "";
}
lblT.AutoSize = false;
lblT.TextAlign = ContentAlignment.MiddleLeft;
lblT.Width = 25;
lblT.Dock = DockStyle.Right;
lblT.Font = new System.Drawing.Font("微软雅黑", 12);
lblT.ForeColor = Color.Red;
p.Controls.Add(lblT);
this.panel3.Controls.Add(p);
this.ActiveControl = txt;
}
this.Height = 124 + inPutLabels.Length * 62;
}
finally
{
HZH_Controls.ControlHelper.FreezeControl(this, false);
}
}
#endregion
/// <summary>
/// Does the enter.
/// </summary>
protected override void DoEnter()
{
for (int i = 0; i < Values.Length; i++)
{
var cs = this.panel3.Controls.Find("txt_" + i, true);
if (cs.Length > 0)
{
var txt = cs[0] as HZH_Controls.Controls.UCTextBoxEx;
Values[i] = txt.InputText;
if (m_mastInputs.ContainsKey(i) && string.IsNullOrWhiteSpace(txt.InputText))
{
HZH_Controls.Forms.FrmTips.ShowTipsInfo(this, "[" + m_mastInputs[i] + "]必须输入。");
this.ActiveControl = txt.txtInput;
return;
}
}
}
base.DoEnter();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,47 @@
namespace HZH_Controls.Forms
{
partial class FrmLoading
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// FrmLoading
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(396, 322);
this.IsFullSize = false;
this.Name = "FrmLoading";
this.Text = "FrmLoading";
this.Load += new System.EventHandler(this.FrmLoading_Load);
this.ResumeLayout(false);
}
#endregion
}
}

View File

@ -0,0 +1,144 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 2019-09-26
//
// ***********************************************************************
// <copyright file="FrmLoading.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmLoading.
/// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmBase" />
public partial class FrmLoading : FrmBase
{
/// <summary>
/// The update database worker
/// </summary>
BackgroundWorker updateDBWorker = new BackgroundWorker();
/// <summary>
/// 获取或设置加载任务
/// </summary>
/// <value>The background work action.</value>
public Action BackgroundWorkAction
{
get;
set;
}
/// <summary>
/// 设置当前执行进度及任务名称key:任务进度取值0-100 value当前任务名称
/// </summary>
/// <value>The current MSG.</value>
public KeyValuePair<int, string> CurrentMsg
{
set
{
this.updateDBWorker.ReportProgress(value.Key, value.Value);
}
}
/// <summary>
/// Initializes a new instance of the <see cref="FrmLoading"/> class.
/// </summary>
public FrmLoading()
{
InitializeComponent();
this.updateDBWorker.WorkerReportsProgress = true;
this.updateDBWorker.WorkerSupportsCancellation = true;
this.updateDBWorker.DoWork += new DoWorkEventHandler(this.backgroundWorker1_DoWork);
this.updateDBWorker.ProgressChanged += new ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);
}
/// <summary>
/// 设置进度信息,重写此函数可以处理界面信息绑定
/// </summary>
/// <param name="strText">进度任务名称</param>
/// <param name="intValue">进度值</param>
protected virtual void BindingProcessMsg(string strText, int intValue)
{
}
/// <summary>
/// Sets the message.
/// </summary>
/// <param name="strText">The string text.</param>
/// <param name="intValue">The int value.</param>
private void SetMessage(string strText, int intValue)
{
if (this.InvokeRequired)
{
this.BeginInvoke(new MethodInvoker(delegate() { SetMessage(strText, intValue); }));
}
else
{
BindingProcessMsg(strText, intValue);
}
}
/// <summary>
/// Handles the Load event of the FrmLoading control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void FrmLoading_Load(object sender, EventArgs e)
{
if (ControlHelper.IsDesignMode())
return;
this.updateDBWorker.RunWorkerAsync();
}
/// <summary>
/// Handles the DoWork event of the backgroundWorker1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="DoWorkEventArgs"/> instance containing the event data.</param>
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
if (this.BackgroundWorkAction != null)
{
this.BackgroundWorkAction();
}
Thread.Sleep(100);
if (base.InvokeRequired)
{
base.BeginInvoke(new MethodInvoker(delegate
{
base.Close();
}));
}
else
{
base.Close();
}
}
/// <summary>
/// Handles the ProgressChanged event of the backgroundWorker1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="ProgressChangedEventArgs"/> instance containing the event data.</param>
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
SetMessage((e.UserState == null) ? "" : e.UserState.ToString(), e.ProgressPercentage);
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,149 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmTips.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmTips.
/// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmBase" />
partial class FrmTips
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmTips));
this.lblMsg = new System.Windows.Forms.Label();
this.btnClose = new System.Windows.Forms.PictureBox();
this.pctStat = new System.Windows.Forms.PictureBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.btnClose)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pctStat)).BeginInit();
this.SuspendLayout();
//
// lblMsg
//
this.lblMsg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblMsg.BackColor = System.Drawing.Color.Transparent;
this.lblMsg.Font = new System.Drawing.Font("微软雅黑", 12F);
this.lblMsg.Location = new System.Drawing.Point(32, 0);
this.lblMsg.Name = "lblMsg";
this.lblMsg.Size = new System.Drawing.Size(279, 46);
this.lblMsg.TabIndex = 1;
this.lblMsg.Text = "提示信息";
this.lblMsg.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// btnClose
//
this.btnClose.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.btnClose.BackColor = System.Drawing.Color.Transparent;
this.btnClose.Image = global::HZH_Controls.Properties.Resources.qty_delete;
this.btnClose.Location = new System.Drawing.Point(313, 11);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(25, 25);
this.btnClose.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.btnClose.TabIndex = 2;
this.btnClose.TabStop = false;
this.btnClose.MouseDown += new System.Windows.Forms.MouseEventHandler(this.btnClose_MouseDown);
//
// pctStat
//
this.pctStat.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.pctStat.BackColor = System.Drawing.Color.Transparent;
this.pctStat.Image = global::HZH_Controls.Properties.Resources.alarm;
this.pctStat.Location = new System.Drawing.Point(7, 13);
this.pctStat.Name = "pctStat";
this.pctStat.Size = new System.Drawing.Size(20, 20);
this.pctStat.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pctStat.TabIndex = 0;
this.pctStat.TabStop = false;
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// FrmTips
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.ClientSize = new System.Drawing.Size(340, 47);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.lblMsg);
this.Controls.Add(this.pctStat);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.IsFullSize = false;
this.IsShowRegion = true;
this.Name = "FrmTips";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "FrmTips";
this.TopMost = true;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmTips_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmTips_FormClosed);
this.Load += new System.EventHandler(this.FrmTips_Load);
((System.ComponentModel.ISupportInitialize)(this.btnClose)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pctStat)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The PCT stat
/// </summary>
private System.Windows.Forms.PictureBox pctStat;
/// <summary>
/// The label MSG
/// </summary>
private System.Windows.Forms.Label lblMsg;
/// <summary>
/// The BTN close
/// </summary>
private System.Windows.Forms.PictureBox btnClose;
/// <summary>
/// The timer1
/// </summary>
private System.Windows.Forms.Timer timer1;
}
}

View File

@ -0,0 +1,505 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmTips.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Timer = System.Windows.Forms.Timer;
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmTips.
/// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmBase" />
public partial class FrmTips : FrmBase
{
/// <summary>
/// The m show align
/// </summary>
private ContentAlignment m_showAlign = ContentAlignment.BottomLeft;
/// <summary>
/// 显示位置
/// </summary>
/// <value>The show align.</value>
public ContentAlignment ShowAlign
{
get { return m_showAlign; }
set { m_showAlign = value; }
}
/// <summary>
/// The m LST tips
/// </summary>
private static List<FrmTips> m_lstTips = new List<FrmTips>();
/// <summary>
/// The m close time
/// </summary>
private int m_CloseTime = 0;
/// <summary>
/// Gets or sets the close time.
/// </summary>
/// <value>The close time.</value>
public int CloseTime
{
get { return m_CloseTime; }
set
{
m_CloseTime = value;
if (value > 0)
timer1.Interval = value;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="FrmTips" /> class.
/// </summary>
public FrmTips()
{
base.SetStyle(ControlStyles.UserPaint, true);
base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
base.SetStyle(ControlStyles.DoubleBuffer, true);
InitializeComponent();
}
#region
/// <summary>
/// 功能描述:清理提示框
/// 作  者:HZH
/// 创建日期:2019-02-28 15:11:03
/// 任务编号:POS
/// </summary>
public static void ClearTips()
{
for (int i = m_lstTips.Count - 1; i >= 0; i--)
{
FrmTips current = m_lstTips[i];
if (!current.IsDisposed)
{
current.Close();
current.Dispose();
}
}
m_lstTips.Clear();
}
#endregion
/// <summary>
/// 重置倒计时
/// </summary>
public void ResetTimer()
{
if (m_CloseTime > 0)
{
timer1.Enabled = false;
timer1.Enabled = true;
}
}
/// <summary>
/// The m last tips
/// </summary>
private static KeyValuePair<string, FrmTips> m_lastTips = new KeyValuePair<string, FrmTips>();
/// <summary>
/// Shows the tips.
/// </summary>
/// <param name="frm">The FRM.</param>
/// <param name="strMsg">The string MSG.</param>
/// <param name="intAutoColseTime">The int automatic colse time.</param>
/// <param name="blnShowCoseBtn">if set to <c>true</c> [BLN show cose BTN].</param>
/// <param name="align">The align.</param>
/// <param name="point">The point.</param>
/// <param name="mode">The mode.</param>
/// <param name="size">The size.</param>
/// <param name="state">The state.</param>
/// <param name="color">The color.</param>
/// <returns>FrmTips.</returns>
public static FrmTips ShowTips(
Form frm,
string strMsg,
int intAutoColseTime = 0,
bool blnShowCoseBtn = true,
ContentAlignment align = ContentAlignment.BottomLeft,
Point? point = null,
TipsSizeMode mode = TipsSizeMode.Small,
Size? size = null,
TipsState state = TipsState.Default)
{
if (m_lastTips.Key == strMsg + state && !m_lastTips.Value.IsDisposed && m_lastTips.Value.Visible)
{
m_lastTips.Value.ResetTimer();
return m_lastTips.Value;
}
else
{
FrmTips frmTips = new FrmTips();
switch (mode)
{
case TipsSizeMode.Small:
frmTips.Size = new Size(350, 35);
break;
case TipsSizeMode.Medium:
frmTips.Size = new Size(350, 50);
break;
case TipsSizeMode.Large:
frmTips.Size = new Size(350, 65);
break;
case TipsSizeMode.None:
if (!size.HasValue)
{
frmTips.Size = new Size(350, 35);
}
else
{
frmTips.Size = size.Value;
}
break;
}
frmTips.BackColor = Color.FromArgb((int)state);
if (state == TipsState.Default)
{
frmTips.lblMsg.ForeColor = SystemColors.ControlText;
}
else
{
frmTips.lblMsg.ForeColor = Color.White;
}
switch (state)
{
case TipsState.Default:
frmTips.pctStat.Image = HZH_Controls.Properties.Resources.alarm;
break;
case TipsState.Success:
frmTips.pctStat.Image = HZH_Controls.Properties.Resources.success;
break;
case TipsState.Info:
frmTips.pctStat.Image = HZH_Controls.Properties.Resources.alarm;
break;
case TipsState.Warning:
frmTips.pctStat.Image = HZH_Controls.Properties.Resources.warning;
break;
case TipsState.Error:
frmTips.pctStat.Image = HZH_Controls.Properties.Resources.error;
break;
default:
frmTips.pctStat.Image = HZH_Controls.Properties.Resources.alarm;
break;
}
frmTips.lblMsg.Text = strMsg;
frmTips.CloseTime = intAutoColseTime;
frmTips.btnClose.Visible = blnShowCoseBtn;
frmTips.ShowAlign = align;
frmTips.Owner = frm;
FrmTips.m_lstTips.Add(frmTips);
FrmTips.ReshowTips();
frmTips.Show(frm);
if (frm != null && !frm.IsDisposed)
{
ControlHelper.SetForegroundWindow(frm.Handle);
}
//frmTips.BringToFront();
m_lastTips = new KeyValuePair<string, FrmTips>(strMsg + state, frmTips);
return frmTips;
}
}
#region
/// <summary>
/// 功能描述:刷新显示
/// 作  者:HZH
/// 创建日期:2019-02-28 15:33:06
/// 任务编号:POS
/// </summary>
public static void ReshowTips()
{
lock (FrmTips.m_lstTips)
{
FrmTips.m_lstTips.RemoveAll(p => p.IsDisposed == true);
var enumerable = from p in FrmTips.m_lstTips
group p by new
{
p.ShowAlign
};
Screen currentScreen = Screen.PrimaryScreen;
var firstTip = FrmTips.m_lstTips.FirstOrDefault();
if (firstTip != null && firstTip.Owner != null)
{
currentScreen = Screen.FromControl(firstTip.Owner);
}
Size size = currentScreen.Bounds.Size;
foreach (var item in enumerable)
{
List<FrmTips> list = FrmTips.m_lstTips.FindAll((FrmTips p) => p.ShowAlign == item.Key.ShowAlign);
for (int i = 0; i < list.Count; i++)
{
FrmTips frmTips = list[i];
if (frmTips.InvokeRequired)
{
frmTips.BeginInvoke(new MethodInvoker(delegate ()
{
switch (item.Key.ShowAlign)
{
case ContentAlignment.BottomCenter:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, (size.Width - frmTips.Width) / 2, size.Height - 100 - (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.BottomLeft:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, 10, size.Height - 100 - (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.BottomRight:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, size.Width - frmTips.Width - 10, size.Height - 100 - (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.MiddleCenter:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, (size.Width - frmTips.Width) / 2, size.Height - (size.Height - list.Count * (frmTips.Height + 10)) / 2 - (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.MiddleLeft:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, 10, size.Height - (size.Height - list.Count * (frmTips.Height + 10)) / 2 - (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.MiddleRight:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, size.Width - frmTips.Width - 10, size.Height - (size.Height - list.Count * (frmTips.Height + 10)) / 2 - (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.TopCenter:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, (size.Width - frmTips.Width) / 2, 10 + (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.TopLeft:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, 10, 10 + (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.TopRight:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, size.Width - frmTips.Width - 10, 10 + (i + 1) * (frmTips.Height + 10));
break;
default:
break;
}
}));
}
else
{
switch (item.Key.ShowAlign)
{
case ContentAlignment.BottomCenter:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, (size.Width - frmTips.Width) / 2, size.Height - 100 - (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.BottomLeft:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, 10, size.Height - 100 - (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.BottomRight:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, size.Width - frmTips.Width - 10, size.Height - 100 - (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.MiddleCenter:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, (size.Width - frmTips.Width) / 2, size.Height - (size.Height - list.Count * (frmTips.Height + 10)) / 2 - (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.MiddleLeft:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, 10, size.Height - (size.Height - list.Count * (frmTips.Height + 10)) / 2 - (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.MiddleRight:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, size.Width - frmTips.Width - 10, size.Height - (size.Height - list.Count * (frmTips.Height + 10)) / 2 - (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.TopCenter:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, (size.Width - frmTips.Width) / 2, 10 + (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.TopLeft:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, 10, 10 + (i + 1) * (frmTips.Height + 10));
break;
case ContentAlignment.TopRight:
frmTips.Location = ControlHelper.GetScreenLocation(currentScreen, size.Width - frmTips.Width - 10, 10 + (i + 1) * (frmTips.Height + 10));
break;
default:
break;
}
}
}
}
}
}
#endregion
/// <summary>
/// Handles the FormClosing event of the FrmTips control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="FormClosingEventArgs" /> instance containing the event data.</param>
private void FrmTips_FormClosing(object sender, FormClosingEventArgs e)
{
if (m_lastTips.Value == this)
m_lastTips = new KeyValuePair<string, FrmTips>();
m_lstTips.Remove(this);
ReshowTips();
for (int i = Application.OpenForms.Count - 1; i >= 0; i--)
{
if (Application.OpenForms[i].IsDisposed || !Application.OpenForms[i].Visible || Application.OpenForms[i] is FrmTips)
{
continue;
}
else
{
Timer t = new Timer();
t.Interval = 100;
var frm = Application.OpenForms[i];
t.Tick += (a, b) =>
{
t.Enabled = false;
if (!frm.IsDisposed)
ControlHelper.SetForegroundWindow(frm.Handle);
};
t.Enabled = true;
break;
}
}
}
/// <summary>
/// Handles the Load event of the FrmTips control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void FrmTips_Load(object sender, EventArgs e)
{
if (m_CloseTime > 0)
{
this.timer1.Interval = m_CloseTime;
this.timer1.Enabled = true;
}
}
/// <summary>
/// Handles the Tick event of the timer1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void timer1_Tick(object sender, EventArgs e)
{
this.timer1.Enabled = false;
this.Close();
}
/// <summary>
/// Handles the MouseDown event of the btnClose control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="MouseEventArgs" /> instance containing the event data.</param>
private void btnClose_MouseDown(object sender, MouseEventArgs e)
{
this.timer1.Enabled = false;
this.Close();
}
/// <summary>
/// Shows the tips success.
/// </summary>
/// <param name="frm">The FRM.</param>
/// <param name="strMsg">The string MSG.</param>
/// <returns>FrmTips.</returns>
public static FrmTips ShowTipsSuccess(Form frm, string strMsg)
{
return FrmTips.ShowTips(frm, strMsg, 3000, false, ContentAlignment.BottomCenter, null, TipsSizeMode.Large, null, TipsState.Success);
}
/// <summary>
/// Shows the tips error.
/// </summary>
/// <param name="frm">The FRM.</param>
/// <param name="strMsg">The string MSG.</param>
/// <returns>FrmTips.</returns>
public static FrmTips ShowTipsError(Form frm, string strMsg)
{
return FrmTips.ShowTips(frm, strMsg, 3000, false, ContentAlignment.BottomCenter, null, TipsSizeMode.Large, null, TipsState.Error);
}
/// <summary>
/// Shows the tips information.
/// </summary>
/// <param name="frm">The FRM.</param>
/// <param name="strMsg">The string MSG.</param>
/// <returns>FrmTips.</returns>
public static FrmTips ShowTipsInfo(Form frm, string strMsg)
{
return FrmTips.ShowTips(frm, strMsg, 3000, false, ContentAlignment.BottomCenter, null, TipsSizeMode.Large, null, TipsState.Info);
}
/// <summary>
/// Shows the tips warning.
/// </summary>
/// <param name="frm">The FRM.</param>
/// <param name="strMsg">The string MSG.</param>
/// <returns>FrmTips.</returns>
public static FrmTips ShowTipsWarning(Form frm, string strMsg)
{
return FrmTips.ShowTips(frm, strMsg, 3000, false, ContentAlignment.BottomCenter, null, TipsSizeMode.Large, null, TipsState.Warning);
}
/// <summary>
/// Handles the FormClosed event of the FrmTips control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="FormClosedEventArgs" /> instance containing the event data.</param>
private void FrmTips_FormClosed(object sender, FormClosedEventArgs e)
{
this.Dispose();
GC.Collect();
}
}
/// <summary>
/// Enum TipsSizeMode
/// </summary>
public enum TipsSizeMode
{
/// <summary>
/// The small
/// </summary>
Small,
/// <summary>
/// The medium
/// </summary>
Medium,
/// <summary>
/// The large
/// </summary>
Large,
/// <summary>
/// The none
/// </summary>
None
}
/// <summary>
/// Enum TipsState
/// </summary>
public enum TipsState
{
Default = -12542209,
Success = -9977286,
Info = -7299687,
Warning = -693140,
Error = -4194304// - 1097849
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,73 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmTransparent.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmTransparent.
/// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmBase" />
partial class FrmTransparent
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmTransparent));
this.SuspendLayout();
//
// FrmTransparent
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(284, 262);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmTransparent";
this.Opacity = 0.5D;
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "FrmTransparent";
this.Load += new System.EventHandler(this.FrmTransparent_Load);
this.ResumeLayout(false);
}
#endregion
}
}

View File

@ -0,0 +1,175 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmTransparent.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmTransparent.
/// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmBase" />
public partial class FrmTransparent : FrmBase
{
/// <summary>
/// The wm activate
/// </summary>
private const int WM_ACTIVATE = 6;
/// <summary>
/// The wm activateapp
/// </summary>
private const int WM_ACTIVATEAPP = 28;
/// <summary>
/// The wm ncactivate
/// </summary>
private const int WM_NCACTIVATE = 134;
/// <summary>
/// The wa inactive
/// </summary>
private const int WA_INACTIVE = 0;
/// <summary>
/// The wm mouseactivate
/// </summary>
private const int WM_MOUSEACTIVATE = 33;
/// <summary>
/// The ma noactivate
/// </summary>
private const int MA_NOACTIVATE = 3;
/// <summary>
/// Gets the create parameters.
/// </summary>
/// <value>The create parameters.</value>
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED
return cp;
}
}
/// <summary>
/// Gets or sets the frmchild.
/// </summary>
/// <value>The frmchild.</value>
public FrmBase frmchild
{
get;
set;
}
/// <summary>
/// Initializes a new instance of the <see cref="FrmTransparent" /> class.
/// </summary>
public FrmTransparent()
{
InitializeComponent();
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.ResizeRedraw, true);
this.SetStyle(ControlStyles.Selectable, true);
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.SetStyle(ControlStyles.UserPaint, true);
MethodInfo method = base.GetType().GetMethod("SetStyle", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod);
method.Invoke(this, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, new object[]
{
ControlStyles.Selectable,
false
}, Application.CurrentCulture);
}
/// <summary>
/// 引发 <see cref="E:System.Windows.Forms.Form.Load" /> 事件。
/// </summary>
/// <param name="e">一个包含事件数据的 <see cref="T:System.EventArgs" />。</param>
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
base.ShowInTaskbar = false;
base.ShowIcon = true;
}
/// <summary>
/// Sets the active window.
/// </summary>
/// <param name="handle">The handle.</param>
/// <returns>IntPtr.</returns>
[DllImport("user32.dll")]
private static extern IntPtr SetActiveWindow(IntPtr handle);
/// <summary>
/// WNDs the proc.
/// </summary>
/// <param name="m">要处理的 Windows <see cref="T:System.Windows.Forms.Message" />。</param>
protected override void WndProc(ref Message m)
{
if (m.Msg == 33)
{
m.Result = new IntPtr(3);
}
else
{
if (m.Msg == 134)
{
if (((int)m.WParam & 65535) != 0)
{
if (m.LParam != IntPtr.Zero)
{
FrmTransparent.SetActiveWindow(m.LParam);
}
else
{
FrmTransparent.SetActiveWindow(IntPtr.Zero);
}
}
}
else if (m.Msg == 2000)
{
}
base.WndProc(ref m);
}
}
/// <summary>
/// Handles the Load event of the FrmTransparent control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void FrmTransparent_Load(object sender, EventArgs e)
{
if (frmchild != null)
{
frmchild.IsShowMaskDialog = false;
var dia = frmchild.ShowDialog(this);
this.DialogResult = dia;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,162 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmWaiting.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmWaiting.
/// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmBase" />
partial class FrmWaiting
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmWaiting));
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.label1 = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.label2 = new System.Windows.Forms.Label();
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// imageList1
//
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.White;
this.imageList1.Images.SetKeyName(0, "0.png");
this.imageList1.Images.SetKeyName(1, "1.png");
this.imageList1.Images.SetKeyName(2, "2.png");
this.imageList1.Images.SetKeyName(3, "3.png");
this.imageList1.Images.SetKeyName(4, "4.png");
this.imageList1.Images.SetKeyName(5, "5.png");
this.imageList1.Images.SetKeyName(6, "6.png");
this.imageList1.Images.SetKeyName(7, "7.png");
this.imageList1.Images.SetKeyName(8, "8.png");
this.imageList1.Images.SetKeyName(9, "9.png");
this.imageList1.Images.SetKeyName(10, "10.png");
this.imageList1.Images.SetKeyName(11, "11.png");
this.imageList1.Images.SetKeyName(12, "12.png");
this.imageList1.Images.SetKeyName(13, "13.png");
this.imageList1.Images.SetKeyName(14, "14.png");
this.imageList1.Images.SetKeyName(15, "15.png");
this.imageList1.Images.SetKeyName(16, "16.png");
this.imageList1.Images.SetKeyName(17, "17.png");
this.imageList1.Images.SetKeyName(18, "18.png");
this.imageList1.Images.SetKeyName(19, "19.png");
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
this.label1.Image = global::HZH_Controls.Properties.Resources.loading;
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(276, 196);
this.label1.TabIndex = 0;
//
// timer1
//
this.timer1.Interval = 20;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// label2
//
this.label2.Dock = System.Windows.Forms.DockStyle.Top;
this.label2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.label2.Location = new System.Drawing.Point(0, 196);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(276, 30);
this.label2.TabIndex = 1;
this.label2.Text = "处理正在进行中,请稍候...";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// timer2
//
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
//
// FrmWaiting
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.ClientSize = new System.Drawing.Size(276, 244);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.IsFullSize = false;
this.Name = "FrmWaiting";
this.Opacity = 0D;
this.RegionRadius = 20;
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "";
this.TopMost = true;
this.TransparencyKey = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.VisibleChanged += new System.EventHandler(this.FrmWaiting_VisibleChanged);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The image list1
/// </summary>
private System.Windows.Forms.ImageList imageList1;
/// <summary>
/// The label1
/// </summary>
private System.Windows.Forms.Label label1;
/// <summary>
/// The timer1
/// </summary>
private System.Windows.Forms.Timer timer1;
/// <summary>
/// The label2
/// </summary>
private System.Windows.Forms.Label label2;
/// <summary>
/// The timer2
/// </summary>
private System.Windows.Forms.Timer timer2;
}
}

View File

@ -0,0 +1,109 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmWaiting.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmWaiting.
/// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmBase" />
public partial class FrmWaiting : FrmBase
{
/// <summary>
/// Gets or sets the MSG.
/// </summary>
/// <value>The MSG.</value>
public string Msg { get { return label2.Text; } set { label2.Text = value; } }
/// <summary>
/// Initializes a new instance of the <see cref="FrmWaiting" /> class.
/// </summary>
public FrmWaiting()
{
base.SetStyle(ControlStyles.UserPaint, true);
base.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
base.SetStyle(ControlStyles.DoubleBuffer, true);
InitializeComponent();
}
/// <summary>
/// Handles the Tick event of the timer1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void timer1_Tick(object sender, EventArgs e)
{
if (this.label1.ImageIndex == this.imageList1.Images.Count - 1)
this.label1.ImageIndex = 0;
else
this.label1.ImageIndex++;
}
/// <summary>
/// Handles the VisibleChanged event of the FrmWaiting control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void FrmWaiting_VisibleChanged(object sender, EventArgs e)
{
//this.timer1.Enabled = this.Visible;
}
/// <summary>
/// Does the escape.
/// </summary>
protected override void DoEsc()
{
}
/// <summary>
/// Handles the Tick event of the timer2 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void timer2_Tick(object sender, EventArgs e)
{
base.Opacity = 1.0;
this.timer2.Enabled = false;
}
/// <summary>
/// Shows the form.
/// </summary>
/// <param name="intSleep">The int sleep.</param>
public void ShowForm(int intSleep = 1)
{
base.Opacity = 0.0;
if (intSleep <= 0)
{
intSleep = 1;
}
base.Show();
this.timer2.Interval = intSleep;
this.timer2.Enabled = true;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,210 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmWithOKCancel1.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmWithOKCancel1.
/// Implements the <see cref="HZH_Controls.Forms.FrmWithTitle" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmWithTitle" />
partial class FrmWithOKCancel1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmWithOKCancel1));
this.btnOK = new HZH_Controls.Controls.UCBtnExt();
this.btnCancel = new HZH_Controls.Controls.UCBtnExt();
this.panel3 = new System.Windows.Forms.Panel();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.ucSplitLine_V1 = new HZH_Controls.Controls.UCSplitLine_V();
this.ucSplitLine_H2 = new HZH_Controls.Controls.UCSplitLine_H();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.BackColor = System.Drawing.Color.Transparent;
this.btnOK.BtnBackColor = System.Drawing.Color.Transparent;
this.btnOK.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOK.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(85)))), ((int)(((byte)(51)))));
this.btnOK.BtnText = "确定";
this.btnOK.ConerRadius = 5;
this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOK.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnOK.FillColor = System.Drawing.Color.White;
this.btnOK.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnOK.IsRadius = false;
this.btnOK.IsShowRect = false;
this.btnOK.IsShowTips = false;
this.btnOK.Location = new System.Drawing.Point(0, 0);
this.btnOK.Margin = new System.Windows.Forms.Padding(0);
this.btnOK.Name = "btnOK";
this.btnOK.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnOK.RectWidth = 1;
this.btnOK.Size = new System.Drawing.Size(213, 62);
this.btnOK.TabIndex = 0;
this.btnOK.TabStop = false;
this.btnOK.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99)))));
this.btnOK.TipsText = "";
this.btnOK.BtnClick += new System.EventHandler(this.btnOK_BtnClick);
//
// btnCancel
//
this.btnCancel.BackColor = System.Drawing.Color.Transparent;
this.btnCancel.BtnBackColor = System.Drawing.Color.Transparent;
this.btnCancel.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(73)))), ((int)(((byte)(119)))), ((int)(((byte)(232)))));
this.btnCancel.BtnText = "取消";
this.btnCancel.ConerRadius = 5;
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancel.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnCancel.FillColor = System.Drawing.Color.White;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnCancel.IsRadius = false;
this.btnCancel.IsShowRect = false;
this.btnCancel.IsShowTips = false;
this.btnCancel.Location = new System.Drawing.Point(214, 0);
this.btnCancel.Margin = new System.Windows.Forms.Padding(0);
this.btnCancel.Name = "btnCancel";
this.btnCancel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnCancel.RectWidth = 1;
this.btnCancel.Size = new System.Drawing.Size(213, 62);
this.btnCancel.TabIndex = 1;
this.btnCancel.TabStop = false;
this.btnCancel.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99)))));
this.btnCancel.TipsText = "";
this.btnCancel.BtnClick += new System.EventHandler(this.btnCancel_BtnClick);
//
// panel3
//
this.panel3.BackColor = System.Drawing.Color.White;
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(0, 61);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(427, 186);
this.panel3.TabIndex = 5;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.BackColor = System.Drawing.Color.Transparent;
this.tableLayoutPanel1.ColumnCount = 3;
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.Absolute, 1F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.ucSplitLine_V1, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.btnOK, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.btnCancel, 2, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 248);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(427, 62);
this.tableLayoutPanel1.TabIndex = 2;
//
// ucSplitLine_V1
//
this.ucSplitLine_V1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
this.ucSplitLine_V1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ucSplitLine_V1.Location = new System.Drawing.Point(213, 15);
this.ucSplitLine_V1.Margin = new System.Windows.Forms.Padding(0, 15, 0, 15);
this.ucSplitLine_V1.Name = "ucSplitLine_V1";
this.ucSplitLine_V1.Size = new System.Drawing.Size(1, 32);
this.ucSplitLine_V1.TabIndex = 0;
this.ucSplitLine_V1.TabStop = false;
//
// ucSplitLine_H2
//
this.ucSplitLine_H2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
this.ucSplitLine_H2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ucSplitLine_H2.Location = new System.Drawing.Point(0, 247);
this.ucSplitLine_H2.Name = "ucSplitLine_H2";
this.ucSplitLine_H2.Size = new System.Drawing.Size(427, 1);
this.ucSplitLine_H2.TabIndex = 0;
this.ucSplitLine_H2.TabStop = false;
//
// FrmWithOKCancel1
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(427, 310);
this.Controls.Add(this.panel3);
this.Controls.Add(this.ucSplitLine_H2);
this.Controls.Add(this.tableLayoutPanel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmWithOKCancel1";
this.Text = "FrmWithOKCancel";
this.VisibleChanged += new System.EventHandler(this.FrmWithOKCancel1_VisibleChanged);
this.Controls.SetChildIndex(this.tableLayoutPanel1, 0);
this.Controls.SetChildIndex(this.ucSplitLine_H2, 0);
this.Controls.SetChildIndex(this.panel3, 0);
this.tableLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The BTN ok
/// </summary>
private Controls.UCBtnExt btnOK;
/// <summary>
/// The BTN cancel
/// </summary>
private Controls.UCBtnExt btnCancel;
/// <summary>
/// The panel3
/// </summary>
public System.Windows.Forms.Panel panel3;
/// <summary>
/// The table layout panel1
/// </summary>
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
/// <summary>
/// The uc split line h2
/// </summary>
private Controls.UCSplitLine_H ucSplitLine_H2;
/// <summary>
/// The uc split line v1
/// </summary>
private Controls.UCSplitLine_V ucSplitLine_V1;
}
}

View File

@ -0,0 +1,81 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmWithOKCancel1.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmWithOKCancel1.
/// Implements the <see cref="HZH_Controls.Forms.FrmWithTitle" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmWithTitle" />
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(System.ComponentModel.Design.IDesigner))]
public partial class FrmWithOKCancel1 : FrmWithTitle
{
/// <summary>
/// Initializes a new instance of the <see cref="FrmWithOKCancel1" /> class.
/// </summary>
public FrmWithOKCancel1()
{
InitializeComponent();
}
/// <summary>
/// Handles the BtnClick event of the btnOK control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void btnOK_BtnClick(object sender, EventArgs e)
{
DoEnter();
}
/// <summary>
/// Handles the BtnClick event of the btnCancel control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void btnCancel_BtnClick(object sender, EventArgs e)
{
DoEsc();
}
/// <summary>
/// Does the enter.
/// </summary>
protected override void DoEnter()
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
/// <summary>
/// Handles the VisibleChanged event of the FrmWithOKCancel1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void FrmWithOKCancel1_VisibleChanged(object sender, EventArgs e)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,255 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmWithOKCancel2.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmWithOKCancel2.
/// Implements the <see cref="HZH_Controls.Forms.FrmWithTitle" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmWithTitle" />
partial class FrmWithOKCancel2
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmWithOKCancel2));
this.panel2 = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel();
this.panel5 = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel();
this.ucSplitLine_V1 = new HZH_Controls.Controls.UCSplitLine_V();
this.btnOK = new HZH_Controls.Controls.UCBtnExt();
this.btnCancel = new HZH_Controls.Controls.UCBtnExt();
this.panel3 = new System.Windows.Forms.Panel();
this.ucSplitLine_H2 = new HZH_Controls.Controls.UCSplitLine_H();
this.panel2.SuspendLayout();
this.panel4.SuspendLayout();
this.panel5.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Transparent;
this.panel2.Controls.Add(this.panel4);
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel2.Location = new System.Drawing.Point(0, 246);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(427, 64);
this.panel2.TabIndex = 5;
//
// panel4
//
this.panel4.BackColor = System.Drawing.Color.Transparent;
this.panel4.Controls.Add(this.panel5);
this.panel4.Dock = System.Windows.Forms.DockStyle.Right;
this.panel4.Location = new System.Drawing.Point(227, 0);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(200, 64);
this.panel4.TabIndex = 0;
//
// panel5
//
this.panel5.BackColor = System.Drawing.Color.Transparent;
this.panel5.Controls.Add(this.panel1);
this.panel5.Controls.Add(this.btnOK);
this.panel5.Controls.Add(this.btnCancel);
this.panel5.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel5.Location = new System.Drawing.Point(0, 0);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(200, 64);
this.panel5.TabIndex = 5;
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Controls.Add(this.ucSplitLine_V1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Right;
this.panel1.Location = new System.Drawing.Point(99, 0);
this.panel1.Name = "panel1";
this.panel1.Padding = new System.Windows.Forms.Padding(0, 15, 0, 15);
this.panel1.Size = new System.Drawing.Size(1, 64);
this.panel1.TabIndex = 1;
//
// ucSplitLine_V1
//
this.ucSplitLine_V1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(232)))), ((int)(((byte)(232)))));
this.ucSplitLine_V1.Dock = System.Windows.Forms.DockStyle.Right;
this.ucSplitLine_V1.Location = new System.Drawing.Point(0, 15);
this.ucSplitLine_V1.Name = "ucSplitLine_V1";
this.ucSplitLine_V1.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10);
this.ucSplitLine_V1.Size = new System.Drawing.Size(1, 34);
this.ucSplitLine_V1.TabIndex = 2;
this.ucSplitLine_V1.TabStop = false;
//
// btnOK
//
this.btnOK.BackColor = System.Drawing.Color.Transparent;
this.btnOK.BtnBackColor = System.Drawing.Color.Transparent;
this.btnOK.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOK.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(77)))), ((int)(((byte)(59)))));
this.btnOK.BtnText = "确定";
this.btnOK.ConerRadius = 5;
this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOK.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnOK.FillColor = System.Drawing.Color.White;
this.btnOK.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnOK.IsRadius = false;
this.btnOK.IsShowRect = false;
this.btnOK.IsShowTips = false;
this.btnOK.Location = new System.Drawing.Point(0, 0);
this.btnOK.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btnOK.Name = "btnOK";
this.btnOK.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnOK.RectWidth = 1;
this.btnOK.Size = new System.Drawing.Size(100, 64);
this.btnOK.TabIndex = 0;
this.btnOK.TabStop = false;
this.btnOK.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99)))));
this.btnOK.TipsText = "";
this.btnOK.BtnClick += new System.EventHandler(this.btnOK_BtnClick);
//
// btnCancel
//
this.btnCancel.BackColor = System.Drawing.Color.Transparent;
this.btnCancel.BtnBackColor = System.Drawing.Color.Transparent;
this.btnCancel.BtnFont = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.BtnForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(73)))), ((int)(((byte)(119)))), ((int)(((byte)(232)))));
this.btnCancel.BtnText = "取消";
this.btnCancel.ConerRadius = 5;
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancel.Dock = System.Windows.Forms.DockStyle.Right;
this.btnCancel.FillColor = System.Drawing.Color.White;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.btnCancel.IsRadius = false;
this.btnCancel.IsShowRect = false;
this.btnCancel.IsShowTips = false;
this.btnCancel.Location = new System.Drawing.Point(100, 0);
this.btnCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btnCancel.Name = "btnCancel";
this.btnCancel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnCancel.RectWidth = 1;
this.btnCancel.Size = new System.Drawing.Size(100, 64);
this.btnCancel.TabIndex = 1;
this.btnCancel.TabStop = false;
this.btnCancel.TipsColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(30)))), ((int)(((byte)(99)))));
this.btnCancel.TipsText = "";
this.btnCancel.BtnClick += new System.EventHandler(this.btnCancel_BtnClick);
//
// panel3
//
this.panel3.BackColor = System.Drawing.Color.White;
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(0, 61);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(427, 185);
this.panel3.TabIndex = 6;
//
// ucSplitLine_H2
//
this.ucSplitLine_H2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
this.ucSplitLine_H2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ucSplitLine_H2.Location = new System.Drawing.Point(0, 245);
this.ucSplitLine_H2.Name = "ucSplitLine_H2";
this.ucSplitLine_H2.Size = new System.Drawing.Size(427, 1);
this.ucSplitLine_H2.TabIndex = 7;
this.ucSplitLine_H2.TabStop = false;
//
// FrmWithOKCancel2
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(427, 310);
this.Controls.Add(this.ucSplitLine_H2);
this.Controls.Add(this.panel3);
this.Controls.Add(this.panel2);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmWithOKCancel2";
this.Text = "FrmWithOKCancel2";
this.VisibleChanged += new System.EventHandler(this.FrmWithOKCancel2_VisibleChanged);
this.Controls.SetChildIndex(this.panel2, 0);
this.Controls.SetChildIndex(this.panel3, 0);
this.Controls.SetChildIndex(this.ucSplitLine_H2, 0);
this.panel2.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.panel5.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The panel4
/// </summary>
private System.Windows.Forms.Panel panel4;
/// <summary>
/// The panel5
/// </summary>
private System.Windows.Forms.Panel panel5;
/// <summary>
/// The uc split line v1
/// </summary>
private Controls.UCSplitLine_V ucSplitLine_V1;
/// <summary>
/// The BTN ok
/// </summary>
private Controls.UCBtnExt btnOK;
/// <summary>
/// The BTN cancel
/// </summary>
private Controls.UCBtnExt btnCancel;
/// <summary>
/// The panel3
/// </summary>
public System.Windows.Forms.Panel panel3;
/// <summary>
/// The panel2
/// </summary>
public System.Windows.Forms.Panel panel2;
/// <summary>
/// The panel1
/// </summary>
private System.Windows.Forms.Panel panel1;
/// <summary>
/// The uc split line h2
/// </summary>
private Controls.UCSplitLine_H ucSplitLine_H2;
}
}

View File

@ -0,0 +1,81 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmWithOKCancel2.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmWithOKCancel2.
/// Implements the <see cref="HZH_Controls.Forms.FrmWithTitle" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmWithTitle" />
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(System.ComponentModel.Design.IDesigner))]
public partial class FrmWithOKCancel2 : FrmWithTitle
{
/// <summary>
/// Initializes a new instance of the <see cref="FrmWithOKCancel2" /> class.
/// </summary>
public FrmWithOKCancel2()
{
InitializeComponent();
}
/// <summary>
/// Handles the BtnClick event of the btnOK control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void btnOK_BtnClick(object sender, EventArgs e)
{
DoEnter();
}
/// <summary>
/// Handles the BtnClick event of the btnCancel control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void btnCancel_BtnClick(object sender, EventArgs e)
{
DoEsc();
}
/// <summary>
/// Does the enter.
/// </summary>
protected override void DoEnter()
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
/// <summary>
/// Handles the VisibleChanged event of the FrmWithOKCancel2 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void FrmWithOKCancel2_VisibleChanged(object sender, EventArgs e)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,131 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmWithTitle.Designer.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmWithTitle.
/// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmBase" />
partial class FrmWithTitle
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmWithTitle));
this.lblTitle = new System.Windows.Forms.Label();
this.ucSplitLine_H1 = new HZH_Controls.Controls.UCSplitLine_H();
this.btnClose = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// lblTitle
//
this.lblTitle.BackColor = System.Drawing.Color.Transparent;
this.lblTitle.Dock = System.Windows.Forms.DockStyle.Top;
this.lblTitle.Font = new System.Drawing.Font("微软雅黑", 17F);
this.lblTitle.Location = new System.Drawing.Point(0, 0);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(427, 60);
this.lblTitle.TabIndex = 5;
this.lblTitle.Text = "标题";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// ucSplitLine_H1
//
this.ucSplitLine_H1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(238)))), ((int)(((byte)(238)))), ((int)(((byte)(238)))));
this.ucSplitLine_H1.Dock = System.Windows.Forms.DockStyle.Top;
this.ucSplitLine_H1.Location = new System.Drawing.Point(0, 60);
this.ucSplitLine_H1.Name = "ucSplitLine_H1";
this.ucSplitLine_H1.Size = new System.Drawing.Size(427, 1);
this.ucSplitLine_H1.TabIndex = 0;
this.ucSplitLine_H1.TabStop = false;
//
// btnClose
//
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.BackgroundImage = global::HZH_Controls.Properties.Resources.dialog_close;
this.btnClose.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.btnClose.Location = new System.Drawing.Point(399, 0);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(28, 60);
this.btnClose.TabIndex = 6;
this.btnClose.Visible = false;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// FrmWithTitle
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(427, 310);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.ucSplitLine_H1);
this.Controls.Add(this.lblTitle);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.IsFullSize = false;
this.IsShowMaskDialog = true;
this.IsShowRegion = true;
this.Name = "FrmWithTitle";
this.Redraw = true;
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "FrmWithTitle";
this.Shown += new System.EventHandler(this.FrmWithTitle_Shown);
this.SizeChanged += new System.EventHandler(this.FrmWithTitle_SizeChanged);
this.VisibleChanged += new System.EventHandler(this.FrmWithTitle_VisibleChanged);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The label title
/// </summary>
private System.Windows.Forms.Label lblTitle;
/// <summary>
/// The uc split line h1
/// </summary>
private Controls.UCSplitLine_H ucSplitLine_H1;
/// <summary>
/// The BTN close
/// </summary>
private System.Windows.Forms.Panel btnClose;
}
}

View File

@ -0,0 +1,122 @@
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
// <copyright file="FrmWithTitle.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHubhttps://github.com/kwwwvagaa/NetWinformControl
// giteehttps://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Forms
{
/// <summary>
/// Class FrmWithTitle.
/// Implements the <see cref="HZH_Controls.Forms.FrmBase" />
/// </summary>
/// <seealso cref="HZH_Controls.Forms.FrmBase" />
[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(System.ComponentModel.Design.IDesigner))]
public partial class FrmWithTitle : FrmBase
{
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>The title.</value>
[Description("窗体标题"), Category("自定义")]
public string Title
{
get
{
return lblTitle.Text;
}
set
{
lblTitle.Text = value;
}
}
/// <summary>
/// The is show close BTN
/// </summary>
private bool _isShowCloseBtn = false;
/// <summary>
/// Gets or sets a value indicating whether this instance is show close BTN.
/// </summary>
/// <value><c>true</c> if this instance is show close BTN; otherwise, <c>false</c>.</value>
[Description("是否显示右上角关闭按钮"), Category("自定义")]
public bool IsShowCloseBtn
{
get
{
return _isShowCloseBtn;
}
set
{
_isShowCloseBtn = value;
btnClose.Visible = value;
if (value)
{
btnClose.Location = new Point(this.Width - btnClose.Width - 10, 0);
btnClose.BringToFront();
}
}
}
/// <summary>
/// Initializes a new instance of the <see cref="FrmWithTitle" /> class.
/// </summary>
public FrmWithTitle()
{
InitializeComponent();
InitFormMove(this.lblTitle);
}
/// <summary>
/// Handles the Shown event of the FrmWithTitle control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void FrmWithTitle_Shown(object sender, EventArgs e)
{
if (IsShowCloseBtn)
{
btnClose.Location = new Point(this.Width - btnClose.Width - 10, 0);
btnClose.BringToFront();
}
}
/// <summary>
/// Handles the VisibleChanged event of the FrmWithTitle control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
private void FrmWithTitle_VisibleChanged(object sender, EventArgs e)
{
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void FrmWithTitle_SizeChanged(object sender, EventArgs e)
{
btnClose.Location = new Point(this.Width - btnClose.Width, btnClose.Location.Y);
}
}
}

File diff suppressed because it is too large Load Diff