求救!关于图象的放大缩小 用activex。就是微软里自带的imgedit控件。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 将image的图像 stretch的属性true然后你就可以调节image的大小就可以缩放,满屏了 //==============================================================================//改变图片大小******************************************************************//==============================================================================procedure FitBitmap(const Source, Target: string; const X, Y:integer; const ColorBit: TPixelFormat);var aBMP, bBMP: TBitmap; ScaleX, ScaleY: real;begin aBMP := TBitmap.Create; bBMP := TBitmap.Create; try aBMP.LoadFromFile(Source); ScaleY := aBMP.Height/Y; ScaleX := aBMP.Width/X; bBMP.Width := Round(aBMP.Width/ScaleX); bBMP.Height := Round(aBMP.Height/ScaleY); bBMP.PixelFormat := pf8bit; SetStretchBltMode(bBMP.Canvas.Handle,COLORONCOLOR); Stretchblt(bBMP.Canvas.Handle,0,0,bBMP.Width,bBMP.Height,aBMP.Canvas.Handle,0,0,aBMP.Width,aBMP.Height,srccopy); bBMP.SaveToFile(Target); finally aBMP.Free; bBMP.Free; end;end; //==============================================================================//在画布上调整图像大小**********************************************************//==============================================================================procedure StretchBitmap(ImageBMP: TBitmap; Canvas: TCanvas; Rect: TRect);var Bits: HBITMAP; Info: PBitmapInfo; Image: Pointer; InfoSize, ImageSize: DWORD; DIBWidth, DIBHeight: Longint;begin try Bits := ImageBMP.Handle; GetDIBSizes(Bits, InfoSize, ImageSize); GetMem(Info, InfoSize);//Info := MemAlloc(InfoSize); try GetMem(Image, ImageSize);//Image := MemAlloc(ImageSize); try GetDIB(Bits, 0, Info^, Image^); with Info^.bmiHeader do begin DIBWidth := biWidth; DIBHeight := biHeight; end; StretchDIBits(Canvas.Handle, Rect.Left, Rect.Top, Rect.Right - Rect.Left, Rect.Bottom - Rect.Top, 0, 0, DIBWidth, DIBHeight, Image, Info^, DIB_RGB_COLORS, SRCCOPY); finally FreeMem(Image, ImageSize); end; finally FreeMem(Info, InfoSize); end; except On E:Exception do begin raise; exit; end; end;end; webbrowser控件的问题 各位老师: 关于工资扣税的问题,从触发器如何做.下面的代码不知错在那里.请帮帮我吧. Windows7 终于要来了,我的老奔不会再也奔不动了(P4 3.0E HT+1G DDR400) 关于窗体刷新问题,急! 关于cxgrid的summary问题,高分求助 如何将中英文混合的字符串转换成unicode编码? 如何在最小化窗体的时候,把它在任务栏中隐藏? 没分了, 还请教小弟一个问题... ==这里有没有苏州的程序员?进来帮我一下. 一个打印的问题! 各位高手,那里有关于delphi6所有控件的介绍啊? 三层结构的问题?
然后你就可以调节image的大小就可以缩放,满屏了
//改变图片大小******************************************************************
//==============================================================================
procedure FitBitmap(const Source, Target: string; const X, Y:integer; const ColorBit: TPixelFormat);
var aBMP, bBMP: TBitmap;
ScaleX, ScaleY: real;
begin
aBMP := TBitmap.Create;
bBMP := TBitmap.Create;
try
aBMP.LoadFromFile(Source);
ScaleY := aBMP.Height/Y;
ScaleX := aBMP.Width/X;
bBMP.Width := Round(aBMP.Width/ScaleX);
bBMP.Height := Round(aBMP.Height/ScaleY);
bBMP.PixelFormat := pf8bit;
SetStretchBltMode(bBMP.Canvas.Handle,COLORONCOLOR);
Stretchblt(bBMP.Canvas.Handle,0,0,bBMP.Width,bBMP.Height,aBMP.Canvas.Handle,0,0,aBMP.Width,aBMP.Height,srccopy);
bBMP.SaveToFile(Target);
finally
aBMP.Free;
bBMP.Free;
end;
end;
//在画布上调整图像大小**********************************************************
//==============================================================================
procedure StretchBitmap(ImageBMP: TBitmap; Canvas: TCanvas; Rect: TRect);
var Bits: HBITMAP;
Info: PBitmapInfo;
Image: Pointer;
InfoSize, ImageSize: DWORD;
DIBWidth, DIBHeight: Longint;
begin
try
Bits := ImageBMP.Handle;
GetDIBSizes(Bits, InfoSize, ImageSize);
GetMem(Info, InfoSize);//Info := MemAlloc(InfoSize);
try
GetMem(Image, ImageSize);//Image := MemAlloc(ImageSize);
try
GetDIB(Bits, 0, Info^, Image^);
with Info^.bmiHeader do
begin
DIBWidth := biWidth;
DIBHeight := biHeight;
end;
StretchDIBits(Canvas.Handle, Rect.Left, Rect.Top, Rect.Right - Rect.Left, Rect.Bottom - Rect.Top, 0, 0, DIBWidth, DIBHeight, Image, Info^, DIB_RGB_COLORS, SRCCOPY);
finally
FreeMem(Image, ImageSize);
end;
finally
FreeMem(Info, InfoSize);
end;
except
On E:Exception do
begin
raise;
exit;
end;
end;
end;