buttonsubclass.cs
来自「语音视频功能 里面实现了基本的QQ与语音对话」· CS 代码 · 共 78 行
CS
78 行
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 + =
减小字号Ctrl + -
显示快捷键?