Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

WxWidgets lesson 5 EVT_SIZE window modification event

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Description

When the size of the parent window changes, the parent window's OnSize function is called first, and then traverses the child window's OnSize function. After customizing the control and implementing the scaling transformation with the size of the parent window, you can create a scale factor. According to the current size of the parent window, you can call two methods of the child control in the OnSize function of the parent window to adjust the size and position of the child control:

SetPosition sets the location of child controls

SetClientSize sets the size of child controls

problem

In order to achieve the stretching of the interface, when the window changes, issue a redraw event (OnSize will call OnPaint) to refresh the interface. You can see that the flicker is very obvious in the case of fast scaling window.

Analysis

When the system sets the best appearance performance requirements, stretch the border of the interface, a virtual border will appear, and when the mouse pops up, the interface will be re-rendered to avoid flickering. Under other appearance options, flicker occurs when the interface frame is stretched and rendered in real time.

True custom renderin

A solution that comes to mind at present: when the mouse presses and drags the window, it does not redraw the window, but waits until the mouse pops up. This involves a difficult point, where to associate the mouse pop-up event EVT_LEFT_UP, and need to control the rendering of the frame in real time.

Be careful

When the parent control is destroyed, the child control's destructor is also called to destroy the child control.

The problem of entering OnSize function twice

When you start the program, when you are ready to enter the main interface and render the custom control, it is detected that you have entered the OnSize function twice, resulting in the interface being rendered twice. It is not clear where the WM_ONSIZE message was sent twice, causing the problem.

Suspect direction

1 whether the parent window pointer is set: verify that a pointer to the parent window must be provided

2 whether the extended property WX_EXPAND is set: there is no reason to base on

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report