delphi TJPEGImage 图像从哪里导入
2012-08-21
展开全部
用OpenDialog 控件 打开文件
procedure TForm1.Button1Click(Sender: TObject);
var
pji: Tjpegimage;
begin
Image1.Picture := nil;
Image1.Refresh;
if OpenDialog1.execute then
begin
try
pji := Tjpegimage.Create;
pji.LoadFromFile(OpenDialog1.FileName);
Image1.Picture.Graphic := pji;
Image1.width := Image1.Picture.width;
Image1.Height := Image1.Picture.Height;
finally
pji.Free;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
pji: Tjpegimage;
begin
Image1.Picture := nil;
Image1.Refresh;
if OpenDialog1.execute then
begin
try
pji := Tjpegimage.Create;
pji.LoadFromFile(OpenDialog1.FileName);
Image1.Picture.Graphic := pji;
Image1.width := Image1.Picture.width;
Image1.Height := Image1.Picture.Height;
finally
pji.Free;
end;
end;
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询