Курсовая работа: Система координат канви

void TBall::Draw()

{ with Form1->Image1->Canvas do

{ Brush->Color = col;

Pen->Color = col;//clBlack;

Ellipse(Trunc(x-r), Trunc(y-r),

Trunc(x+r), Trunc(y+r));

Brush->Color = clWhite;

Pen->Color = clWhite;

Ellipse(Trunc(x-r*sqrt(2)/2*0.5-2), Trunc(y-r*sqrt(2)/2*0.5-2),

Trunc(x-r*sqrt(2)/2*0.5+2), Trunc(y-r*sqrt(2)/2*0.5+2));

Brush->Color = col;

Font->Color = clWhite - col;

if(ShowID )

{ TextOut(Trunc(x-4), Trunc(y-8), IntToStr(ID)); }

Refresh; } }

void TCue->Draw()

{ int x1, y1, x2, y2, x3, y3;

Brush->Color = clYellow;

Pen->Color = clYellow;

Pen->Width = 4;

x1 = Trunc(ToBall->x+cos(Angle)*(ToBall->R+energy));

y1 = Trunc(ToBall->y+sin(Angle)*(ToBall->R+energy));

x2 = Trunc(ToBall->x+cos(Angle)*(ToBall->R+CueLength+energy));

y2 = Trunc(ToBall->y+sin(Angle)*(ToBall->R+CueLength+energy));

x3 = Trunc(ToBall->x-cos(Angle)*1000);

y3 = Trunc(ToBall->y-sin(Angle)*1000);

MoveTo(x1, y1);

LineTo(x2, y2);

Pen->Width = 1;

К-во Просмотров: 559
Бесплатно скачать Курсовая работа: Система координат канви