Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

WS_EX_NOACTIVATE dragging/resizing bug

瀏覽次數:24 次
跳到第一則未讀訊息

Robert Phillips

未讀,
2017年11月22日 下午4:42:252017/11/22
收件者:
Hi

I don't know much about win api, I am using C# but others have run into this with visual c++.

e.g.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/05a623b6-99dd-4c59-99b6-902f8c692db5/wsexnoactivate-draggingresizing-bug?forum=vcgeneral

The issue is that in Windows 7, when a window is made such that it can't be made active, with WS_EX_NOACTIVATE, then when you try to move it nothing gets redrawn while the mouse is moved to drag it.

The window just shows in its original location, and when the mouse button is released, it shows in its new location.

In my C# program,

It happens if I put this in a form class, and it happens with either a WPF form or a winforms form, though i'm more interested in winforms.

I don't want the form to activate, but I do want the window or border of the window to redraw when dragged(based on the win7 "show window contents while dragging" checkbox. Win7 has an option "show window contents while dragging", if enabled it redraws the window, if disabled it redraws just the border. Unfortunately when I try the code below, I get nothing redrawn.


private const int WS_EX_NOACTIVATE = 0x08000000;
protected override CreateParams CreateParams
{
get
{
CreateParams createParams = base.CreateParams;
createParams.ExStyle |= WS_EX_NOACTIVATE;
return createParams;
}
}

0 則新訊息