#include
#pragma hdrstop
45
#include "Unit1.h"
//---------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//----------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//----------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Canvas->TextOut(135,70,"WELCOME");
Canvas->MoveTo(80,90);
Canvas->LineTo(250,90);
Canvas->LineTo(150,40);
Canvas->LineTo(80,90);
Canvas->MoveTo(220,75);
Canvas->LineTo(220,50);
Canvas->LineTo(240,50);
Canvas->LineTo(240,81);
Canvas->Brush->Color=clMaroon;
Canvas->Brush->Style=bsCross;
Canvas->TextOut(240,65,"GOOD BYE");
Canvas->Rectangle(80,90,250,300);
Canvas->Brush->Color=clGreen;
Canvas->Rectangle(120,140,200,200);
}
//----------------------------------------------------------
2-rasm.
Dastur natisaida olinadigan tasvir
46
2-misol:
O‗zbekiston respublikasining davlat bayrog‘ini chizish.
Formaga
Button1
komponentasini o‗rnatib, uni
«Chizish»
deb nomlaymiz
va
Button2
komponentasini o‗rnatib uni
«Chiqish»
nomlaymiz. Bu komponentalar
uchun dastur kodini quyidagi ko‗rinishda yozamiz:
#include
#pragma hdrstop
#include "Unit1.h"
//------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//--------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Canvas->Pen->Color = clBlue;
Canvas->Brush->Color = clBlue;
Canvas->Rectangle(70,50,600,150);
// oy chizish
Canvas->Pen->Color = clBlue;
Canvas->Brush->Color = clWhite;
Canvas->Ellipse(80,55,170,145);
Canvas->Pen->Color = clBlue;
Canvas->Brush->Color = clBlue;
Canvas->Ellipse(105,55,195,145);
//yulduz chizish
Canvas->Font->Name = "Monotype Corsiva";
Canvas->Font->Color = clWhite;
Canvas->Font->Size = 28;
Canvas->TextOut(180,60," ***");
Canvas->TextOut(180,85,"****");
Canvas->TextOut(180,110,"*****");
Canvas->Pen->Color = clRed;
Canvas->Brush->Color = clRed;
Canvas->Rectangle(70,150,600,160);
Canvas->Pen->Color = clWhite;
Canvas->Brush->Color = clWhite;
Canvas->Rectangle(70,160,600,260);
Canvas->Pen->Color = clRed;
47
Canvas->Brush->Color = clRed;
Canvas->Rectangle(70,260,600,270);
Canvas->Pen->Color = clGreen;
Canvas->Brush->Color = clGreen;
Canvas->Rectangle(70,270,600,370);
}
//-------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Form1->Close(); }
Natijada quyidagi tasvirni olamiz (3-rasm):
3-rasm.
Dastur bajarilishi natijasida olingan tasvir
Sinоv sаvоllаri
1.
Borland С++ da tasvirlar bilan ishlash uchun qanday sinflardan
foydalaniladi?
2.
C++ tili qanday grafik imkoniyatlarga ega?
3.
Ekranda chizmalarni hosil qilish uchun qanday metodlarni bilasiz?
4.
Qanday bo‗yash turlari mavjud?
Tajriba ishini bajarish uchun topshiriq variantlari:
1. Borland С++ ning Canvas xossasining usullaridan foydalanib ixtiyoriy
grafik tasvir yarating.
2. Image komponentasidan foydalanib formaga rasmlarni o‗rnating va
uning xossalarini o‗zgartiring.
48
49
MUNDARIJA
№
Mavzu
Bet
1-
laboratoriya
ishi
Geologik kartalarni Corel Draw dasturida yaratish………..
3
2-
laboratoriya
ish
CAD tizimlarining amaliy dasturlarini interfeysini o‗rganish
va qo‗llash. …………………………………………….
6
3-
laboratoriya
ishi
MathCAD tizimlarida muhandislik masalalarini yechishda
matematik modellariga hisoblash eksperiment va sonli tahlilni
amalga oshirish………………………………...
15
4-
laboratoriya
ishi
Geologiyaga oid
texnik obyektlarga tegishli grafik modellarni
MatLab dasturlashtirish tizimida amaliy dasturlarda
ifodalash, qayta ishlash va vizuallashtirish…….
22
5-
laboratoriya
ishi
Geologiya va qidiruv mutaxassisligi uchun Kompas
dasturida amallar…………………………………….
32
6-
laboratoriya
ishi
Obyektga yo‗naltirilgan dasturlash tizimlarida strukturaviy
ilovalarni yaratish………………………….
37
7-
laboratoriya
ishi
Muhandislik masalalarini echishda dasturlash tizimlari
yordamida
grafika
va
multimedia
imkoniyatlaridan
foydalanish………………………………………….
42
Adabiyotlar:
Muharrir: Miryusupova Z.M.
Dostları ilə paylaş: |