Lub Turbo Pascal lub cajmeem tso cai rau koj los ntawm kos cov duab muaj ntau yam duab ntawm lub vijtsam. Txhua lub duab nraaj yuav raug tsim ua siv cov ntsiab lus, kab, arcs. Pascal siv hom raster graphic hom nrog lub rooj daws teeb meem ntawm 640 x 480. Daim duab muaj nyob rau hauv kev teeb tsa cov kev sib koom tes ntawm pib thiab xaus cov ntsiab lus ntawm cov khoom kom pom rau cov txheej txheem nraaj. Cov xim ntawm cov khoom, cov tuab ntawm kab, nrog rau lawv cov style, kuj tau teeb tsa raws li cov cim ntawm cov txheej txheem nraaj. Txhawm rau kos siv software, koj yuav tsum txuas lub Pascal graphics module.
Tsim nyog
Turbo Pascal lub cajmeem ib puag ncig
Cov Lus Qhia
Kauj ruam 1
Rhuav tshem cov kev teeb tsa tshwj xeeb rau hauv nws cov khoom siv. Xaiv cov kab ib leeg, arcs, voj voog, duab plaub, thiab cov ntsiab lus. Cov no yog cov duab uas tuaj yeem kos tau siv cov txheej txheem Turbo Pascal.
Kauj ruam 2
Thaum pib ntawm txoj haujlwm program, sib txuas cov qauv duab kab ke. Txhawm rau ua qhov no, sau kab ib kab li no: siv kab ntsuas. Tom ntej no, tsim cov lej sib txawv los pib tus qauv duab: var gdet, gm: integer.
Kauj ruam 3
Hauv lub cev ntawm cov programmes, tom qab pib cov ntsiab lus, pib ua cov hloov pauv, muab ib tus ntawm lawv tus nqi xoom, thiab lub cim thib ob pom. Tom ntej no, taw qhia qhov pib ntawm hom graphical drawing hom, nkag rau ib kab ntawm daim ntawv: initgraph (gdet, gm, ''). Tshem cov khoom siv coj los saib xyuas: cleardevice.
Kauj ruam 4
Teem xim tom qab rau kev kos duab thiab cov kab xim ntawm cov khoom yuav tsum tau kos. Siv cov txheej txheem SetBkColor (dawb) thiab SetColor (8) rau qhov no. Cov xim yuav tau teeb tsa muaj qhia hauv kev nkhaus. Hauv tag nrho, Pascal siv 16 xim, thiab txhua ntawm lawv tau qhia meej los ntawm tus lej lossis los ntawm ib lo lus los ntawm lub rooj xim tshwj xeeb.
Kauj ruam 5
Xav txog lub vijtsam dav dav nrog x-axis los ntawm sab laug mus rau sab xis thiab y-axis los ntawm sab saud mus rau hauv qab. Qhov tseem ceeb ntawm lub hauv paus ntawm txoj kev sib koom ua ke no, uas yog, nyob rau sab qaum tsev sab sauv ntawm lub vijtsam, yog txoj haujlwm ua ke (0, 0). Laij cov kab sib chaws ntawm txoj haujlwm xav tau ntawm thawj qhov khoom siv duab. Qhia txhua qhov ua kom sib haum rau teeb duab hauv cov kab ke no.
Kauj Ruam 6
Kos kab siv kab ntawv tus txheej txheem (x, y, x1, y1), qhov chaw tswj x, y yog qhov pib ntawm kab, thiab x1, y1 yog nws kawg. Hloov cov kab tuab lossis hom ntawv yog tias tsim nyog. Txhawm rau ua qhov no, siv cov txheej txheem SetLineStyle (0, 0, NormWidth) tus txheej txheem. Thawj qhov ntsuas ntawm tus txheej txheem tuaj yeem hloov cov kab los ntawm kev ua rau nws qhov khiav ceev, lossis kab kos rau kab - hloov tus lej no rau 1 lossis 2. Qhov ntsuas thib peb teeb lub tuab ntawm cov kab. Los ntawm lub neej ntawd, NormWidth parameter ib txwm teeb - nyias kab, rau cov kab tuab teeb ThickWidth. Hloov pauv hom kab yuav kos tom qab hu rau tus txheej txheem no.
Kauj Ruam 7
Tso cov taw tes rau ntawm lub vijtsam siv cov txheej txheem PutPixel (x, y, xim), ntawm no x thiab y kuj yog kev sib koom tes ntawm taw tes, thiab xim yog nws cov xim. Ua ntej kos duab kaw, koj tuaj yeem tsim nws cov sau. Txhawm rau ua qhov no, hu rau SetFillStyle (EmptyFill, 0) cov txheej txheem, qhov twg thawj tus qauv qhia meej qhov khoom ua tiav ntawm daim duab, thiab lub thib ob qhia meej cov xim sau.
Kauj ruam 8
Lub voos xwm fab xwm txheej yog kos duab siv Rectangle (x, y, x2, y2) cov txheej txheem - cov chaw ua haujlwm tau teeb tsa sab saud sab sauv thiab qis sab xis ntawm cov duab. Txhawm rau kos lub voj voos, sau kab ntawv Lub voj voog (x, y, R), qhov twg x, y, R yog qhov haujlwm ntawm nruab nrab thiab kab hluav taws xob ntawm lub voj voog, kuj nyob hauv pixels. Ib lub ellipse yog qhov nyuaj rau kev kos, ntau ntau qhov kev siv tau rau qhov no: Ellipse (x, y, BegA, EndA, RX, RY). Ntawm no x, y yog tib qho chaw ntawm lub ellipse, thiab BegA thiab EndA qhia lub kaum sab xis uas pib thiab xaus daim duab elliptical. Cov hloov pauv RX, RY teeb tsa lub vojvoog ellipse raws x thiab y axes, feem.
Kauj Ruam 9
Yog tias koj muaj cov duab, uas yooj yim kom kos rau hauv kev cais cais, siv cov txheej txheem MoveTo thiab LineTo rau qhov no. Ua ntej, txav tus cursor tam sim no mus rau qhov koj xav tau: MoveTo (x, y). Tom qab ntawv kos ib txoj kab los ntawm nws mus rau tom ntej taw qhia LineTo (x1, y1) thiab rov kos ib txoj kab ncaj nraim LineTo (x2, y2) thiab ntxiv kom txog thaum koj tau txais cov qauv duab thawj.
Kauj ruam 10
Qhov kawg ntawm kev kos duab hauv qhov program code, kaw kab nraaj nrog hom kab: ze ze. Xaus lub cev ntawm qhov kev pabcuam, zoo li ib txwm, nrog lo lus xaus. Tam sim no tus lej tuaj yeem muab tso ua ke thiab khiav rau kev tua.