您可能需要在此处使用PInvoke.基本上你正在导入SetWindowLong和GetWindowLong函数,并使用它的句柄(hwnd)将相应的标志设置到Win API窗口
private const int GWL_STYLE = -16;
private const int WS_MINIMIZE = -131073;
[DllImport("user32.dll", SetLastError = true)]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
private static void CanMinimize(Window w)
{
var hwnd = new WindowInteropHelper(w).Handle;
long value = GetWindowLong(hwnd, GWL_STYLE);
SetWindowLong(hwnd, GWL_STYLE, (int)(value & ~WS_MINIMIZE));
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4864 次 |
| 最近记录: |