Get the App
SLTechnology News&Howtos  ›  Servers  › 

WxWidgets lesson 6 EVT_ERASE_BACKGROUND background erase event

Shulou Source: shulou.com Published: 2022-06-02 16:44:54 10月04日 Update

Description

By default, the OnEraseBackground function is responsible for rendering the background color, and the OnPaint function is responsible for rendering the foreground color. The default background color function provided by the system renders the background white, causing the control area to flicker. You can reduce flicker by overriding the background erase event handler

Examples

Void OnEraseBackground (wxEraseEvent& event)

EVT_ERASE_BACKGROUND (CDownLinkPlaybackSliderCtrl::OnEraseBackground)

Void CDownLinkPlaybackSliderCtrl::OnEraseBackground (wxEraseEvent& event)

{

WxClientDC dc (this)

WxSize size = this- > GetSize ()

Int width = size.GetWidth ()

Int height = size.GetHeight ()

Int middleHeight = height/2

Dc.SetPen (wxPen (* wxBLACK, 2))

/ / dc.DrawLine (0, middleHeight-1, width, middleHeight-1)

/ / dc.DrawLine (0, middleHeight+1, width, middleHeight+1)

Dc.SetBrush (* wxBLACK_BRUSH)

Dc.DrawRectangle (2, middleHeight-2, width-4, 4)

Int topDialHeight = middleHeight-2

Int buttonDialHeight = middleHeight+2

Int averageGap = (width-4) / 25

Int count = 0

For (int iTunes 2; I

Tags: Background function color event example foreground region can be passed case control white system processing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker OPPO Reno macOS Microsoft Xiaomi