Commit 419b527d HZH

Revert "移动窗体"

This reverts commit 3f45e622.
1 个父辈 f27f1d76
...@@ -37,7 +37,6 @@ namespace HZH_Controls.Forms ...@@ -37,7 +37,6 @@ namespace HZH_Controls.Forms
public FrmBack() public FrmBack()
{ {
InitializeComponent(); InitializeComponent();
InitFormMove(this.panTop);
} }
private void btnBack1_btnClick(object sender, EventArgs e) private void btnBack1_btnClick(object sender, EventArgs e)
......
...@@ -10,7 +10,6 @@ using System.Data; ...@@ -10,7 +10,6 @@ using System.Data;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
...@@ -290,7 +289,7 @@ namespace HZH_Controls.Forms ...@@ -290,7 +289,7 @@ namespace HZH_Controls.Forms
protected virtual void DoEnter() protected virtual void DoEnter()
{ {
} }
/// <summary> /// <summary>
/// 设置重绘区域 /// 设置重绘区域
/// </summary> /// </summary>
...@@ -359,7 +358,7 @@ namespace HZH_Controls.Forms ...@@ -359,7 +358,7 @@ namespace HZH_Controls.Forms
#region 事件区 #region 事件区
/// <summary> /// <summary>
/// 关闭时发生 /// 关闭时发生
/// </summary> /// </summary>
...@@ -372,7 +371,7 @@ namespace HZH_Controls.Forms ...@@ -372,7 +371,7 @@ namespace HZH_Controls.Forms
(base.Owner as FrmTransparent).Close(); (base.Owner as FrmTransparent).Close();
} }
} }
/// <summary> /// <summary>
/// 快捷键 /// 快捷键
/// </summary> /// </summary>
...@@ -467,44 +466,5 @@ namespace HZH_Controls.Forms ...@@ -467,44 +466,5 @@ namespace HZH_Controls.Forms
} }
#endregion #endregion
#region 窗体拖动 English:Form drag
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_MOVE = 0xF010;
public const int HTCAPTION = 0x0002;
/// <summary>
/// 通过Windows的API控制窗体的拖动
/// </summary>
/// <param name="hwnd"></param>
public static void MouseDown(IntPtr hwnd)
{
ReleaseCapture();
SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
}
#endregion
/// <summary>
/// 在构造函数中调用设置窗体移动
/// </summary>
/// <param name="c">拖动控件,一般为标题栏</param>
protected void InitFormMove(params Control[] cs)
{
foreach (Control c in cs)
{
if (c != null && !c.IsDisposed)
c.MouseDown += c_MouseDown;
}
}
void c_MouseDown(object sender, MouseEventArgs e)
{
MouseDown(this.Handle);
}
} }
} }
...@@ -25,7 +25,6 @@ namespace HZH_Controls.Forms ...@@ -25,7 +25,6 @@ namespace HZH_Controls.Forms
bool blnisEnterClose = true) bool blnisEnterClose = true)
{ {
InitializeComponent(); InitializeComponent();
InitFormMove(this.lblTitle);
if (!string.IsNullOrWhiteSpace(strTitle)) if (!string.IsNullOrWhiteSpace(strTitle))
lblTitle.Text = strTitle; lblTitle.Text = strTitle;
lblMsg.Text = strMessage; lblMsg.Text = strMessage;
......
...@@ -52,7 +52,6 @@ namespace HZH_Controls.Forms ...@@ -52,7 +52,6 @@ namespace HZH_Controls.Forms
public FrmWithTitle() public FrmWithTitle()
{ {
InitializeComponent(); InitializeComponent();
InitFormMove(this.lblTitle);
} }
private void btnClose_MouseDown(object sender, MouseEventArgs e) private void btnClose_MouseDown(object sender, MouseEventArgs e)
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace HZH_Controls
{
public interface ITheme
{
/// <summary>
/// 重置主题
/// </summary>
/// <param name="theme"></param>
void ResetTheme(ThemeEntity theme);
/// <summary>
/// 是否禁用一键换肤,默认禁用
/// </summary>
bool EnabledTheme { get; set; }
}
public class ThemeEntity
{
/// <summary>
/// 边框颜色
/// </summary>
public Color? BorderColor { get; set; }
/// <summary>
/// 填充颜色
/// </summary>
public Color? FillColor { get; set; }
/// <summary>
/// 背景色
/// </summary>
public Color? BackColor { get; set; }
/// <summary>
/// 前景色
/// </summary>
public Color? ForeColor { get; set; }
/// <summary>
/// 字体颜色
/// </summary>
public Color? FontColor { get; set; }
/// <summary>
/// 选中颜色
/// </summary>
public Color? SelectedColor { get; set; }
/// <summary>
/// 选中字体颜色
/// </summary>
public Color? SelectedFontColor { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HZH_Controls.Theme
{
public enum ThemeTypes
{
Default,
Blue
}
}
当你需要使用主题时,请按照以下步骤处理:
1、请添加主题类,比如Blue,然后继承抽象类ThemeBase并实现它
2、在ThemeTypes中添加对应的枚举,比如Blue
3、在需要做主题控制的窗体上,添加UCTheme控件,然后选择主题
如果你需要在已有的主题上对其他控件进行主题控制的时候,比如在Blue主题的基础上,对一个名称为panTop的panel进行设置背景色,请按照以下步骤处理:
1、添加一个类BlueExt(这个名字随意)
2、修改类名称为Blue并添加关键字partial
3、重写CustomControlTheme函数,在CustomControlTheme函数中对panTop修改颜色
----------------------
When you need to use a theme, follow these steps:
1, please add a theme class, such as Blue, and then inherit the abstract class ThemeBase and implement it
2. Add the corresponding enumeration in ThemeTypes, such as Blue.
3. On the form that needs to do the theme control, add the UCTheme control, then select the theme.
If you need to control the theme of other controls on an existing theme, such as setting the background color for a panel named panTop based on the Blue theme, follow these steps:
1, add a class BlueExt (this name is free)
2, modify the class name to Blue and add the keyword partial
3, rewrite the CustomControlTheme function, modify the color of the panTop in the CustomControlTheme function
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!