unit Unit1;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.ExtCtrls;
type
TForm1 =
class(TForm)
ScrollBox1: TScrollBox;
Image1: TImage;
procedure Image1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormActivate(Sender: TObject);
procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
x1,x2,y1,y2:Integer;
implementation
{$R *.dfm}
procedure TForm1.FormActivate(Sender: TObject);
var i:Integer;
begin
for i := 0
to 30
do
begin
image1.Canvas.MoveTo(30*i, 0);
image1.Canvas.LineTo(30*+i, image1.Height);
end;
end;
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
image1.canvas.Pen.Color:=clwhite;
image1.Canvas.Rectangle(x1,y1,x2,y2);
end;
procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
image1.canvas.Pen.Color:=clblack;
x1:=X;
x2:=X+100;
y1:=Y;
y2:=Y+100;
image1.canvas.Pen.Color:=clblack;
image1.Canvas.Rectangle(x1,y1,x2,y2);
end;
end.