在我尝试运行/编译/构建Proiject时出现此错误
Incompatible Types : “TBitmap” and “TObject”
Run Code Online (Sandbox Code Playgroud)
光标指向 Bitmap := FSectionList.BackgroundBitmap
请帮我搞清楚.这里像一辆交通拥挤的救护车
以下是代码的一部分: -
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;
Run Code Online (Sandbox Code Playgroud)
谢谢和关心Vas
我只是猜测,但是从错误消息和FSectionList的名称来看,它是某种List,它包含通用的TObject实例,而BackgroundBitmap就是其中之一.
您需要将其强制转换为TBitmap:
Bitmap := FSectionList.BackgroundBitmap as TBitMap;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1522 次 |
| 最近记录: |