Mavzu: C++ algoritmik tilining grafik imkoniyatlari. Reja


Na’muna:Yuqoridagi qragik operatorlardan foydalanib, sodda tasvirlar hosil qiling. Dastur loyihasi uchun


Download 118.18 Kb.
bet2/2
Sana20.06.2020
Hajmi118.18 Kb.
#120642
1   2
Bog'liq
C algoritmik tilining grafik imkoniyatlari


Na’muna:Yuqoridagi qragik operatorlardan foydalanib, sodda tasvirlar hosil qiling.

Dastur loyihasi uchun:

Forma oynasiga 1 ta Image, 5 ta Button (Shakl turini tanlash uchun) qo’yiladi. Har bir shakl turining Click hodisasi uchun quyidagi proseduradan foydalanamiz:



void __fastcall TForm1::Button1Click(TObject *Sender)

{

Image1->Canvas->Pen->Color=clBlue; // Uychaning tomi



Image1->Canvas->Pen->Width=5;

Image1->Canvas->MoveTo(100,100);

Image1->Canvas->LineTo(200,20);

Image1->Canvas->LineTo(300,100);

Image1->Canvas->LineTo(100,100);
}

//---------------------------------------------------------------------------


void __fastcall TForm1::Button2Click(TObject *Sender)

{

Image1->Canvas->Pen->Color=clRed; // asosiy tana qismi



Image1->Canvas->Pen->Width=5;

Image1->Canvas->Brush->Color=clYellow;

Image1->Canvas->Rectangle(115,100,285,300);
}

//---------------------------------------------------------------------------

void __fastcall TForm1::Button3Click(TObject *Sender)

{

Image1->Canvas->Pen->Color=clRed; // Eshiklar



Image1->Canvas->Pen->Width=3;

Image1->Canvas->Brush->Color=clPurple;

Image1->Canvas->Rectangle(170,230,200,300);

Image1->Canvas->Rectangle(200,230,230,300);

Image1->Canvas->Pen->Width=10;

}

//---------------------------------------------------------------------------



void __fastcall TForm1::Button4Click(TObject *Sender)

{

Image1->Canvas->Font->Size=20; // Matn



Image1->Canvas->Font->Color=clGreen;

Image1->Canvas->Brush->Color=clSilver;

Image1->Canvas->TextOut(350,20,"Mening dasturim");

}

//---------------------------------------------------------------------------



void __fastcall TForm1::Button5Click(TObject *Sender)

{

Image1->Canvas->Pen->Color=clPurple; // Gulcha va bargi



Image1->Canvas->Pen->Width=5;

Image1->Canvas->Ellipse(400,200,450,250);

Image1->Canvas->Ellipse(450,200,500,250);

Image1->Canvas->Ellipse(425,160,475,210);

Image1->Canvas->Pen->Color=clGreen;

Image1->Canvas->Pen->Width=5;

Image1->Canvas->MoveTo(450,225);

Image1->Canvas->LineTo(450,300);

Image1->Canvas->Ellipse(420,265,450,275);

Image1->Canvas->Ellipse(450,265,480,275);



}

Natija olish uchun barcha buttonlar ketma-ket tanlanadi.



Download 118.18 Kb.

Do'stlaringiz bilan baham:
1   2




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling