procedure TCustomControl.WMPaint(var Message: TLMPaint);
begin
if (csDestroying in ComponentState) or (not HandleAllocated) then exit;
Include(FControlState, csCustomPaint);
inherited WMPaint(Message);
Exclude(FControlState, csCustomPaint);
end;Maybe use try-finally here for Exclude?
Regards,
Alexey
