A
Ares
Unregistered / Unconfirmed
GUEST, unregistred user!
我想在image上显示文本,代码如下:
var
s,line: string;
b: Tbitmap;
r: Trect;
linelist: Tstringlist;
i: integer;
begin
if o.Execute then
begin
s:=o.FileName;
linelist:=Tstringlist.Create;
linelist.LoadFromFile(s);
line:='';
for i:=0 to linelist.Count-1 do
line:=line+linelist.Strings+#113;
R:=Rect(image1.left,image1.top,image1.left+image1.width,
image1.top+image1.height);
b:=TBitmap.Create;
DrawText(Canvas.Handle,Pchar(line),-1,R,
DT_CALCRECT or DT_WORDBREAK);
Canvas.Brush.Style:=bsClear;
Canvas.Rectangle(R.left,r.top,r.right,r.bottom);
DrawText(b.canvas.Handle,Pchar(s),-1,R,
DT_WORDBREAK);
BitBlt(image1.Picture.Bitmap.canvas.handle,0,0,image1.Width,image1.Height,
B.canvas.handle,0,0,SRCcopy);
b.free;
linelist.Clear;
linelist.free;
end;
但是为什么无法显示呢?请各位指教,200分就做为酬劳吧:)
var
s,line: string;
b: Tbitmap;
r: Trect;
linelist: Tstringlist;
i: integer;
begin
if o.Execute then
begin
s:=o.FileName;
linelist:=Tstringlist.Create;
linelist.LoadFromFile(s);
line:='';
for i:=0 to linelist.Count-1 do
line:=line+linelist.Strings+#113;
R:=Rect(image1.left,image1.top,image1.left+image1.width,
image1.top+image1.height);
b:=TBitmap.Create;
DrawText(Canvas.Handle,Pchar(line),-1,R,
DT_CALCRECT or DT_WORDBREAK);
Canvas.Brush.Style:=bsClear;
Canvas.Rectangle(R.left,r.top,r.right,r.bottom);
DrawText(b.canvas.Handle,Pchar(s),-1,R,
DT_WORDBREAK);
BitBlt(image1.Picture.Bitmap.canvas.handle,0,0,image1.Width,image1.Height,
B.canvas.handle,0,0,SRCcopy);
b.free;
linelist.Clear;
linelist.free;
end;
但是为什么无法显示呢?请各位指教,200分就做为酬劳吧:)