TPageControl paint
- Lazarus/FPC Version: Lazarus 3.99 (rev c476c440) FPC 3.3.1 x86_64-win64-win32/win64
- Operating System: Windows 11
- CPU / Bitness: 64
What happens
DBCheckBox and DBRadioGroup controls aren't painted properly in TabSheet of PageControl. If you go over with mouse or resize form situation is corrected. Also, if I move something on the form (and save it) problem doesn't appear.
From Martin_fr (Forum post): The problem actually (most likely) is not the artifacts. The page doesn't paint it's background.
- In the clean version the background is white
- With the artifacts the background is grey, but when it cleans up (on resize) it becomes white. So apparently the components are painted on the "not painted" page.
However, there must be something else to it, because it is limited to Checkbox and radio.
- They both are "see through". If you place a radio above a label, you can see parts of the label.
- So are labels too. But labels are TGraphicControl, radios are TWinControl.
- Radio, Checkbox AND TButton have a custom WndProc (and all 3 have the same) that omits "EraseBackground" (otherwise it flickers like hell). For buttons it does not matter, they are not "see through" and do it in paint.
Yet, changing the WndProc ("SubClassWndProc") does not help, not completely. If EraseBackground gets called for radio/checkbox
- the artifacts are gone
- the background will be white (as should be the page)
- the page will still be grey, until it gets resized - and then it becomes white too.
So if instead the page was fixed, the the artifacts should go to. (probably). And it shouldn't introduce the massive flicker that the checkbox/radio EraseBackground does.
Steps to reproduce
Run attached project. I also attached screenshot and enlarged screenshot. testpages.zip