function ToolBarProc(WinHandle: HWND; Msg: UINT; wp: WPARAM; lp: LPARAM): longint;
stdcall;
var
hTmpBmp: HBITMAP;
hDCTemp: HDC;
hDCMem: HDC;
rc, rw: TRect;
ps: TPaintStruct;
nResult: longint;
lpt: TPoint;
DC: HDC;
hDCBack: HDC;
begin
Result := 0;
case Msg
of
WM_ERASEBKGND:
begin
SkinEngine.FInvalidateRect(Winhandle, False);
Result := 1;
exit;
end;
WM_PAINT, WM_PRINTCLIENT:
begin
GetClientRect(WinHandle, rc);
if (wp = 0)
then
begin
BeginPaint(WinHandle, ps);
DC := ps.HDC;
end
else
DC := wp;
// Double Buffer erstellen
hDCTemp := SkinEngine.DoubleBuffer(ps.HDC, rc.Right, rc.Bottom, CreateBuffer);
// Kompatiblen DC erstellen
hDCMem := CreateCompatibleDC(hDCTemp);
// Compatibles Bitmap erstellen
hTmpBmp := CreateCompatibleBitmap(
DC, rc.Right, rc.Bottom);
// Object Selektieren
SelectObject(hDCMem, hTmpBmp);
// hintergrund aktualisieren
SendMessage(WinHandle, WM_ERASEBKGND, hDCMem, 0);
nResult := CallWindowProc(FPrevToolBarProc, WinHandle, Msg, hDCMem, lp);
//Transparent Blitten
TransparentBlt(
DC, 0, 0, rc.Right, rc.Bottom, hDCMem, 0, 0, rc.Right, rc.Bottom, 0);
// Objecte freigeben
DeleteDC(hDCMem);
DeleteObject(hTmpBmp);
// Dimensionen der ToolBar auslesen
GetWindowRect(WinHandle, rw);
lpt.x := rw.Left;
lpt.y := rw.Top;
ScreenToClient(SKDialogHandle, lpt);
// Hintergrund Kopieren
hDCBack := CreateCompatibleDC(hDCTemp);
SelectObject(hDCBack, SkinEngine.GetBackBitmap(SKDialogHandle));
// Toolbar Hintergrund mit dem Parent Hintergrund füllen
BitBlt(hDCTemp, 0, 0, rc.Right, rc.Bottom, hDCBack, lpt.x, lpt.y, SRCCOPY);
// Resourcen freigeben
DeleteDC(hDCBack);
// Double Buffer freigeben
SkinEngine.DoubleBuffer(0, 0, 0, DestroyBuffer);
if (wp = 0)
then
EndPaint(WinHandle, ps);
Result := nResult;
Exit;
end;
WM_DESTROY:
begin
ToolBarUnSubClass(WinHandle);
Result := 1;
Exit;
end;
end;
if (Result = 0)
then
Result := CallWindowProc(FPrevToolBarProc, WinHandle, Msg, wp, lp);
end;