对话框的子项在调整大小时闪烁 [英] dialog's children flickering during resizing

查看:120
本文介绍了对话框的子项在调整大小时闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我已经解决了很多次与控制闪烁相关的问题,但这次我正面临一个新问题。


可以轻松解释该场景:


1)创建一个简单的Win32项目。


2)在资源中添加一个对话框。默认情况下,该对话框将有两个按钮:确定和取消。


3)将对话框设置为可调整大小。将WS_CLIPCHILDREN属性设置为true。


4)编写一个简单的DialogProc,用于刚刚创建的对话框。



目标是,即使在您向任何方向调整对话框大小后,第一次出现对话框时,也会将OK和Cancel按钮显示为exaclty。


你可以使用你的方法[例如[Begin | End] DeferWindowPos()函数对,你可以管理WM_SIZE或WM_SIZING或WM_ENTERSIZEMOVE等。


拿起你的方法之后尝试:


a)移动到对话框右边缘的右侧和左侧,尝试查看按钮的移动方式,并查看闪烁的级别。 / p>

b)移动到对话框的右侧和左侧左边缘并尝试查看按钮的移动方式并查看闪烁的级别(如果你没有看到它尝试以更快的方式调整大小)。


此时你应该能够看到一种不同的闪烁方式,当你移动左边缘而不是右边缘时更强。


Q1)是否有原因?


Q2)以及如何删除调整大小或使其更加流畅?


如果你删除一段时间你的代码来管理Ok和Cancel按钮的重新定位并尝试调整对话框的大小它的左边缘,你会看到一个非常流畅的运动,根本没有闪烁。


Q3)是否有可能获得最后的调整大小效果?


<我已经尝试了很多解决方案来避免这个flieckegin,但它似乎对底层对话框控件很紧张。


谢谢。

解决方案

也许它迟到..


但是,当你处于"调整大小模式"时,请尝试每个WM_ERASEBKGND。验证窗口的客户区域是否适用:


  

 case WM_ERASEBKGND:// 0x0014 
{
RECT client;
GetClientRect(hwnd,& client);

if(InResizeMode)
{
ValidateRect(hwnd,& client);
}
}

这样做,你阻止通过Windows WM_PAINT消息发送,这会导致你的窗口变得不知所措。 / p>

PS英语不是我的母语。





Hi,

I've solved many times problems related to control's flickering, but this time I'm facing a new one.

The scenario can be explained easily:

1) Create a simple Win32 project.

2) Add a dialog in the resource. The dialog will have two buttons by default: OK and Cancel.

3) Set the dialog as resizable. Set WS_CLIPCHILDREN property to true too.

4) Write a simple DialogProc you will use for the dialog you've just created created.

The goal is to anchor the OK and Cancel buttons exaclty as they are when the dialog appears the first time, even after you resized the dialog in any directions.

You can use your method for example [Begin|End]DeferWindowPos() function pairs, you can manage the WM_SIZE or WM_SIZING or WM_ENTERSIZEMOVE etc.

After you picked up your method try to:

a) move to the right and to the left the right edge of the dialog and try to see how the buttons are moved and see the level of flickering.

b) move to the right and to the left the left edge of the dialog and try to see how the buttons are moved and see the level of flickeing (if you don't see it try to resize in a more fast way).

At this point you should be able to see a different way of flickering, more stronger when you move the left edge than the right edge.

Q1)Is there a reason for that?

Q2) and How can I remove or make more fluid the resize?

If you remove for a while your code to manage the repositioning of Ok and Cancel buttons and try to resize the dialog moving the left edge of it, you will see a very fluid movement and no flickering at all.

Q3) Is it possible to get this last resizing effect?

I've tried many solution to avoid this flieckegin but it seems to tight to the underlying dialog control.

Thank you.

解决方案

Maybe its to late..

But, try for each WM_ERASEBKGND, when you are in "resize mode" to validate client area of window that are flikering:

  

case WM_ERASEBKGND: // 0x0014
{                   
  RECT client;
  GetClientRect ( hwnd, &client );

  if( InResizeMode )
  {
    ValidateRect  ( hwnd, &client );
  }
}

doing such way, you are preventing from sending by Windows WM_PAINT message, which causes your window to fliker.

P.S. English is not my native language.



这篇关于对话框的子项在调整大小时闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆