在Form页面(非image控件)的FormMouseWheelUp和FormMouseWheelDown事件中
执行下面的代码可以实现图片缩放功能
即在滚轮事件时调整图片的大小.
image1.Width := image1.Width + Integer(Trunc(image1.Width/10));
image1.Height := image1.Height + Integer(Trunc(image1.Height/10));
image1.Width := image1.Width - Integer(Trunc(image1.Width/10));
image1.Height := image1.Height - Integer(Trunc(image1.Height/10));
在Image控件的OnMouseDown事件 OnMouseUp 事件 OnMouseMove事件中
分别执行下面代码可以实现图片拖动.
procedure TFkf_tools.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button=mbleft then
begin
CanMove := true;
XPos := X;
YPos := Y;
end;
end;
procedure TFkf_tools.Image1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button=mbleft then
begin
CanMove