Getting this error while I am trying to run /compile/build a Proiject
Incompatible Types : “TBitmap” and “TObject”
The cursor is pointing to Bitmap := FSectionList.BackgroundBitmap
Kindly help me figure it out.
Struck here like a ambulance in heavy traffic
Here is the part of the code:-
procedure ThtmlViewer.DoBackground1(ACanvas: TCanvas; ATop, AWidth, AHeight, FullHeight: integer);
var
ARect: TRect;
Bitmap, Mask: TBitmap;
PRec: PtPositionRec;
BW, BH, X, Y, X2, Y2, IW, IH, XOff, YOff: integer;
Fixed: boolean;
begin
ARect := Rect(0, 0, AWidth, AHeight);
Bitmap := FSectionList.BackgroundBitmap;
if FSectionList.ShowImages and Assigned(Bitmap) then
begin
Mask := FSectionList.BackgroundMask;
BW := Bitmap.Width;
BH := Bitmap.Height;
PRec := FSectionList.BackgroundPRec;
Fixed := PRec[1].Fixed;
if Fixed then
begin {fixed background}
XOff := 0;
YOff := 0;
IW := AWidth;
IH := AHeight;
end
else
begin {scrolling background}
XOff := 0;
YOff := ATop;
IW := AWidth;
IH := FullHeight;
end;
CalcBckgrndLoctionAndTilng(PRec, ARect, XOff, YOff, IW, IH, BW, BH, X, Y, X2, Y2);
DrwBckgrnd(ACanvas, ARect, X, Y, X2, Y2, Bitmap, Mask, BW, BH, PaintPanel.Color);
end
else
begin {no background image, show color only}
DrwBckgrnd(ACanvas, ARect, 0,0,0,0, Nil, Nil, 0, 0, PaintPanel.Color);
end;
end;
Thanks and Regards
Vas
Best Answer
I'm only guessing, but from the error message and the name of FSectionList, it's some kind of List which holds generic TObject instances and BackgroundBitmap is one of them.
You would need to cast it back as a TBitmap: