有没有办法检查鼠标何时高于标准窗口控制按钮(关闭,最小化等)?

当鼠标位于标准窗口控件之一(关闭,最小化,最大化)时,我想运行一个方法。 我怎么做?

我在谈论这些

你可以用这个:

internal const int WM_NCMOUSEMOVE = 0x00A0; protected override void WndProc(ref Message m) { if (m.Msg == WM_NCMOUSEMOVE) { if ((int)m.WParam == 0x8) Console.WriteLine("Mouse over on Minimize button"); if ((int)m.WParam == 0x9) Console.WriteLine("Mouse over on Maximize button"); if ((int)m.WParam == 0x14) Console.WriteLine("Mouse over on Close button"); } base.WndProc(ref m); } 

把它放在你的表单代码中。

是的,您可以在触发MouseHover事件时使用工具提示控制按钮。

VB代码……

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.MouseHover ToolTip1.SetToolTip(Button1, "sometext") End Sub 

这是一些更多的信息。 希望能帮助到你。 http://bytes.com/topic/visual-basic-net/answers/683286-hover-text-command-buttons

您也可以使用此自定义用户控件。检查这是否适合您。 http://www.codeproject.com/Articles/42223/Easy-Customize-Title-Bar

如果没有太多控件,请在控件事件上向鼠标添加事件处理程序。