mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 08:58:23 +02:00
Merged revision(s) 49170 #8077f55310 from trunk:
LCL-Win: Prevent flicker in TListbox. Issue #28146, patch from wp. ........ git-svn-id: branches/fixes_1_4@49198 -
This commit is contained in:
parent
5c2960c762
commit
922c2ab8bb
@ -583,6 +583,9 @@ var
|
||||
WindowInfo: PWin32WindowInfo;
|
||||
NCCreateParams: PNCCreateParams;
|
||||
LMessage: TLMessage;
|
||||
Count: LResult;
|
||||
Top: Integer;
|
||||
ARect: TRect;
|
||||
begin
|
||||
case Msg of
|
||||
WM_NCCREATE:
|
||||
@ -609,6 +612,26 @@ begin
|
||||
LMessage.Result := 0;
|
||||
Exit(DeliverMessage(WindowInfo^.WinControl, LMessage));
|
||||
end;
|
||||
WM_ERASEBKGND:
|
||||
// Avoid unnecessary background paints to avoid flickering of the listbox
|
||||
begin
|
||||
WindowInfo := GetWin32WindowInfo(Window);
|
||||
Count := SendMessage(Window, LB_GETCOUNT, 0, 0);
|
||||
if Assigned(WindowInfo^.WinControl) and
|
||||
(TCustomListBox(WindowInfo^.WinControl).Columns < 2) and
|
||||
(Count <> LB_ERR) and (SendMessage(Window, LB_GETITEMRECT, Count - 1, Windows.LParam(@ARect)) <> LB_ERR) then
|
||||
begin
|
||||
Top := ARect.Bottom;
|
||||
Windows.GetClientRect(Window, ARect);
|
||||
ARect.Top := Top;
|
||||
if not IsRectEmpty(ARect) then
|
||||
Windows.FillRect(HDC(WParam), ARect, WindowInfo^.WinControl.Brush.Reference.Handle);
|
||||
Result := 1;
|
||||
end
|
||||
else
|
||||
Result := CallDefaultWindowProc(Window, Msg, WParam, LParam);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
// normal processing
|
||||
Result := WindowProc(Window, Msg, WParam, LParam);
|
||||
|
Loading…
Reference in New Issue
Block a user