add TWinControl.DoubleBuffered property which is a hint for the interface to do double-buffering for this control

git-svn-id: trunk@5026 -
This commit is contained in:
micha 2004-01-07 18:05:46 +00:00
parent eab820a09e
commit 0b23f54b34
2 changed files with 36 additions and 18 deletions

View File

@ -975,6 +975,7 @@ type
FControls: TList;
FDefWndProc: Pointer;
//FDockSite: Boolean;
FDoubleBuffered: Boolean;
FClientWidth: Integer;
FClientHeight: Integer;
FDockManager: TDockManager;
@ -1120,6 +1121,7 @@ type
property DockClients[Index: Integer]: TControl read GetDockClients;
property DockSite: Boolean read FDockSite write SetDockSite default False;
property DockManager: TDockManager read FDockManager write FDockManager;
property DoubleBuffered: Boolean read FDoubleBuffered write FDoubleBuffered;
property IsResizing: Boolean read GetIsResizing;
property OnDockDrop: TDockDropEvent read FOnDockDrop write FOnDockDrop;
property OnDockOver: TDockOverEvent read FOnDockOver write FOnDockOver;
@ -1857,6 +1859,9 @@ end.
{ =============================================================================
$Log$
Revision 1.167 2004/01/07 18:05:46 micha
add TWinControl.DoubleBuffered property which is a hint for the interface to do double-buffering for this control
Revision 1.166 2004/01/03 23:14:59 mattias
default font can now change height and fixed gtk crash

View File

@ -179,32 +179,42 @@ Var
// create a paint message
AWinControl := TWinControl(OwnerObject);
DC := Windows.GetDC(0);
GetWindowSize(Window, MemWidth, MemHeight);
MemBitmap := Windows.CreateCompatibleBitmap(DC, MemWidth, MemHeight);
Windows.ReleaseDC(0, DC);
MemDC := Windows.CreateCompatibleDC(0);
OldBitmap := Windows.SelectObject(MemDC, MemBitmap);
if AWinControl.DoubleBuffered then
begin
DC := Windows.GetDC(0);
GetWindowSize(Window, MemWidth, MemHeight);
MemBitmap := Windows.CreateCompatibleBitmap(DC, MemWidth, MemHeight);
Windows.ReleaseDC(0, DC);
MemDC := Windows.CreateCompatibleDC(0);
OldBitmap := Windows.SelectObject(MemDC, MemBitmap);
PaintMsg.DC := MemDC;
end;
GetLclClientOriginOffset(AWinControl.Handle, LeftOffset, TopOffset);
try
DC := Windows.BeginPaint(Window, @PS);
AWinControl.EraseBackground(MemDC);
PaintMsg.Msg := LM_PAINT;
PaintMsg.DC := MemDC;
PaintMsg.PaintStruct := @PS;
MoveWindowOrgEx(MemDC, LeftOffset, TopOffset);
if not AWinControl.DoubleBuffered then
PaintMsg.DC := DC;
AWinControl.EraseBackground(PaintMsg.DC);
MoveWindowOrgEx(PaintMsg.DC, LeftOffset, TopOffset);
DeliverMessage(OwnerObject, PaintMsg);
MoveWindowOrgEx(MemDC, -LeftOffset, -TopOffset);
Windows.BitBlt(DC, 0, 0, MemWidth, MemHeight, MemDC, 0, 0, SRCCOPY);
MoveWindowOrgEx(PaintMsg.DC, -LeftOffset, -TopOffset);
if AWinControl.DoubleBuffered then
Windows.BitBlt(DC, 0, 0, MemWidth, MemHeight, MemDC, 0, 0, SRCCOPY);
Windows.EndPaint(Window, @PS);
finally
SelectObject(MemDC, OldBitmap);
Windows.OpenClipboard(0);
Windows.EmptyClipboard;
Windows.SetClipboardData(CF_BITMAP, MemBitmap);
Windows.CloseClipboard;
DeleteDC(MemDC);
DeleteObject(MemBitmap);
if AWinControl.DoubleBuffered then
begin
SelectObject(MemDC, OldBitmap);
// for debugging purposes: copy rendered bitmap to clipboard
// Windows.OpenClipboard(0);
// Windows.EmptyClipboard;
// Windows.SetClipboardData(CF_BITMAP, MemBitmap);
// Windows.CloseClipboard;
DeleteDC(MemDC);
DeleteObject(MemBitmap);
end;
end;
end;
@ -928,6 +938,9 @@ end;
{
$Log$
Revision 1.86 2004/01/07 18:05:46 micha
add TWinControl.DoubleBuffered property which is a hint for the interface to do double-buffering for this control
Revision 1.85 2004/01/03 21:06:06 micha
- fix win32/checklistbox
- implement proper lcl to interface move/size notify via setwindowpos