Yuav Ua Li Cas Sau Ib Feem

Cov txheej txheem:

Yuav Ua Li Cas Sau Ib Feem
Yuav Ua Li Cas Sau Ib Feem

Video: Yuav Ua Li Cas Sau Ib Feem

Video: Yuav Ua Li Cas Sau Ib Feem
Video: 8 yam tsis txhob ua thaum sib deev tag tsis li yuav phom sij txog lub neej txoj sia. 2024, Kaum ib hlis
Anonim

Delphi qhib qhov chaw ua haujlwm yog ua raws li kev siv ntau yam. Ib qho kev tivthaiv yog tus lej uas ua haujlwm tshwj xeeb uas siv cov khoom, cov xwm txheej, thiab cov txheej txheem. Thaum tsim kom muaj kev tivthaiv, koj yuav tsum tau tsim kom muaj txiaj ntsig ntawm kev hloov pauv thiab siv tus txheej txheem ntawm kev tshwm sim tuav haujlwm. Txhawm rau siv rau hauv cov phiaj xwm, cov khoom siv tshiab yuav tsum muaj nyob hauv pob.

Yuav ua li cas sau ib feem
Yuav ua li cas sau ib feem

Nws yog qhov tsim nyog

Delphi kev loj hlob ib puag ncig

Cov Lus Qhia

Kauj ruam 1

Xaiv hom tivthaiv los tsim. Nws tuaj yeem yog cov khoom siv Windows, khoom siv nraaj, tswj thaj chaw, lossis cov khoom siv tsis pom. Kuj, koj yam khoom tuaj yeem txais los ntawm lwm chav kawm uas twb muaj lawm. Txiav txim siab rau cov haujlwm uas koj yuav muab cov khoom coj los ua.

Kauj ruam 2

Pib Delphi kev loj hlob ib puag ncig. Hauv cov ntawv thov ua zaub mov tseem ceeb, qhib Cov Ntawv Sib Tham, Cov Khoom Tshiab. Hauv cov ntawv qhib lub thawv uas tshwm, hauv Ancestor Hom teb, xaiv chav kawm kev tivthaiv uas koj xav hloov. Yog tias koj tsis siv cov cuab yeej cuab tam, hauv chav Kawm Lub Npe, tsuas yog sau lub npe rau cov ntawv tshiab uas tau pib nrog tus ntawv "T". Hauv Palette Nplooj ntawv teb, sau lub npe ntawm cov khoom siv tiv thaiv tom qab kev teeb tsa, tom qab ntawd nyem lub pob lus Create Unit. Txoj kev loj hlob ib puag ncig yuav cia li tsim ib tus qauv rau cov feem tshiab. Ib qho piv txwv ntawm qhov tsim tawm Pascal code:

chav tsev HMOOBtn;

interface

siv

Qhov rai, SysUtils, Cov Lus, Chav Kawm, Tswj, Duab, Duab, StdCtrls, Dialogs;

hom

TMyBtn = chav kawm (TButton)

ntiag tug

tiv thaiv

laj mej pej xeem

luam tawm

xaus;

cov txheej txheem Sau npe;

kev siv

cov txheej txheem Sau npe;

pib

Cov Tswv Cuab Tso Npe ('MyComponents', [TMyBtn]);

xaus;

kawg.

Nyob rau tib lub sijhawm, tsis yog tsuas yog chav kawm tshiab TMyBtn tau tsim los ntawm cov txheej txheem chav kawm ntawm tus kab mob TButton, tab sis kuj yog cov txheej txheem rau kev sau npe ntawm cov tshiab hauv cov tivthaiv palette tau piav qhia.

Kauj ruam 3

Hauv cov lus qhia ntiag tug, piav qhia txhua qhov teb, cov txheej txheem thiab cov haujlwm uas koj xav tau los tsim cov khoom tivthaiv, thiab lawv yuav muaj cov xwm txheej zais. Qhia lub npe teb (nrog rau tsab ntawv "F"), nws hom. Piv txwv, cov ntawv sau tseg ntawm daim foos FDatas: integer qhia txog qhov sib txawv ntawm FDatas ntawm ib hom lej. Hauv seem tiv thaiv, sau cov phiaj xwm kev tshwm sim koj xav tau, piv txwv li, los ntawm cov khoom siv keyboard lossis nas yuam sij. Ntxiv mus, thaum tsim muaj cov chav kawm, koj yuav tsum teeb tsa lo lus tseem ceeb rau - dhau mus ua tus tswj hwm niam txiv ntawm tus qauv kev tshwm sim. Piv txwv li, cov txheej txheem nkag tuaj Nyem; thim xyuas kom tseeb tias lub pob nyem ntawm lub pob yog cuam tshuam.

Kauj ruam 4

Lub luag haujlwm thiab cov txheej txheem ntawm cov khoom muaj rau tus neeg siv tau piav qhia nyob rau hauv pej xeem thiab tshaj tawm cov lus qhia, piv txwv, siv cov ntaub ntawv sau tseg ntawm daim ntawv: ua haujlwm TSysInfo. GetUser: txoj hlua lossis khoom ntiag tug MachName: txoj hlua. Hauv cov lus qhia kawg, thaum siv lo lus cuab yeej, koj tuaj yeem qhia cov khoom uas yuav muaj nyob hauv tus kuaj xyuas khoom.

Kauj ruam 5

Sau cov lej cim rau kev ua haujlwm ntawm cov feem hauv cov txheej txheem tshaj tawm thiab cov haujlwm. Qauv handler code:

kev ua haujlwm MachName: txoj hlua;

var

p: tus lej;

nrog: PChar;

pib

c: = stralloc (p);

xaus;

kawg.

Kauj Ruam 6

Nruab qhov tivthaiv rau hauv qhov project koj xav tau. Los ntawm Delphi cov ntawv qhia zaub mov tseem ceeb, xaiv Cheebtsam, Txuas Cheebtsam. Hauv cov ntawv qhib lub thawv uas tshwm sim, qhib ib qho ntawm cov ntawv: nkag mus rau hauv cov pob exsisting, yog tias koj xav tau nruab qhov khoom tivthaiv rau hauv cov pob uas twb muaj lawm, lossis Nkag mus rau hauv lub Pob tshiab - rau hauv ib qho tshiab. Nyem OK thiab paub meej tias daim ntawv thov kev thov kom sau dua lub pob (yog tias tsim nyog). Tom qab ntawd, cov ntawv sau tau npaj yuav npaj siv.

Pom zoo: