如何将JPG格式的图像放大和缩小,请高手指点!!!!
解决方案 »
- 如何使被点击的tstringgrid 的单元格背景颜色改变,而且不变,直到双击才恢复?
- EnTest.dll 是什么
- KeyDown中的key如何转化成对应的字符?
- 服务器写方法处理?不够分再给!
- internet 临时文件夹下的文件大小是否可以得到
- 散分:绌作 顺风票据通 最新版本V2.2 http://member.skycn.com/soft/10168.html 新鲜出炉!
- 在*.dll中我要对应用这个*.dll的程序中的控件进行编程的话,要怎么样才能实现???
- 如何实现select的组合查询,在线等待!!!
- 买了张盘,可是没有序列号!!有吗?谢谢
- delphi6.0的分布式程序到底怎么发布
- 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的格式