- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
procedure drawGird( var image1: TImage; needAxisLines: Boolean = True );
var
xP, yP: Integer;
xC, yC: Double;
h, w, tx, ty: Integer;
Text: String;
begin
image1.Canvas.FillRect( image1.ClientRect );
accuracy := 1 / cellSize;
image1.Canvas.Brush.Style := bsClear;
xC := p2cX( 0 );
while forC( xC, p2cX( image1.Width ), accuracy ) do
if floor( xC * cellSize ) mod cellSize = 0 then
begin
xP := c2pX( xC );
image1.Canvas.Pen.Color := clSilver;
image1.Canvas.MoveTo( xP, 0 );
image1.Canvas.LineTo( xP, image1.Height );
if ( needaxislines ) and ( abs( xC ) > 0.5 ) and
( xP > 30 ) and ( xP < image1.Width - 30 ) then
begin
image1.Canvas.Pen.Color := clBlack;
image1.Canvas.MoveTo( xP, c2pY( -0.5 ) );
image1.Canvas.LineTo( xP, c2pY( 0.5 ) );
end;
end;
yC := p2cY( 0 );
while forC( yC, p2cY( image1.Height ), accuracy ) do
if floor( yC * cellSize ) mod cellSize = 0 then
begin
yP := c2pY( yC );
image1.Canvas.Pen.Color := clSilver;
image1.Canvas.MoveTo( 0, yP );
image1.Canvas.LineTo( image1.Width, yP );
if ( needaxislines ) and ( abs( yC ) > 0.5 ) and
( yP > 30 ) and ( yP < image1.Height - 30 ) then
begin
image1.Canvas.Pen.Color := clBlack;
image1.Canvas.MoveTo( c2pX( -0.5 ), yP );
image1.Canvas.LineTo( c2pX( 0.5 ), yP );
end;
end;
xC := p2cX( 0 );
while forC( xC, p2cX( image1.Width ), accuracy ) do
if floor( xC * cellSize ) mod cellSize = 0 then
begin
xP := c2pX( xC );
if ( needaxislines ) and ( abs( xC ) > 1.5 ) and
( xP > 30 ) and ( xP < image1.Width - 30 ) then
begin
image1.Canvas.Pen.Color := clBlack;
Text := IntToStr( floor( xC ) );
h := image1.Canvas.TextHeight( Text ) div 2;
w := image1.Canvas.TextWidth( Text ) div 2;
image1.Canvas.TextOut( xP - w, c2pY( -0.5 ) + ( h + 3 ) *
( ( floor( abs( xC ) ) mod ( ( ( w * 2 + 8 ) div cellSize ) +
1 ) ) ), Text );
end;
end;
yC := p2cY( 0 );
while forC( yC, p2cY( image1.Height ), accuracy ) do
if floor( yC * cellSize ) mod cellSize = 0 then
begin
yP := c2pY( yC );
if ( needaxislines ) and ( abs( yC ) > 1.5 ) and
( yP > 30 ) and ( yP < image1.Height - 30 ) then
begin
image1.Canvas.Pen.Color := clBlack;
Text := IntToStr( floor( yC ) );
h := image1.Canvas.TextHeight( Text ) div 2;
w := image1.Canvas.TextWidth( Text ) div 2;
image1.Canvas.TextOut( c2pX( -0.5 ) - w * 2 - 2, yP - h, Text );
end;
end;
image1.Canvas.Brush.Style := bsSolid;
end;
Dummy00001 30.07.2011 15:34 # 0
bugmenot 30.07.2011 15:47 # +6
guest 30.07.2011 16:06 # −1
guest 30.07.2011 16:49 # −10
Одна строка кода, для того, чтобы нарисовать нарисовать пиписюнчик.
Пиписюнчик - зачем писать больше?
guest 30.07.2011 16:56 # −3
guest 30.07.2011 17:38 # −2
обломись
TarasB 30.07.2011 18:02 # 0
guest 30.07.2011 18:03 # −3
guest 30.07.2011 18:13 # +2
guest 30.07.2011 18:30 # −1
ling 01.08.2011 11:30 # 0
inkanus-gray 01.08.2011 17:05 # 0
guest 01.08.2011 23:42 # 0
используют функции высшего порядка
Fai 02.08.2011 15:39 # −2
guest 02.08.2011 22:16 # 0
Функциональные боги уже давно на карибах, а ты всё продолжаешь писать код.
Fai 03.08.2011 19:11 # −2
guest 03.08.2011 22:17 # 0
Fai 03.08.2011 22:32 # 0
Tairesh 15.09.2011 15:35 # +1
:D
roman-kashitsyn 15.09.2011 15:48 # +1
Tairesh 15.09.2011 15:51 # 0
guest8 09.04.2019 11:15 # −999