📄 buttonsubclass.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace gowk.utility.skin.subclass
{
/// <summary>
/// ButtonSubClass 的摘要说明。
/// </summary>
public class ButtonSubClass:SubClassBase
{
Button btn;
ButtonState state=ButtonState.Normal;
public ButtonSubClass(IntPtr hwnd):base(hwnd)
{
this.btn=(Button)Control.FromHandle(hwnd);
this.btn.MouseDown+=new MouseEventHandler(btn_MouseDown);
this.btn.MouseEnter+=new EventHandler(btn_MouseEnter);
this.btn.MouseHover+=new EventHandler(btn_MouseHover);
this.btn.MouseMove+=new MouseEventHandler(btn_MouseMove);
this.btn.MouseUp+=new MouseEventHandler(btn_MouseUp);
this.btn.MouseLeave+=new EventHandler(btn_MouseLeave);
this.btn.Paint+=new PaintEventHandler(btn_Paint);
}
private void btn_Paint(object sender, PaintEventArgs e)
{
}
private void btn_MouseDown(object sender, MouseEventArgs e)
{
}
private void btn_MouseEnter(object sender, EventArgs e)
{
}
private void btn_MouseHover(object sender, EventArgs e)
{
}
private void btn_MouseMove(object sender, MouseEventArgs e)
{
}
private void btn_MouseUp(object sender, MouseEventArgs e)
{
}
private void btn_MouseLeave(object sender, EventArgs e)
{
}
protected override void WMERASEBKGND(ref Message m)
{
this.btn.CreateGraphics().DrawString("sssss",this.btn.Font,new SolidBrush(Color.Red),btn.ClientRectangle);
base.WMERASEBKGND (ref m);
}
protected override void WMPAINT(ref Message m)
{
base.WMPAINT (ref m);
this.btn.CreateGraphics().DrawString("sssss",this.btn.Font,new SolidBrush(Color.Red),btn.ClientRectangle);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -