在Windows 7中,只需将鼠标悬停在窗口上即可将焦点放在窗口上。默认情况下不启用此功能,但您可以在“控制面板”中启用它。 (这是要走的路:
[轻松访问中心 - >让鼠标更易于使用 - >检查“用鼠标悬停在窗口上激活窗口”]。
我非常喜欢这个功能,但有时当我尝试使用Resharper在Visual Studio中打开一个C#类时,它会让我很烦。我将按CTRL + N并键入我想要查看的类的名称(例如,“MyWpfClass”)。然后,Resharper将显示“MyWpfClass”顶部的建议下拉列表。我点击返回,现在Resharper打开一个下拉列表,让我在“MyWpfClass.xaml”和“MyWpfClass.xaml.cs”之间进行选择。但是,如果鼠标光标位于错误的位置,则下拉菜单会在一秒钟内关闭,然后我会回到原点。有没有办法解决这个问题,而无需关闭焦点跟随鼠标功能?
答案 0 :(得分:1)
我遇到了与MS Outlook相同的问题:联系人的自动建议列表会自动关闭,因为Windows将其视为窗口而不是新消息窗口的一部分。
您可以使用NiftyWindows,它具有相同的选项" Focus Follows Mouse",可通过其上下文菜单访问。
或者,因为它是用Autohotkey编写的,你可以使用extract并运行它的子程序" XWN_FocusHandler"进入一个独立的脚本:
#Persistent
#SingleInstance force
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn All, OutputDebug ; Recommended for catching common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTimer, XWN_FocusHandler, 100
return
XWN_FocusHandler:
CoordMode, Mouse, Screen
MouseGetPos, XWN_MouseX, XWN_MouseY, XWN_WinID
If ( !XWN_WinID )
Return
If ( (XWN_MouseX != XWN_MouseOldX) or (XWN_MouseY != XWN_MouseOldY) )
{
IfWinNotActive, ahk_id %XWN_WinID%
XWN_FocusRequest = 1
Else
XWN_FocusRequest = 0
XWN_MouseOldX := XWN_MouseX
XWN_MouseOldY := XWN_MouseY
XWN_MouseMovedTickCount := A_TickCount
}
Else
If ( XWN_FocusRequest and (A_TickCount - XWN_MouseMovedTickCount > 500) )
{
WinGetClass, XWN_WinClass, ahk_id %XWN_WinID%
If ( XWN_WinClass = "Progman" )
Return
; checks wheter the selected window is a popup menu
; (WS_POPUP) and !(WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME)
WinGet, XWN_WinStyle, Style, ahk_id %XWN_WinID%
If ( (XWN_WinStyle & 0x80000000) and !(XWN_WinStyle & 0x4C0000) )
Return
IfWinNotActive, ahk_id %XWN_WinID%
WinActivate, ahk_id %XWN_WinID%
XWN_FocusRequest = 0
}
Return