窗口区域没有切割航空边界

时间:2014-05-05 11:19:26

标签: c# windows-7 border regions

我正在尝试使用

将区域应用到我的应用程序之外的窗口
[DllImport("user32.dll")]
static extern IntPtr SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool bRedraw);

[DllImport("gdi32.dll")]
static extern IntPtr CreateRectRgn(int x1, int y1, int x2, int y2);

internal void Cut(IntPtr handle)
{
    SetWindowRgn(handle, CreateRectRgn(0, 0, 100, 200), true);
}

但它不会在Windows 7中剪切窗口边框。请注意,它不可单击,但在拖动区域内的边框时会移动。

notepad is not cut properly

我错过了什么?

1 个答案:

答案 0 :(得分:0)

根据this similar question,您似乎无法做到。所以我认为有两种选择。

1。关闭Aero

Windows basic theme works

2。摆脱边界

在我的情况下,我不需要边框,因此我使用SetWindowLong将其删除

var style = GetWindowLong(handle, GWL_STYLE);
style &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU);
SetWindowLong(handle, GWL_STYLE, style);

Notepad with region + removed border

相关问题