unit WerkPlan;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, jpeg, Grids;
type
TPercentRect = record
Left, Top, Width, Height: double;
end;
TForm1 = class(TForm)
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
ScrollBox1: TScrollBox;
Image1: TImage;
Button3: TButton;
procedure FormCanResize(Sender: TObject; var NewWidth, NewHeight: Integer;
var Resize: Boolean);
procedure FormCreate(Sender: TObject);
procedure FormMouseWheelDown(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
procedure FormMouseWheelUp(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
FPercent: TPercentRect;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
NewWidth,NewHeight: Integer;
begin
NewWidth := round(Image1.Width * 1.25);
NewHeight := round(Image1.Height * 1.25);
Image1.Width := NewWidth;
Image1.Height := NewHeight;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
NewWidth,NewHeight: Integer;
begin
NewWidth := round(Image1.Width / 1.25);
NewHeight := round(Image1.Height / 1.25);
Image1.Width := NewWidth;
Image1.Height := NewHeight;
end;
procedure TForm1.FormCanResize (Sender: TObject; var NewWidth,
NewHeight: Integer; var Resize: Boolean);
var
NewLeft, NewTop: integer;
begin
NewLeft := round(ClientWidth / 100 * FPercent.Left);
NewTop := round(ClientHeight / 100 * FPercent.Top);
NewWidth := round(ClientWidth / 100 * FPercent.Width);
NewHeight := round(ClientHeight / 100 * FPercent.Height);
Button1.SetBounds(NewLeft, NewTop, NewWidth, NewHeight);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FPercent.Left := Button1.Left / ClientWidth * 100;
FPercent.Top := Button1.Top / ClientHeight * 100;
FPercent.Width := Button1.Width / ClientWidth * 100;
FPercent.Height := Button1.Height / ClientHeight * 100;
end;
procedure TForm1.FormMouseWheelDown(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
var
NewWidth,NewHeight: Integer;
begin
NewWidth := round(Image1.Width / 1.03);
NewHeight := round(Image1.Height / 1.03);
Image1.Width := NewWidth;
Image1.Height := NewHeight;
end;
procedure TForm1.FormMouseWheelUp(Sender: TObject; Shift: TShiftState;
MousePos: TPoint; var Handled: Boolean);
var
NewWidth,NewHeight: Integer;
begin
NewWidth := round(Image1.Width * 1.03);
NewHeight := round(Image1.Height * 1.03);
Image1.Width := NewWidth;
Image1.Height := NewHeight;
end;
end.