procedure
TForm1
.
DrawPlace;
Var
x1,y1,i,j,CM,CR,n,wr,hr,w,h,m,f:
Integer
;
r:TRect;
Bitmap: TBitmap;
begin
Bitmap := TBitmap
.
Create;
Bitmap
.
Width := PaintBox1
.
Width;
Bitmap
.
Height := PaintBox1
.
Height;
CM := StrToInt(Edit1
.
Text);
CR := StrToInt(Edit2
.
Text);
w := PaintBox1
.
Width;
h := PaintBox1
.
Height;
n := CM
div
CR;
x1:=
0
;
y1:=
0
;
wr := w
div
n;
hr := (h-((CR-
1
)*
40
))
div
CR;
m:=
1
;
for
i:=
1
to
CR
do
begin
for
j:=
1
to
n
do
begin
Bitmap
.
Canvas
.
Pen
.
Color := clBlack;
Bitmap
.
Canvas
.
Brush
.
Color := clGray;
r
.
Top := y1;
r
.
Left := x1;
r
.
Right := x1+wr;
r
.
Bottom := y1+hr;
Bitmap
.
Canvas
.
Rectangle(r);
Bitmap
.
Canvas
.
Pen
.
Color := clMaroon;
if
hr>wr
then
f:=wr
else
f := hr;
Bitmap
.
Canvas
.
Font
.
Size := round(f*
0.3
);
Bitmap
.
Canvas
.
Brush
.
Color := clGray;
r
.
Top := y1+
5
;
r
.
Left := x1+
5
;
r
.
Right := x1+wr-
5
;
r
.
Bottom := y1+hr-
5
;
Bitmap
.
Canvas
.
TextOut(x1+
5
,y1+
5
,IntToStr(m));
Inc(m);
x1 := wr*j;
end
;
y1 := (hr*i)+
40
*i;
x1 :=
0
;
PaintBox1
.
Canvas
.
CopyRect(PaintBox1
.
ClientRect,Bitmap
.
Canvas,Rect(
0
,
0
,Bitmap
.
Width,Bitmap
.
Height));
end
;