314
Canvas->StretchDraw(TRect(0,0,40,40),MyGraphic);
CopyRect
. Bir sohani nusxalash.
CopyMode
. Nusxalash usuli. Xuddi Mode xossasiga o`xshash.
Yuqoridagi funksiya va usullardan foydalanib biz C++
Builderda ixtiyoriy
grafikni hosil qilishimiz mumkin. Masalan,
ning garafigini chizish.
6.6-listing.
ning garafigini chizish.
Canvas->MoveTo(15,15);
Canvas->Pen->Color=RGB(255,255,0);
for(int i=0;i<30;i++) {
Canvas->LineTo(i*10,(i*i)*10);}
Rangli
quyosh
Canvas->MoveTo(ClientWidth/2,ClientHeight/2);
Canvas->Pen->Color=RGB(random(255),random(255),random(255));
Canvas->LineTo(random(ClientWidth),random(ClientHeight));
To`g`ri burchakli to`rtburchak.
Canvas->Rectangle(50,50,150,150);
Fon o`rnatish
Canvas->Brush->Style=bsCross;
TRect tRect(0,0,100,100);
Canvas->FillRect(tRect);
Fonli ellips
Canvas->Brush->Style=bsDiagCross;
Canvas->Pen->Color = clBlue;
Canvas->Pen->Mode=pmNotCopy;
Canvas->Ellipse(0,0,500,500);
Matn
chiqarish
AnsiString vasS="Matn";
315
Canvas->Font->Color=clRed;
Canvas->Font->Size=50;
Canvas->TextOutA(50,50,vasS);
Besh yulduz
TPoint tPoints[6];
Canvas->Pen->Color = clRed;
Canvas->Pen->Width=3;
tPoints[0].x = 40;
tPoints[0].y = 10;
tPoints[1].x = 20;
tPoints[1].y = 60;
tPoints[2].x = 70;
tPoints[2].y = 30;
tPoints[3].x = 10;
tPoints[3].y = 30;
tPoints[4].x = 60;
tPoints[4].y = 60;
tPoints[5].x = 40;
tPoints[5].y = 10;
Canvas->Polyline(tPoints,5);