![]() |
VST BiltBlt im AfterCellPaint liefert False
Hi,
ich möchte eine Grafik ein einer Zelle im VirtualStringTree zeichnen. Mit TargetCanvas.Draw geht das ohne Probleme. BitBlt liefert jedoch ein False. Während hier nur ein leer Zelle erscheint
Delphi-Quellcode:
wird das richtig gezeichnet.
BitBlt(TargetCanvas.Handle, CellRect.Left, CellRect.Top, CellRect.Width, CellRect.Height, T.picture.Bitmap.Handle, 0, 0, SRCCOPY);
Delphi-Quellcode:
Kennt jemand die Ursache?
if not BitBlt(TargetCanvas.Handle, CellRect.Left, CellRect.Top, CellRect.Width, CellRect.Height, T.picture.Bitmap.Handle, 0, 0, SRCCOPY) then
TargetCanvas.Draw(CellRect.Left, CellRect.Top, T.picture.Bitmap); |
AW: VST BiltBlt im AfterCellPaint liefert False
Was sagt denn GetLastError bzw. SysErrorMessage(GetLastError)? Laut Doku wird der Wert ja gefüllt, wenn die Funktion nicht erfolgreich ist.
|
AW: VST BiltBlt im AfterCellPaint liefert False
Delphi-Quellcode:
GetLastError liefert 0 btw. "Der Vorgang wurde erfolgrech beenden". Jedoch liefert BitBlt definitiv False.
if not BitBlt(TargetCanvas.Handle, CellRect.Left+1, CellRect.Top+1, CellRect.Width-2, CellRect.Height-2, T.picture.Bitmap.Handle, 0, 0, SRCCOPY) then
ShowMessage(SysErrorMessage(GetLastError)); |
AW: VST BiltBlt im AfterCellPaint liefert False
Das könnte daran liegen, dass BOOL aus 4 Byte besteht, ein Boolean aber nur aus 1 Byte. Caste doch mal den Rückgabewert von BitBlt in Longint und prüfe das auf 0.
|
AW: VST BiltBlt im AfterCellPaint liefert False
Delphi-Quellcode:
Laut Debugger ist lb=False
var
LB: LongBool; begin lb:=BitBlt(TargetCanvas.Handle, CellRect.Left+1, CellRect.Top+1, CellRect.Width-2, CellRect.Height-2, T.picture.Bitmap.Handle, 0, 0, SRCCOPY); if not lb then . . |
AW: VST BiltBlt im AfterCellPaint liefert False
Das ist nicht so ganz was ich vorgeschlagen hatte. Auch bei diesem Code wird ein 4-Byte-LongBool in einen 1-Byte-Boolean konvertiert - ob der nun im Debugger dargestellt oder in einem
Delphi-Quellcode:
abgefragt wird. Wenn bei der Konvertierung nur das niedrige Byte berücksichtigt wird kann das auch mal schiefgehen.
if not
Versuch doch mal dies:
Delphi-Quellcode:
Am Ende ist für die WinApi ein BOOL immer noch eine Zahl.
var
LB: LongBool; begin lb := BitBlt(TargetCanvas.Handle, CellRect.Left+1, CellRect.Top+1, CellRect.Width-2, CellRect.Height-2, T.picture.Bitmap.Handle, 0, 0, SRCCOPY); if LongInt(LB) <> 0 then . . |
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:30 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz