C#仿QQ皮肤-ComboBox 控件实现
2010-09-30 22:44:29 来源:WEB开发网有了这些我们现在要做的就是在OnMouseEnter事件OnMouseLeave事件里处理一下绘制的效果和参数就算是完工了
我们一起来看看这两个事件的处理方法吧
protected override void OnMouseEnter(EventArgs e)
{
_mouseEnter = true;
IntPtr hDC = IntPtr.Zero;
Graphics gdc = null;
hDC = Win32.GetWindowDC(this.Handle);
gdc = Graphics.FromHdc(hDC);
gdc.DrawImage(Shared.MouseMoveDrawButton, new Rectangle(this.Width - 20, 3, 16, 16));
Win32.ReleaseDC(this.Handle, hDC);
gdc.Dispose();
base.OnMouseEnter(e);
}
protected override void OnMouseLeave(EventArgs e)
{
_mouseEnter = false;
IntPtr hDC = IntPtr.Zero;
Graphics gdc = null;
hDC = Win32.GetWindowDC(this.Handle);
gdc = Graphics.FromHdc(hDC);
gdc.DrawImage(Shared.NomalDrawButton, new Rectangle(this.Width - 20, 3, 16, 16));
Win32.ReleaseDC(this.Handle, hDC);
base.OnMouseLeave(e);
}
更多精彩
赞助商链接