请教:我窗体上有 控件 timer1 ,image1procedure TForm1.FormCreate(Sender: TObject);
begin
timer1.enabled:=true;
timer1.Interval:=10;
x:=image1.height+20;
tt:=x+80;
form1.repaint;
image1.Canvas.brush.color:=clGreen;
pic:=Rect(0,0,image1.width,image1.height);
image1.Canvas.FillRect(pic);
pic:=Rect(-1,-1,1,1);
map:=Tbitmap.create;
map.loadfromfile('D:\ledtest\test2\000.bmp');
image1.canvas.stretchdraw(pic,map);
end;1:
pic:=Rect(0,0,image1.width,image1.height);
这句话是什么意思啊?
是不是说明 pic 区域的大小为
(0,0,image1.width,image1.height);2:
image1.Canvas.FillRect(pic);
这句话是什么意思/3:
pic:=Rect(-1,-1,1,1);
这里为什么是这样呢/4:
image1.canvas.stretchdraw(pic,map);
stretchdraw 的功能是什么?
是不是表示在 pic 这个范围内显示 map
可是为什么没有显示出来呢?
和
image1.canvas.Draw(20'20.map);
有什么区别呢?
谢谢!
begin
timer1.enabled:=true;
timer1.Interval:=10;
x:=image1.height+20;
tt:=x+80;
form1.repaint;
image1.Canvas.brush.color:=clGreen;
pic:=Rect(0,0,image1.width,image1.height);
image1.Canvas.FillRect(pic);
pic:=Rect(-1,-1,1,1);
map:=Tbitmap.create;
map.loadfromfile('D:\ledtest\test2\000.bmp');
image1.canvas.stretchdraw(pic,map);
end;1:
pic:=Rect(0,0,image1.width,image1.height);
这句话是什么意思啊?
是不是说明 pic 区域的大小为
(0,0,image1.width,image1.height);2:
image1.Canvas.FillRect(pic);
这句话是什么意思/3:
pic:=Rect(-1,-1,1,1);
这里为什么是这样呢/4:
image1.canvas.stretchdraw(pic,map);
stretchdraw 的功能是什么?
是不是表示在 pic 这个范围内显示 map
可是为什么没有显示出来呢?
和
image1.canvas.Draw(20'20.map);
有什么区别呢?
谢谢!
2、用指定的画刷填充区域(这里用绿色填充)
3、同1
4、用图片填充区域
区别:StretchDraw将图片缩放,Draw无
Rect(X1,Y1,X2,Y2);
//取(X1,Y1)(左上角)与(X2,Y2)(右下角)所确定的一个矩形区域
2
填充区域
3
同1
4
缩放至pic所定义的区域大小并填充
image1.canvas.stretchdraw(pic,map);缩放至pic所定义的区域大小并填充您的意思是
image1.canvas.stretchdraw(pic,map);
这句话是把 map 添充到 pic ,是吗?
可是为什么执行这句话后,图片没有显示出来呢?
我还要加句什么话,才能使图片显示出来?谢谢!
map:=Tbitmap.create;
map.loadfromfile('D:\ledtest\test2\000.bmp');
image1.canvas.stretchdraw(pic,map);
是的!procedure TForm1.Timer1Timer(Sender: TObject);
begin
x:=x-1;
tt:=tt-1;
if(x<-160) then
x:=image1.height+20;
tt:=x+80;
image1.Canvas.font.size:=18;
image1.Canvas.font.color:=$1200ffff;
image1.Canvas.TextOut(10,x,'OK字幕移动演示');
image1.Canvas.font.size:=12;
image1.Canvas.font.color:=$120000ff;
image1.Canvas.TextOut(20,x+50,'字体变色效果演示');
l:=image1.Canvas.textwidth('字体变色效果演示');
h:=image1.Canvas.textheight('字体变色效果演示');
image1.Canvas.pen.color:=clGreen;
image1.Canvas.moveto(20,h+x+50-2);
image1.Canvas.lineto(20+l,h+x+50-2);
pic.topleft.x:=30;
pic.topleft.y:=tt;
pic.bottomright.x:=pic.topleft.x+100;
pic.bottomright.y:=pic.topleft.y+80;
image1.canvas.stretchdraw(pic,map);
image1.Canvas.pen.color:=clGreen;
image1.Canvas.moveto(0,pic.topleft.y+80);
image1.Canvas.lineto(pic.topleft.x+100,pic.topleft.y+80);
end;它的程序还有这一段!