【求助】如何判断鼠标位置是否在任务栏上??
RT
隐藏窗口标题栏后,自己写了个伪标题栏。
但是出现了一个问题,
就是鼠标按住标题栏拖动窗口的时候,会将标题栏拖到windows任务栏背面,松开后就找不到窗口了
不知道怎么解决??? 鼠标 任务栏 拖动 标题栏 判断位置
[解决办法]
[DllImport("user32.dll", EntryPoint = "GetWindowRect")]
private static extern bool GetWindowRect(IntPtr hWnd, ref Rectangle lpRect);
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string strClassName, int nptWindowName);
private void MainForm_LocationChanged(object sender, EventArgs e)
{
IntPtr hWnd = FindWindow("Shell_TrayWnd", 0);
if (hWnd != IntPtr.Zero)
{
Rectangle rect = new Rectangle();
GetWindowRect(hWnd, ref rect);
if (this.Top >= rect.Top)
{
this.Top = rect.Top + this.Height;
}
}
}