Unit1
var
Form1: TForm1;
pen1,
brush1, rect1, circl1: boolean;
cl:TColor;
drag:boolean;
procedure TForm1.FormCreate(Sender: TObject);
begin
image1.Canvas.Brush.Color:=clWhite; image1.Canvas.FillRect(ClientRect);
end;
procedure TForm1.N6Click(Sender: TObject);
begin
Form2.ShowModal;
end;
procedure TForm1.N2Click(Sender: TObject);
begin
if
OpenDialog1.Execute then image1.Picture.LoadFromFile(OpenDialog1.filename);
end;
procedure TForm1.N7Click(Sender: TObject);
begin
image1.Canvas.Brush.Color:=clWhite;
image1.Canvas.FillRect(ClientRect);
pen1:=false;
brush1:=false;
end;
procedure TForm1.N8Click(Sender: TObject);
begin
If
ColorDialog1.Execute then
cl:= ColorDialog1.color;
end;
procedure TForm1.ColorGrid1Click(Sender: TObject);
begin
cl:=ColorGrid1.ForegroundColor;
end;
procedure TForm1.FormMouseMove(Sender: TObject; Shift:
TShiftState; X,
Y: Integer);
begin
if
drag then image1.Canvas.LineTo(x,y);
end;
procedure TForm1.FormMouseUp(Sender: TObject; Button:
TMouseButton;
Shift:
TShiftState; X, Y: Integer);
begin
drag:=false;
end;
procedure TForm1.ToolButton1Click(Sender: TObject);
begin
pen1:=false;
Brush1:=true;
rect1:=false;
circl1:=false;
end;
procedure TForm1.ToolButton2Click(Sender: TObject);
begin
pen1:=false;
Brush1:=false;
rect1:=true;
circl1:=false;
end;
procedure TForm1.ToolButton3Click(Sender: TObject);
begin
pen1:=false;
Brush1:=false;
rect1:=false;
circl1:=true;
end;
procedure TForm1.ToolButton4Click(Sender: TObject);
begin
pen1:=true;
Brush1:=false;
rect1:=false;
circl1:=false;
end;
procedure TForm1.Image1MouseDown(Sender: TObject;
Button: TMouseButton;
Shift:
TShiftState; X, Y: Integer);
begin
if pen1 then
begin
image1.Canvas.Pen.Color:=cl;
drag:=true;
image1.Canvas.MoveTo(x,y);
end;
if
brush1 then
begin
image1.Canvas.Brush.Color:=cl;
image1.Canvas.FillRect(ClientRect);
end;
end;
procedure TForm1.Image1MouseMove(Sender: TObject;
Shift: TShiftState; X,
Y: Integer);
begin
if drag
then image1.Canvas.LineTo(x,y);
end;
procedure TForm1.Image1MouseUp(Sender: TObject;
Button: TMouseButton;
Shift:
TShiftState; X, Y: Integer);
begin
drag:=false;
end;
procedure TForm1.N9Click(Sender: TObject);
begin
Form3.ShowModal;
end;
unit2;
procedure TForm2.Button1Click(Sender: TObject);
begin
x:=Edit1.Text;
y:=Edit2.Text;
form1.Image1.Width:=x;
form1.Image1.Height:=y;
form1.Image1.Visible:=true;
Form2.Close;
form1.SetFocus;
end;
unit3
procedure
TForm3.FormCreate(Sender: TObject);
begin
Edit1.Text:='' ;
Edit2.Text:='';
x1:=form1.Image1.Width ;
y1:=Form1.Image1.Height ;
Edit1.Text:= x1;
Edit2.Text:=y1;
end;
procedure
TForm3.Button1Click(Sender: TObject);
begin
x4:=Edit1.Text;
y4:=Edit2.Text;
form1.Image1.Width:=x4;
form1.Image1.Height:=y4;
form1.Image1.Visible:=true;
Form3.Close;
form1.SetFocus;
end;
Комментариев нет:
Отправить комментарий