[Lazarus] Getting update rect/region in Windows

Max Vlasov max.vlasov at gmail.com
Sun May 22 13:48:28 CEST 2011


2011/5/22 Zaher Dirkey <parmaja at gmail.com>

>
> 2011/5/22 Max Vlasov <max.vlasov at gmail.com>
>
>> Hi,
>> I encountered a problem I don't know how to solve.
>>
>> In Delphi I used the following trick. In the WM_Paint before inheried call
>> I got update region with successive calls to GetUpdateRect (to determine if
>> it exists) and GetUpdateRgn afterwards. This allowed to get the correct
>> region before BeginPaint is called (it validates the region so getting it
>> after BeginPaint makes no sense).
>>
>> But in Lazarus WM_Paint handler already contains DC and also GetUpdateRect
>> call is failed. As I understand, this is because the WindowProc from
>> win32callback.inc already did BeginPaint and provided the dc for the
>> following call to the control WM_Paint.
>>
>>
>> Max Vlasov
>>
>>
> Check Canvas.ClipRect
>
>
>

Zaher, thanks,
but this is irrelevant, clipping rects and regions is just  the way to
define canvas/device context limiting area until explicitly canceled. It was
used by Delphi and (probably) Lazarus to implement TGraphicControl,
component working almost as TWinControl but without window handles.

The update region is the region formed by multiply InvalidateRect and
InvalidateRgn calls and it exists until BeginPaint is called as a result of
Wm_paint message. Invalidation is more correct way to redraw anything on the
window (vs direct drawing when necessary)

Max

Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110522/b02b78d1/attachment-0003.html>


More information about the Lazarus mailing list