unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, ComCtrls;
type
TForm1 =
class(TForm)
Image1: TImage;
Button2: TButton;
Button1: TButton;
procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
pt: TPoint;
Image1WidthOrg,Image1HeightOrg : Integer;
implementation
{$R *.dfm}
procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if ssLeft
in Shift
then begin
Image1.Canvas.LineTo(X, Y);
end;
end;
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
image1.Canvas.Pen.Color:=ClRed;
image1.Canvas.Pen.Width:=3;
image1.Canvas.MoveTo(X, Y);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Image1.Stretch:=True;
Image1.autosize:=False;
Image1.Width:=2*Image1.Width;
Image1.Height:=2*Image1.Height;
Button2.Enabled:=false;
Button1.Enabled:=true;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Image1.Stretch:=True;
Image1.autosize:=False;
Image1.Width:=Image1WidthOrg;
Image1.Height:=Image1HeightOrg;
Button1.Enabled:=false;
Button2.Enabled:=true;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
bmp: TBitmap;
begin
bmp:=TBitmap.Create;
bmp.width:=Image1.Width;
bmp.Height:=Image1.Height;
Image1.Picture.Bitmap.assign(bmp);
Image1WidthOrg:=Image1.Width;
Image1HeightOrg:=Image1.Height;
bmp.Free;
end;
end.