Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 完全删除外部窗口的边框_C#_Winapi - Fatal编程技术网

C# 完全删除外部窗口的边框

C# 完全删除外部窗口的边框,c#,winapi,C#,Winapi,我正在尝试使用winapi完全删除外部窗口的所有边框 现在,我通过使用此代码实现了以下结果: 这将删除标题和最小/最大/关闭按钮(奇怪的是,只有在调整窗口大小之后)。但是,这不会删除允许调整窗口大小的薄边框 如何删除边框?我认为您可能要查找的是WS\u弹出窗口,而不是~WS\u标题 也许可以尝试添加此样式: public const uint WS_POPUP = 0x80000000; 然后像这样打开窗口: SetWindowLong(hWnd, GWL_STYLE, WS_POPUP);

我正在尝试使用winapi完全删除外部窗口的所有边框

现在,我通过使用此代码实现了以下结果:

这将删除标题和最小/最大/关闭按钮(奇怪的是,只有在调整窗口大小之后)。但是,这不会删除允许调整窗口大小的薄边框


如何删除边框?

我认为您可能要查找的是WS\u弹出窗口,而不是~WS\u标题

也许可以尝试添加此样式:

public const uint WS_POPUP = 0x80000000;
然后像这样打开窗口:

SetWindowLong(hWnd, GWL_STYLE, WS_POPUP);

为了进一步解释,WS_弹出窗口实际上删除了任何大小调整、最小值/最大值调整,只剩下一个简单的窗口。

您是否尝试过清除WS_THICKFRAME窗口样式?如果我记得,它控制窗口是否有“调整大小”边框。就仅在调整大小后更改而言,您需要使窗口的非客户端区域无效,这样才能发生这种情况。尝试使用RDW_框架标志调用p/重画窗口()。@Tim:不,您需要按照和调用应用新的框架样式。不,
WS_弹出窗口
不能这样做<代码>WS_弹出窗口本身就可以。您正在用
WS\u POPUP
替换已经存在的所有样式。删除
WS\u CAPTION
是正确的解决方案,但不是完整的解决方案。我已经尝试过,但当窗口是弹出窗口时,它无法交互。当我点击窗口时,它会隐藏自己(就像一个弹出窗口)。
        public const uint WS_SIZEBOX = 0x00040000;

    public static void HideWindowBorders(IntPtr hWnd)
    {
        int style = GetWindowLong(hWnd, GWL_STYLE); //gets current style
        SetWindowLong(hWnd, GWL_STYLE, (uint)(style & ~(WS_CAPTION | WS_SIZEBOX))); //removes caption and the sizebox from current style
    }
        public const uint WS_SIZEBOX = 0x00040000;

    public static void HideWindowBorders(IntPtr hWnd)
    {
        int style = GetWindowLong(hWnd, GWL_STYLE); //gets current style
        SetWindowLong(hWnd, GWL_STYLE, (uint)(style & ~(WS_CAPTION | WS_SIZEBOX))); //removes caption and the sizebox from current style
    }