Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > VCL

Lost Password?

Thread Tools Display Modes
Old 02-11-2016, 10:50 AM
lexd lexd is offline
Senior Member
Join Date: Feb 2015
Posts: 268
Default InvalidateRect RedrawWindow

I feel good about myself, I found a stupid little Boolean switch that saved me. Trying to write my own WMpaint procedure. So much hassle for such a little thing to find.

You can download my project on
And download: - Delphi VCL

I still have a little flicker on the canvas and I have noticed the two statements below used in TGrid that block Perform(WM_ERASEBKGND, MemDC, MemDC); in TWINControl's WMPaint message.

The only thing is these two statements loose my scrollbars in my object yet TGrid is able to keep its scrollbars. I'm missing something in my code but what?
HTML Code:
Windows.RedrawWindow(Handle, @InvalidRect, 0,
                          RDW_ALLCHILDREN + RDW_NOERASE + RDW_NOFRAME);
Windows.InvalidateRect(Handle, @InvalidRect, False);
I can use either statement, as both use InvalidRect: TRect which identifies the objects client print area.
With TGrid topleft set to 0,0 so I used the same.
The handle is the HWND form handle I guess and not a object handle,
But both statements take out my objects scrollbars that is needed. And both statements make the canvas very smooth on WMPaint updates and that's why they are used in TGrid....... why does TGrid hold its scrollbars.

any one had experience with these statements

Last edited by lexd; 02-11-2016 at 10:54 AM.
Reply With Quote
Old 02-11-2016, 11:47 AM
Norrit Norrit is offline
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,333

Sounds valid that the WM_ERASEBKGND isn't handled/blocked
You do a RDW_NOERASE which prevents this.
Reply With Quote
Old 02-11-2016, 10:11 PM
lexd lexd is offline
Senior Member
Join Date: Feb 2015
Posts: 268

you are saying: - RedrawWindow(Handle, @InvalidRect, 0, RDW_NOERASE
what else would you put with it RDW_ALLCHILDREN
and is their a RDW_FRAME message as that may draw scrollbars.

Last edited by lexd; 02-11-2016 at 10:21 PM.
Reply With Quote
Old 02-22-2016, 02:50 AM
lexd lexd is offline
Senior Member
Join Date: Feb 2015
Posts: 268

I feel so good about myself, InvalidateRect I got it to work perfectly
I now have a TCustomControl descendant with a blank canvas, scrollbar options, timer in my object. Its cool, it's fast, It has no blanking on updates with InvalidateRect, I can use it for CAD, picture control objects, special editors you name it.

Last edited by lexd; 02-22-2016 at 09:38 AM.
Reply With Quote

oop, windows

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 08:23 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.