Form1.Brush.Bitmap:=Image1.Picture.Bitmap;
上面的对.bmp文件有效,但对.jpg文件无效。如何使.jpg文件平铺于窗口中?
上面的对.bmp文件有效,但对.jpg文件无效。如何使.jpg文件平铺于窗口中?
解决方案 »
- 用TWebBrowser.Navigate('c:\123.xls')打开后,如何用程序实现在Sheet间的跳转?
- 将scktsrvr.exe中的监听端口设置为80后,scktsrvr.exe不能运行。
- 数据库同步问题
- 为什么HTTP控件返回的是代理服务器的地址?
- 播放 module 音乐
- listview用法
- 比内急还急。project project1.exe raised excption。。。
- 问一个简单的也很重要的问题
- ClientDataSet在QuickReport只能显示第一行记录,怎么回事?
- 如何判断出某一字符串中存放的值是否是一个有效的TDateTime型数据?
- 简单问题:如何更改我的应用程序的图标啊?
- 在edit框中输入文字不允许出现空格,这个问题怎么解决?
begin
bitmap:=tbitmap.Create;
bitmap.LoadFromFile('ppmm.bmp');
end;
procedure TForm1.FormPaint(Sender: TObject);
var
x,y,w,h:longint;
begin
with bitmap do
begin
w:=width;
h:=height;
end;
y:=0;
while y<height do
begin
x:=0;
while x<width do
begin
canvas.Draw(x,y,bitmap);
inc(x,w);
end;
inc(y,h);
end;
end;
BMP: TBitmap;
JPEG: TJPEGImage;//首先将jpg格式的图片转换成BMP格式的,然后就可以实现你的功能了
if (RightStr(OpenPictureDialog1.FileName,4)) = '.jpg')then
begin
JPEG := TJPEGImage.Create;
JPEG.LoadFromFile(OpenPictureDialog1.FileName);
BMP.Assign(JPEG);
JPEG.Free;
end;
var
x,y,w,h:longint;
Pic:TPicture;
begin
pic:=TPicture.Create;
Pic.LoadFromFile('c:\fall06.jpg');
with pic do
begin
w:=width;
h:=height;
end;
y:=0;
while y<height do
begin
x:=0;
while x<width do
begin
canvas.StretchDraw(Rect(x,y,x+w,y+h),pic.Graphic);
inc(x,w);
end;
inc(y,h);
end;
Pic.Free;
end;
在Onresize 事件中也要添加该代码!
ok!