WxWidgets lesson 6 EVT_ERASE_BACKGROUND background erase event
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