问题描述
限时送ChatGPT账号..我正在使用以下内容通过其句柄显示/隐藏窗口:
[DllImport("user32.dll")] private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);//ShowWindowAsync() 的 Win32 API 常量私有常量 int SW_HIDE = 0;私有常量 int SW_SHOW = 5;ShowWindowAsync(_hWnd, SW_SHOW);//橱窗ShowWindowAsync(_hWnd, SW_HIDE);//隐藏窗口
当我隐藏便笺然后再次显示它们时,它会在便笺中造成视觉洞",我必须关闭便笺并重新打开.
问题截图如下:
我认为该问题特定于粘滞便笺.
我不知道为什么会这样,但我想以某种方式解决它..
我考虑过检查窗口是否是粘滞便笺,如果是,则打开/关闭它而不是显示/隐藏会起到相同的作用,但我真的不喜欢它 - 感觉很笨拙.
解决方案从 ShowWindowAsync()
更改为 ShowWindow()
解决了问题.
>
我不知道为什么 ShowWindowAsync()
会导致这个问题,我希望在这里得到一个有教育意义的答案,但现在,只要我的问题得到解决,我就很高兴.
I am using the following to Show/Hide window by its handle:
[DllImport("user32.dll")] private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
// Win32 API Constants for ShowWindowAsync()
private const int SW_HIDE = 0;
private const int SW_SHOW = 5;
ShowWindowAsync(_hWnd, SW_SHOW); //Show Window
ShowWindowAsync(_hWnd, SW_HIDE); //Hide Window
When I hide Sticky Notes and then Show them again it cause visual "holes" in the stickies and I have to close the Sticky Notes and reopen.
Here's a screenshot of the problem:
I believe the problem is specific to the Sticky Notes.
I dont know why it happens but I would like to solve it somehow..
I thought about checking if the window is Sticky Notes, and if it is then Open/Close it instead of Show/Hide will act the same but I dont really like it - feels hacky.
解决方案Changing from ShowWindowAsync()
to ShowWindow()
solved the problem.
I dont know why the ShowWindowAsync()
cause this problem and I wish for an educating answer here but for now, as long as my problem is solved I am happy.
这篇关于使用 ShowWindow 显示便签会导致“漏洞"在粘性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论