如何将JPG格式的图像放大和缩小,请高手指点!!!! 如何将JPG格式的图像放大和缩小,请高手指点!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 转贴,请参考1、在Delphi IDE 中新建Project1(包含Form1s),在Form1上放置Image1、Label1。Image1.AutoSize为True,Label1.Align为alClient,Form1.WindowState为wsMaximized。2、程序代码如下。unit Unit1;interfaceusesWindows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,ExtCtrls, StdCtrls, jpeg, ComCtrls;typeTForm1 = class(TForm)Image1: TImage;Label1: TLabel;procedure Label1MouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);procedure Label1MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);procedure Label1MouseUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);procedure FormShow(Sender: TObject);private{ Private declarations }public{ Public declarations }end;varForm1:TForm1;Old:Tpoint;ImageLeft:Integer;ImageTop:Integer;MoveOrNot:Boolean;implementationuses Unit2;{$R *.DFM}procedure TForm1.Label1MouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);beginif Button=mbLeft thenbeginLabel1.Cursor:=crHandPoint;Old.X:=X;Old.Y:=Y;ImageLeft:=Image1.Left;ImageTop:=Image1.Top;MoveOrNot:=True;end;end;procedure TForm1.Label1MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);beginif MoveOrNot thenbeginImage1.Left:=ImageLeft+(X-Old.X);if (Image1.Left>=0) thenImage1.Left:=0else if (Image1.Left < Form1.Width-Image1.Width) thenImage1.Left:=Form1.Width-Image1.Width;Image1.Top:=ImageTop+(Y-Old.Y);if (Image1.Top>=0) thenImage1.Top:=0else if (Image1.Top < Form1.Height-Image1.Height) thenImage1.Top:=Form1.Height-Image1.Height;end;end;procedure TForm1.Label1MouseUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);begin// MoveOrNot:=False;Label1.Cursor:=crDefault;end;procedure TForm1.FormShow(Sender: TObject);beginImage1.Left:=0;Image1.top:=0;end;end. 将其转为BMP格式,然后再调整大小之后再保存为JPG的格式 寻找志同道合的网友!一起研究远控! 高分求解 关于 idTcpClient 传文件的问题. 如何将EXE文件打包成安装程序 初学Delphi第一章的问题 如何在WINXP/2K下读取BIOS的内容? delphi里如果编译纯代码? ComboBox_department我要让它不可以输入,而只能选择 局域网问题! 菜鸟怎样变高手? 如何在Dll文件中播放Flash文件 TextBox 一个框同时显示多国字符问题(高分急,目前不能正常显示) 为什么截取不到WM_KEYDOWN消息?
1、在Delphi IDE 中新建Project1(包含Form1s),在Form1上放置Image1、Label1。Image1.AutoSize为True,Label1.Align为alClient,Form1.WindowState为wsMaximized。
2、程序代码如下。unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, jpeg, ComCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
Label1: TLabel;
procedure Label1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Label1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Label1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1:TForm1;
Old:Tpoint;
ImageLeft:Integer;
ImageTop:Integer;
MoveOrNot:Boolean;
implementation
uses Unit2;
{$R *.DFM}
procedure TForm1.Label1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button=mbLeft then
begin
Label1.Cursor:=crHandPoint;
Old.X:=X;
Old.Y:=Y;
ImageLeft:=Image1.Left;
ImageTop:=Image1.Top;
MoveOrNot:=True;
end;
end;
procedure TForm1.Label1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if MoveOrNot then
begin
Image1.Left:=ImageLeft+(X-Old.X);
if (Image1.Left>=0) then
Image1.Left:=0
else if (Image1.Left < Form1.Width-Image1.Width) then
Image1.Left:=Form1.Width-Image1.Width;
Image1.Top:=ImageTop+(Y-Old.Y);
if (Image1.Top>=0) then
Image1.Top:=0
else if (Image1.Top < Form1.Height-Image1.Height) then
Image1.Top:=Form1.Height-Image1.Height;
end;
end;
procedure TForm1.Label1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
// MoveOrNot:=False;
Label1.Cursor:=crDefault;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Image1.Left:=0;
Image1.top:=0;
end;
end.
之后再保存为JPG的格式