Issuu on Google+

GUI izksxzkfeax fon~

7

fo.Mks”k iQkWeZl~

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

(GUI Programming with Windows Forms) bl vè;k; esa lfEefyr gSa %

7.3

ifjp; (Introduction) izkWiVhZt+] esFkMl rFkk bos.V~l (Properties, Methods And Events) oh- ch- MkWV usV ds daVªksy esa miyC/ dqN leku izkWiVhZ

7.4

(Some Common Properteis Available in VB.Net Controls) daVªksy ds dqN leku esFkM (Some Common Methods Of Control)

7.1 7.2

7.5 7.6 7.7 7.8 7.9 7.10 7.11 7.12 7.13 7.14 7.15 7.16 7.17 7.18 7.19 7.20 7.21 7.22 7.23 7.24 7.25 7.26 7.27 7.28

daVªksy ds dqN leku bos.V (Some Common Events of Control) VsDLVckWDl daVªksy (The TextBox Control) fjpVsDLVckWDl daVªksy (The RichTextBox Control) ysscy daVªksy (The Label Control) cVu (Button) fyLVckWDl daVªksy (The ListBox Control) dkWEcksckWDl daVªksy (The CombBox Control) psdckWDl daVªksy (The CheckBox Control) jsfM;ks cVu daVªksy (The Radio Button Control) isuy (Panel) xqzickWDl (GroupBox) fiDpj ckWDl (The PictureBox Control) LØkWyckj (ScrollBars) Vkbej (Timer) fyLVO;w (ListView) fVªO;w (TreeView) Vwyckj daVªksy (The Toolbar Control) LVsVlckj (StatusBar) fyadyscy (LinkLabel) Mk;ykWx ckWDl (Dialog Box) vksiu iQkby Mk;ykWx ckWDl (OpenFileDialog Box) lso iQkby Mk;ykWx ckWDl (SaveFileDialog Box) iQkW.V Mk;ykWx ckWDl (FontDialog Box) dyj Mk;ykWx ckWDl (Color Dialog Box) 149


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

7.1 ifjp; (Introduction) fo.Mkst+ iQkWeZl~ xzkfiQdy ;wt+j baVjisQl dks fodflr djus ds fy, fotqvy LVwfM;ks esa lcls egRoiw.kZ midj.k gSA ;g xzkfiQdy ;wt+j baVjisQl ,fIyds'ku fuekZ.k dk vk/kj gS A fotqvy LVwfM;ks esa cus ,fIyds'ku fo.Mkst+ iQkWeZ ds vfrfjDr dbZ daVªksyksa dk ,d ladyu gSA fo.Mkst+ iQkWeZ bu daVªksyksa dk okgd gksrk gS A fo.Mkst+ iQkWeZ fdlh iqLrd ds ,d i`"B ds leku gksrk gSA bl vè;k; esa ge xzkfiQdy ;wt+j baVjisQl dks fodflr djus ds fy, mi;ksx gksus okys daVªksyksa ds ckjs esa ppkZZ djsaxsA 7.2 izkWiVhZt+]

esFkMl rFkk bos.V~l

(Properties, Methods And Events)

fotqvy csfld ds lHkh vkWCtsDV ;Fkk iQkWeZ rFkk daVªksy ds vius izkWiVhZ] esFkM rFkk bos.V gksrs gSa A izkWiVhZ fdlh vkWCtsDV ds ,fVªC;wV gksrs gSa rFkk esFkM muds dk;Z vkSj bos.V muds jsLikWUl (response) gksrs gSa A mnkgj.k ds fy, dkj ,d vkWCtsDV gS rFkk blds vius izkWiVhZ] esFkM rFkk bos.V gSa A jax (color) ] xfr (speed) ] ewY; (price) fdlh dkj ds izkWiVhZ gks ldrs gSa A lHkh dkj ds ;s izkWiVhZ gksaxs ijUrq buds eku vyx vyx gks ldrs gSa A blh izdkj dkj ds esFkM tks ;g djrk gS gks ldrs gSa A LVkVZ (Start) ] LVkWi (Stop) ] ,fDlfyjsV (Accelerate) blds dk;Z ;k esFkM gks ldrs gSaA lHkh izdkj ds dkj ds fy, ;s esFkM leku gksaxs vfirq buds eku vyx vyx gksaxsA rFkk dkj ds dqN ckgjh bos.V ds foifjr izfrfdz;k gksaxs A mnkgj.k ds fy, dkj dk ba/u lekIr gksus ij D;k gksxkA dkj ds izkWiVhZ dk eku vxj fy[kk tk; rks bl izdkj gksxk & Car.Color = Aqua Car.Speed = 80 Car.Price = 320000

blh izdkj dkj ds esFkM bl izdkj gksxsa & Car.Start Car.Stop Car.Accelerate(50)

blh izdkj dkj ds bos.V NoFuel bl izdkj fy[ks tk,axs & Private Sub Car_NoFuel (...) Handles Car.NoFuel Car.Stopped = True End Sub

;gkWa dkj ds ba/u lekIr gksus ij dkj ds vkpj.k dk o.kZu gksrk gS A ftl izdkj vkius dkj ds mnkgj.k esa izkWiVhZ] esFkM rFkk bos.V ds dk;Z dks le>k Bhd blh izdkj fotqvy csfld MkWV usV ds vkWCtsDV gksrs gSa rFkk muds izkWiVhZ ] esFkM rFkk bos.V gksrs gSa ftugsa izksxzke esa iz;ksx djuk gksrk gS A

7.3 oh- ch- MkWV usV ds daVªksy esa miyC/ dqN leku izkWiVhZ (Some Common Properteis Available in VB.Net Controls)

150

oh- ch- MkWV usV esa <s+j lkjs daVªksy gSaA lcds vius&vius vyx&vyx izkWiVhZ] esFkM rFkk bos.V gSaA ;|fi lHkh ds dqN leku izkWiVhZ] esFkM rFkk bos.V gksrs gSaA bl [k.M esa mugha leku izkWiVhZ] esFkM rFkk bos.V dh ppkZ djsaxsA


7.3.1 AllowDrop izkWiVhZ AllowDrop izkWiVhZ ;g ladsr nsrk gS fd ;g daVªksy ;wtj ds }kjk MªSx dj MkVk dks bl ij MªkWi fd;s tkus ij Lohdkj djrk gS vFkok ughaA ;g ;fn True lsV gS rks lef>, fd bl daVªksy esa MªSx&MªkWi lqfo/k miyC/ gSA ;fn False gS rks lef>, fd bl ij MªSx MªkWi lqfo/k miyC/ ugha gSA ;g izkWiVhZ dqN daVªksy ;Fkk RichTextBox , WebBrowser bR;kfn esa miyC/ ugha gSA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

7.3.2 Anchor izkWiVhZ Anchor izkWiVhZ duVsuj ds fdl fdukjs ds lkFk daVªksy fdl izdkj tqM+k jgsxk rFkk ml isjs.V duVsuj ds lkFk blds vkdkj esa fdl izdkj cnyko iM+sxk ;g lsV djrk gSA Anchor izkWiVhZ baVjisQl

fMt+k;u ds fy, ,d csgn egÙoiw.kZ izkWiVhZ gSA ;g rc vkSj mi;ksxh gks tkrk gS] tc ,d iQkWeZ ij ,d ls vf/d daVªksy dks ,d ls vf/d dkWye rFkk iafDr esa ltkuk gSA mnkgj.k ds fy, vkius vius iQkWeZ esa ,d VsDLVckWDl tksM+k gS vkSj mldh Anchor izkWiVhZ esa Top lsV fd;k gSA vc vki tc VsDlVckWDl dh Anchor izkWiVhZ dks Top lsV djrs gSa vkSj bls ju djrs gSa rks VsDLV ckWDl vkSj iQkWeZ ds mijh fgLlk dh tks nwjh gS] og mlh vuqikr esa c<+rk gS] ijUrq iQkWeZ ds 'kh"kZ rFkk VsDLV ckWDl dh nwjh ugha cnyrhA bls fp=k 7.1 esa ns[k ldrs gSaA

fp=k 7.1 % iQkWeZ ij j[kk VsDLV ckWDl (ck;ha) vksj blds Anchor izkWiVhZ dks Top lsV djus ds i'pkr iQkWeZA Anchor izkWiVhZ esa Left, Top, Right, Bottom, (Top, Left), (Top, Left, Right), (Top, Left, Right, Bottom) bR;kfn tSls eku gksrs gSaA bugsa p;u djus ds fy, Anchor izkWiVhZ ds Mkmu ,sjks dks fDyd djrs gSa rFkk fp=k 7.2 dh Hkkafr eku dk p;u djrs gSaA

fp=k 7.2 % Anchor izkWiVhZ ds ekuksa dk p;u djrs gq, tc vki Anchor izkWiVhZ dks lsV dj ysrs gSa rks Dock izkWiVhZ dks lsV djus dh vko';drk ux.; gksrh gSA

151


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

7.3.3 BackColor izkWiVhZ BackColor izkWiVhZ dks lsV dj vki VsDLV ds cSdxzkm.M jax dks cnyrs gSaA bl izkWiVhZ ds Mkmu ,sjks dks tc vki fDyd djrs gSa rks Custom, Web rFkk System VSc ds vanj vkidks fofHkUu jaxksa dk ,d NksVk fo.Mks feyrk gSA (ns[ksa fp=k 7.3)

fp=k 7.3 % BackColor ds eku dks lsV djrs gq, 7.3.4 BackgroundImage izkWiVhZ BackgroundImage izkWiVhZ ls vki daVªksy ds cSdxzkm.M vkÑfr dks lsV dj ldrs gSaA cSdxzkm.M vkÑfr lsV djus ds fy, blds bfyifll cVu (...) dks fDyd djsaA rRi'pkr~ Select Resource Mk;ykWx ckWDl fp=k 7.4 dh Hkk¡fr iznf'kZr gksxkA

fp=k 7.4 : Select Resource Mk;ykWx ckWDl vius gkMZfMLd ;k bl izkstsDV iQksYMj ds Resources iQksYMj ls fdlh iQkby dks tksM+us ds Project resource file: ds vanj Import dks fDyd djsa vkSj vkd`fr iQkby dk p;u djsaA djus esa ;fn ;g iQkby vkids izkstsDV@lkWY;w'ku ds Resources iQksYMj esa rRdky miyC/ ugha rks Hkfo"; esa laxzfgr gks tk;sxkA ;g izkWiVhZ lHkh daVªksy ;Fkk TexBox, RichTextBox bR;kfn ds miyC/ ugha gksrkA 7.3.5 CausesValidation izkWiVhZ CausesValidation og eku lsV djrk gS tks ;g ladsr djrk 152

gS fd cVu (daVªksy) ds fDyd gksus ij oSfyMs'ku lEiUu gks

fy, ,slk gksxk fy,


;k ughaA fMiQkWYV ist oSfyMs'ku cVu ds fDyd fd;s tkus ij gksrk gsA blesa nks eku True vkSj False gksrs gSaA ist oSfyMs'ku dks jksdus ds fy, bldk eku False lsV fd;k tkrk gSA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~

7.3.6 Cursor izkWiVhZ

NOTES

daVªksy ij ekml ys tkus ij fdl izdkj ekml vkÑfr izdV gksxkA bls lsV djus ds fy, Cursor izkWiVhZ dh lgk;rk ysrs gSaA tc vki Cursor ds Mkmu ,sjks dks fDyd djsaxs rks vusd dlZj fn[ksaxsA bPNkuqlkj muesa ls ,d dk p;u dj ldrs gSaA (ns[ksa fp=k 7.5) 7.3.7 Dock izkWiVhZ Dock izkWiVhZ vkSj Anchor izkWiVhZ ,d nwljs ds lkFk feydj dk;Z djrs gSaA mnkgj.k ds fy, tc vki Anchor dks None lsV djrs gSa] rc Dock izkWiVhZ Hkh None gh lsV gksxkA Dock

izkWiVhZ daVªksy dk dkSu lk ckWMZj duVsuj (mnkgj.kkFkZ iQkWeZ] xzqickWDl] iSuy) ls lVk gksxk] ;g ifjHkkf"kr djrk gSA mnkgj.k ds fy, vki uksViSM ,fIyds'ku cuk jgs gSa] ftlesa vkius VsDLVckWDl ;k fjpVsDLVckWDl tksM+k gSA Li"V gS fd uksViSM ,fIyds'ku esa VsDLV ckWDl ;k fjp VsDLV ckWDl iwjs iQkWeZ ij iSQyk gqvk gksuk pkfg,A blds fy, vki VsDLV ckWDl ;k fjp VsDLV ckWDl ds pkjkss fdukjksa dks iQkWeZ ds lkFk lVkuk iM+sxkA blds fy, ge Dock izkWiVhZ esa Fill lsV djrs gSaA fp=k 7.6 esa Dock izkWiVhZ ds fofHkUu eku rFkk fp=k 7.7 esa Dock izkWiVhZ ds fofHkUu eku lsV djus ds iQyLo:i iQkWeZ ij blds IyslesUV dks n'kkZ;k x;k gSA

fp=k 7.5 % daVªksy dk dlZj izkWiVhZ lsV djrs gq,

fp=k 7.6 : Dock izkWiVhZ ds fofHkUu eku

153


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

fp=k 7.7 % Dock izkWiVhZ ds fofHkUu ekuksa ds mnkgj.k 7.3.8 Enabled izkWiVhZ Enabled izkWiVhZ daVªksy ds lfØ;rk ,oa fuf"Ø;rk dks lsV djrk gSA bldk ckbZ fMiQkWYV lsfVax True gksrk gSA ;fn ,slk gS rks blds lkFk dk;Z fd;k tk ldrk gSA ;fn ;g False gS rks ;g fuf"Ø;

gS vkSj blds lkFk dk;Z ugha fd;k tk ldrk gSA 7.3.9 Font izkWiVhZ Font izkWiVhZ daVªksy ds VsDLV ds iQkW.V dks lsV djrk gSA vki Font ds nk;ha vksj bfyifll cVu (...) dks fDyd dj Font Mk;ykWx ckWDl ls iQkW.V dk p;u dj ldrs gSa ;k fiQj Font ds tksM+

fpUg dks fDyd dj blds lHkh fodYiksa ;Fkk iQkW.V dk uke] vkdkj bR;kfn dk p;u dj ldrs gSaA (ns[kas fp=k 7.8)

fp=k 7.8 : Font izkWiVhZ ds fofHkUu fodYi 7.3.10 ForeColor izkWiVhZ ForeColor izkWiVhZ daVªksy ds iQksjxzkm.M jax dks lsV djrk gSA ForeColor ds Mkmu ,sjks dks fDyd djus ij BackColor dh rjg gh jaxksa dk ,d NksVk fo.Mks izdV djrk gSA 154


7.3.11 Location izkWiVhZ Location izkWiVhZ daVªksy duVsuj (;Fkk iQkWeZ] iSuy] xziqckWDl bR;kfn) ij vkWCtsDV dg¡k fLFkr gS] ;g lsV djrk gSA Location izkWiVhZ dk X eku dkWye dk LFkku rFkk Y eku iafDr dk LFkku fu/

kZfjr djrk gSA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

7.3.12 Name izkWiVhZ Name izkWiVhZ daVªksy ds uke dks lsV djrk gSA gj daVªksy dk ,d Name izkWiVhZ gksrk gSA bldk

mi;ksx dksM esa vkids daVªksy dks O;Dr djus ds fy, gksrk gSA ckbZ fMiQkWYV daVªksy ds uke muds uke ds ckn 1] 2] 3 bR;kfn tksM+ dj fn;s tkrs gSaA mnkgj.k ds fy, VsDLV ckWDl daVªksy dk ckbZ fMiQkWYV uke TextBox1, TextBox2, TextBox3 bR;kfn gksrk gSA fdUrq vki izkWiVhZt fo.Mks ls Name izkWiVhZ dk mi;ksx dj fdlh Hkh daVªksy dk uke bPNkuqlkj ns ldrs gSaA Name izkWiVhZ lwph ds o.kZekyk Øe esa lkekU;r% rhljs LFkku ij gksrk gSA daVªksy dk uke v{kj ds lkFk 'kq: gksuk pkfg, rFkk ;g vf/d cM+k u gks rks csgrj gSA blesa la[;k rFkk vaMjLdksj ekU; gSA ijUrq fojke fpÉ (punctuation) rFkk fjDr LFkku Lohdk;Z ugha gksrk gSA lkFk gh vPNh izksxzkfeax izpyu ds vuqlkj fdlh daVªksy ds 'kq:vkr rhu v{kjksa ds iwoZlxZ (prefix) tks bl daVªksy dk laf{kIr :i gksrk gS ls vPNk ekuk tkrk gSA mnkgj.k ds fy, VsDLV ckWDl] cVu] yscy rFkk fyLV ckWDl ds uke esa txt, btn, IbI rFkk Ist Øe'k% dksfMax ds fy, lqfo/ktud gksrk gSA 7.3.13 Size izkWiVhZ Size izkWiVhZ daVªksy ds vkdkj dks lsV djrk gSA ;fn fdlh vkWCtsDV dk AutoSize izkWiVhZ True lsV

gS rks bl izkWiVhZ dh izklafxdrk lekIr gks tkrh gS A 7.3.14 TabIndex izkWiVhZ TabIndex izkWiVhZ duVsuj esa daVªksy ds VSc Øekad dks lsV djrk gSA VSc iksth'ku og gS tks vki VSc dh lgk;rk ls ,d LFkku (daVªksy) ls nwljs LFkku (daVªksy) dks iQksdl djus ds fy, djrs gSaA mnkgj.k ds fy, vkius ,d cVu] ,d yscy] ,d VsDLVckWDl blh Øe esa cuk;k gS rks bldk VSc iksth'ku 0, 1 vkSj 2 gksxkA vFkkZr~ VSc dh lgk;rk ls lcls igys cVu fiQj yscy vkSj var esa VsDLVckWDl dk p;u@iQksdl gksxkA 7.3.15 Text izkWiVhZ Text izkWiVhZ daVªksy ds dSI'ku (Caption) dks lsV djrk gSA mnkgj.kkFkZ yscy ij Nis VsDLV Label1 dks cnyus ds fy, bldk iz;ksx gksrk gSA blesa vki ,Dlsl dh lsV dj ldrs gSa ftlds lkFk ALT dh dks nckus ij og iQksdl gks tk;xkA blds fy, VsDLV izkWiVhZ ds eku ds ml v{kj ds igys & Vkbi djsa A ;g iQhpj vkidks dh&cksMZ ds lkFk dke djus dk foDyi nsrk gS A (ns[ksa ySc mnkgj.k 7.1) 7.3.16 UseMnemonic izkWiVhZ

vkius ,Dlsl dh dk iz;ksx fd;k gksxk A ,Dlsl dh dk iz;ksx fdlh vkWCtsDV dks dh&cksMZ ls ,Dlsl djus esa gksrk gS A oh ch MkWV usV esa Hkh vki fofHkUu daVªksy ds fy, ,Dlsl dh fMiQkbu dj ldrs gSa ysfdu blds fy, vkidks UseMnemonic izkWiVhZ dks True lsV djuk gksxk A UseMnemonic izkWiVhZ fo'ks"k v{kjksa dks fueksfud dh rjg le>k tk; vFkok ugha bls lsV djrk gS A ySc vH;kl 7.1 (Lab Exercise 7.1) ,d fo.Mkst+ ,fIyds'ku cuk,a ftlij nks cVu rFkk ,d yscy iQkWeZ ij tksM+sa A rFkk nksuksa cVu esa ,Dlsl dh lsV djsaA bls ju djkus ds fy, ALT dh ds lkFk ,Dlsl dh dk iz;ksx djsaA bldk baVjiQsl fp=k LA7.1 dh HkkWafr rFkk izkWiVhZ bl izdkj gksxk &

155


izksxzkfeax fon fotqvy csfld MkWV usV

vkWCtsDV iQkWeZ

NOTES

yscy cVu cVu

izkWiVhZ

eku

Name

Form1

MaximizeBox

False

Text

Lab Exercise 7.1

Name

Label1

Text

ckb fMiQkWYV jgus nsa A

Name

btnGreet

Text

&Greet

Name

btnFarewell

Text

&Farewell

fp=k LA7.1 % ySc vH;kl 7.1 dk baVjiQsl lek/ku % ➪ File esU;w dks fDyd djsa rFkk New Project dk p;u djsa A ➪ New Project Mk;ykWx ckWDl [kqyus ds i'pkr Templates isu esa Windows Application dks fDyd djsaA ➪ Name VsDLVckWDl esa Lab Exercise 7.1 Vkbi djsa rFkk OK dks fDyd djsa A mlds ckn ,d u;k fo.Mkst iQkWeZl izkstsDV [kqysxk A ➪ iQkWeZ ij iz'u esa fn, x, fooj.k ds vuqlkj VwyckWDl ls daVªksy dks tksMsa+A rFkk iz'ukuqlkj muds izkWiVhZ dks lsV djsa rFkk fp=kkuqlkj mugsa ltk,Wa A ➪ Greet cVu dks nks ckj fDyd djsa vkSj btnGreet_Click bos.V gS.Myj ds fy, fuEufyf[kr dksM fy[ksaµ Label1.Text = "Welcome"

➪ mlds ckn Farewell cVu dks nks ckj fDyd djsa vkSj btnFarewell_Click bos.V gS.Myj ds fy, fuEufyf[kr dksM fy[ksaµ Label1.Text = "Good Bye" 156

➪ F5 nck,¡A rFkk ALT + G vkSj ALT + F nckdj yscy ds VsDLV dks n'kkZ,a A ;gkWa vkius ekml dk iz;ksx ugha fd;k gSA (ns[ksa fp=k LA7.2)


GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

fp=k LA7.2 : ySc vH;kl 7.1 dk ifj.kke 7.4

daVªksy ds dqN leku esFkM

(Some Common Methods Of Control)

fiNys [k.M esa vkius oh- ch- MkWV usV daVªksy ds leku izkWiVhZ ds ckjs esa tkuk A ;s ,sls izkWiVhZ gSa tks lkekU;r% lHkh daVªksy esa ik;s tkrs gSa A bl [k.M esa oh- ch- MkWV usV daVªksy ds leku esFkM ds ckjs esa tkusaxs A 7.4.1 BringToFront()

daVªksy ds <sj (,d ij ,d ltk gqvk) ls fdlh fo'ks"k daVªksy dks Åij djrk gSA mnkgj.k ds fy, vkius Button1, Button2, Button3 vkSj Button4 ,d ds Åij ,d ltk;k gqvk gSA Button3 dks Åij ykus ds fy, Button3. BringToFront( ) LVsVes.V dk;Z djsxkA 7.4.2 Dispose()

daVªksy ds }kjk mi;ksx fd;s x;s lalk/uksa (resources) dks fjyht djrk gSA mnkgj.k ds fy, PictureBox1.Image.Dispose fiDpjckWDl daVªksy ds n~okjk fy, x, LFkku dks eseksjh lss eqDr djrk gS A 7.4.3 Contains()

cwfy;u eku (True ;k False ) ykSVkrk gS tks ;g lwfpr djrk gS fd dksb fotqvy csfld Collection vkWCtsDV ,d [kkl dh ds lkFk dksb vo;o (element) j[krk gS vFkok ugha A 7.4.4 DoDragDrop()

MªSx&MªkWi fozQ;k dks 'kq: djrk gSA 7.4.5 FindForm()

ml iQkWeZ dks izkIr djrk gS ftl ij ;g daVªksy gSA 7.4.6 Focus()

daVªksy ij buiqV iQksdl lsV djrk gSA 7.4.7 GetChildAtPoint()

ml pkbYM daVªksy dks iqu% izkIr djrk gS tks fd ,d fu/kZfjr yksds'ku ij gS] ;g Li"V djrs gq, fd ,d [kkl izdkj ds pkbYM daVªksy dh vis{kk dh tk; vFkok ughaA 7.4.8 Hide()

daVªksy dks fNikrk gSA 7.4.9 Refresh()

daVªksy ls blds Dykb.V ,fj;k dks jí djokrk gS rFkk lc dks fiQj ls 'kq: djus dk vkxzg djrk gSA

157


izksxzkfeax fon fotqvy csfld MkWV usV

7.4.10 Select()

daVªksy dks ,fDVosV djrk gSA 7.4.11 Show()

NOTES

daVªksy dks n'kkZrk gSaA

7.5 daVªksy ds dqN leku bos.V (Some Common Events of Control) ftl izdkj vkius fiNys [k.M esa oh- ch- MkWV usV daVªksy ds leku izkWiVhZ rFkk esFkM ds ckjs esa tkuk A blh izdkj oh ch MkWV usV ds dqN ,sls bos.V gSa tkss lkekU;r% lHkh daVªksy esa ik;s tkrs gSa A bl [k.M esa oh- ch- MkWV usV daVªksy ds leku bos.V ds ckjs esa tkusaxsA 7.5.1 AutoSizeChanged

;g bos.V MkWV usV izsQeodZ ds 2.0 laLdj.k eas gh ifjfpr gqvk gSA ;g rc ?kfVr gksrk gS] tc Autosize izkWiVhZ ds eku esa cnyko gksrk gSA 7.5.2 Click daVªksy ds fDyd gksus ij ?kfVr gksrk gSA 7.5.3 ControlAdded

;g rc ?kfVr gksrk gS tc vkids daVªksy dysD'ku (;Fkk iQkWeZ) esa dksbZ u;k daVªksy tqM+rk gSA 7.5.4 ControlRemoved

;g ControlAdded dk foijhr gSA ;g rc ?kfVr gksrk gS] tc dksbZ daVªksy iQkWeZ ls gVrk gSA 7.5.5 DoubleClick

fdlh daVªksy (;Fkk cVu) ds nks ckj fDyd gksus ij ?kfVr gksrk gSA 7.5.6 Enter

daVªksy ij ,.Vj dh nckus ij ?kfVr gksrk gSA 7.5.7 LocationChanged

fdlh daVªksy dk Location izkWiVhZ ds cnyus ij ?kfVr gksrk gSA 7.5.8 Move

fdlh daVªksy ds ewo gksus ij ?kfVr gksrk gSA fparu % bos.V D;k gS \ bos.V dks le>us dk ,d mnkgj.k bl rjg gSA vki eksckby dk mi;ksx vius fe=k ls ckrphr djus ds fy, djrs gSaA vc vkius ,d izksxzke cuk;k rFkk vius fe=k dks ;g dg fn;k fd mls dkWy ugha djsxk cfYd fjax ds ek?;e ls ladsr nsxk A ;fn ,d fjax gks rks le>ks izksxzke jí vkSj ;fn nks&ckj fjax gksrk gS rks le>ks izksxzke ikfjrA vc vkidk fe=k blh ladsr ds vuqlkj viuk dk;Z djsxk A ,slk dqN oh-ch- MkWV usV esa Hkh gksrk gS A ,d fjax dks Click rFkk nks fjax dks DoubleClick bos.V dh rjg le> ldrs gSaA D;ksafd ;s ,d fo'ks"k ifjfLFkfr esa gks jgs gSaA bos.V ij vk/kfjr LVsVes.V dks bos.V gS.Myj ;k lc izkWlhtj ;k lc&:Vhu dgrs gSaA 7.6 VsDLVckWDl

158

daVªksy

(The TextBox Control)

ekbØkslkWÝV oMZ] uksViSM] oMZiSM ;k vU; fdlh oMZ izkslslj esa vkius dk;Z fd;k gksxkA vki bu lkWÝVos;j ds ftl {ks=k esa dqN fy[krs gSa og oLrqr% VsDLVckWDl gh gksrk gSA VsDLVckWDl dk mi;ksx iz;ksDrk ls MkVk izfo"V djokus ds fy, gksrk gSA blds vfrfjDr bldk iz;ksx VsDLV fMLIys djokus esa Hkh gks ldrk gS] tks fd dsoy iz;ksDrkvksa dks i<+us ds fy, gksrk gSA bl daVªksy ds lkFk Multiline] ScrollBars] ReadOnly ds vfrfjDr dbZ lkjh izkWiVhZ vkrs gSa] tks VsDLVckWDl ls dbZ dk;Z djokus esa mi;ksxh gksrs gSaA VsDLVckWDl esa VsDLV fy[kus ds fy, bldk Text izkWiVhZ gksrk gS ;|fi vki lkekU;r% dksfMax ds ekè;e ls gh rFkk lh/s&lh/s Hkh VsDLV fy[k ldrs gSaA blds izeq[k izkWiVhZ dks vxys [k.M esa fy[kk x;k gSA fp=k 7-9 esa iQkWeZ ij fofHkUu izdkj ds VsDLVckWDl dks fn[kk;k x;k gSA


GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

fp=k 7.9 : iQkWeZ ij fofHkUu izdkj ds iznf'kZr VsDLVckWDl 7.6.1 VsDLVckWDl daVªksy ds izeq[k izkWiVhZ (Main Properties Of The TextBox Control)

bl [k.M esa oh- ch- MkWV usV ds VsDLVckWDl daVªksy ds izkWiVhZ ds ckjs esa tkurs gSa A buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt+ fo.Mks ds ek?;e ls lsV dj ldrs gSa A rFkk dqN tks izkWiVhZt+ fo.Mks esa izdV ugha gksrs gSa mugsa ju le; esa dksM ds ek?;e ls lsV dj ldrs gSa A gkykafd lHkh izkWiVhZ dks izksxzke ds ek?;e ls dksM fy[k dj lsV fd;k tk ldrk gS A izkWiVhZ AutoSize

BackColor BorderStyle CanUndo ForeColor HideSelection

ImeMode

Lines Margin MaximumSize

fooj.k AutoSize og izkWiVhZ gS tks ml eku dks lsV djrk gS ;k izkIr djrk gS tks ;g Li"V djrk gS fd VsDLVckWDl dh mQ¡pkbZ Lor% gh ?kVs ;k c<s+ tc bl daVªksy dk vkdkj cnyk tk;A BackColor og izkWiVhZ gS tks VsDLVckWDl ds cSdxzkm.M jax dks lsV djrk gS ;k izkIr djrk gSA BorderStyle VsDLVckWDl daVªksy ds ckWMZj Vkbi dks lsV djrk gSA ;g izkWiVhZ ;wtj fiNys vkWijs'ku dks vuMw dj ldrk gS vFkok ugha bldks Li"V djus gsrq eku ykSVkrk gSA ForeColor izkWiVhZ dk mi;ksx VsDLVckWDl ds iQksjxzkm.M jax dks lsV djrk gSA iQksjxzkm.M jax VsDLVckWDl esa Vkbi gksus okys VsDLV dk jax gksrk gSA ;g izkWiVhZ ml eku dks lsV djrk gS tks ;g Li"V djrk gS fd VsDLVckWDl daVªksy esa p;fur VsDLV VsDLVckWDl ls iQksDl gVus ds ckn Hkh gkbykbVsM jgrk gS vFkok ughaA ImeMode izkWiVhZ daVªksy ds buiqV esFkM ,fMVj eksM dks lsV djrk gSA buiqV esFkM ,fMVj ,d izksxzke gS tks ;wtj dks LVS.MMZ dh&cksMZ dh lgk;rk ls tkikuh dkuth v{kj tSls tfVy v{kjksa rFkk ladsrksa dks izfo"V djus dh {kerk iznku djrk gSA ;g izkWiVhZ VsDLV ckWDl daVªksy esa VsDLV dh ykbuksa dks lsV djrk gSA ;g izkWiVhZ MkWV usV izsQeodZ laLdj.k 2-0 esa u;k gSA ;g daVªksyksa ds eè; LFkku lsV djrk gSA ;g izkWiVhZ MkWV usV izsQeodZ laLdj.k 2-0 esa u;k gSA ;g ml vkdkj dks lsV djrk gS tks og vf/dre lhek gksrk gS ftls GetPreferredSize Li"V djrk gSA

159


izksxzkfeax fon fotqvy csfld MkWV usV

MaxLength

NOTES

MinimumSize

Modified

Multiline

PasswordChar

ReadOnly

ScrollBars

SelectedText 160

MaxLength izkWiVhZ VsDLVckWDl daVªksy ds fy, ,d vR;ar egRoiw.kZ izkWiVhZ

gSA ;g VsDLV ckWDl esa v{kjksa dh og vfèkdre la[;k lsV djrk gS tks ;wtj Vkbi dj ldrk gS ;k isLV dj ldrk gSA bl izkWiVhZ dk mi;ksx dj vki VsDLVckWDl esa izfo"V fd;s tkus okys iksLVy dksM rFkk nwjHkk"k la[;k tSls ekuksa dh yEckbZ dks lhfer dj ldrs gSa ;k MkVkcsl esa MkVk dks izfo"V djus gsrq fd;s tk jgs VsDLVckWDl dh vf/dre lhek dks lhfer dj ldrs gSaA ;g izkWiVhZ MkWV usV izsQeodZ laLdj.k 2-0 esa igyh ckj ifjfpr djk;k x;k gSA ;g ml vkdkj dks lsV djrk gS tks og U;wure lhek gksrk gS ftls GetPreferredSize Li"V djrk gSA bl izkWiVhZ dk mi;ksx ml eku dks lsV djrk gS tks ;g lwfpr djrk gS fd ;wtj }kjk VsDLVckWDl ds fo"k;oLrq dks la'kksf/r fd;k x;k gS tc ls ;g daVªksy cuk gS ;k blds fo"k;&oLrq dks vafre ckj lsV fd;k x;k gSA ;g lR; gksrk gS ;fn daVªksy ds fo"k;&oLrq dks la'kksf/r fd;k x;k vU;Fkk vlR;A vlR; bldk fMiQkWYV eku gSA vki bl izkWiVhZ dk mi;ksx ;g fu/kZfjr djus ds fy, dj ldrs gSa fd VsDLV ckWDl daVªksy ds fo"k;&oLrq dks la'kksf/r fd;k x;k gSA vki bl izkWiVhZ dk mi;ksx dksM esa djds ;g ladsr dj ldrs gSa fd ,fIyds'ku ds }kjk VsDLVckWDl daVªksy esa la'kksèku fd;s x;s gSaA bl izkWiVhZ dk mi;ksx osfyMs'ku rFkk MkVk laj{k.k (data saving) esFkM ds }kjk ;g lqfuf'pr djus ds fy, fd;k tk ldrk gS fd VsDLVckWDl esa cnyko fd;s x;s gSa vFkok ugha rkfd cnys x;s fo"k;&oLrq dks osfyMsV ;k lqjf{kr fd;k tk ldsA ;g izkWiVhZ ml eku dks lsV djus ds fy, mi;ksx fd;k tkrk gS tks ;g crkrk gS fd bl VsDLVckWDl esa VsDLV ,d ykbu ls vf/d tksM+k tk ldrk gS vFkok ughaA bldk mi;ksx flaxy ykbu VsDLV ckWDl esa ikloMZ ds v{kjksa ds fNikus ds fy, gksrk gSA ;fn VsDLVckWDl dk Multiline izkWiVhZ lR; lsV gS rks PasswordChar izkWiVhZ lsV djus ij dksbZ fotqvy izHkko ugha gksrk gSA PasswordChar ds lR; lsV gksus ij VsDLVckWDl esa dV] dkWih rFkk isLV dk;Z lEiUu ugha gks ldrs pkgs bldk Multiline izkWiVhZ lR; gks ;k vlR; gksA bl izkWiVhZ dk mi;ksx VsDLV ckWDl esa VsDLV ckWDl dks dsoy i<+us ;ksX; cukus esa gksrk gSA ;fn ;g izkWiVhZ lR; gks rks blds VsDLV esa dksbZ la'kks/ u ugha fd;k tk ldrk gSA ;g izkWiVhZ eYVhykbu VsDLVckWDl esa dkSuls LØkWyckj izdV gksaxs bldks lsV djrk gSA vki blesa LØkWyckj ugha lsV djus ds fy, None, dsoy {kSfrt LØkWyckj izdV djus ds fy, Horizontal, mnxz LØkWyckj izdV djus ds fy, Vertical rFkk nksuksa LØkWyckj dks izdV djus ds fy, Both lsV dj ldrs gSaA {kSfrt LØkWyckj rc izdV gksrk gS tc VsDLVckWDl dk WordWrap izkWiVhZ vlR; lsV gks rFkk nksuksa esa dksbZ Hkh LØkWyckj rc rd izdV ugha gksrk tc rd fd bldk Multiline izkWiVhZ lR; (True) lsV u fd;k x;k gksA ;g izkWiVhZ VsDLVckWDl ds orZeku p;fur VsDLV dks Li"V djrk gqvk eku lsV djrk gSA


SelectionLength ;g izkWiVhZ VsDLVckWDl esa p;fur v{kjksa dh la[;k dks lsV djrk gS ;k

GUI izksxzkfeax fon~

mlds ckjs esa crkrk gSA SelectionStart izkWiVhZ VsDLV ckWDl esa p;fur VsDLV ds izkjfEHkd IokbUV dks lsV djrk gS ;k muds ckjs esa crkrk gSA VsDLVckWDl ds mWapkb rFkk pkSM+kbZ dks lsV djrk gSA ;k mlds ckjs esa crkrk gSA bldh Å¡pkbZ VsDLVckWDl ds iQkW.V vkdkj izkWiVhZ ij Hkh fuHkZj djrk gSA ;g izkWiVhZ VsDLVckWDl esa VsDLV dk vykbues.V dSlk gksxk ;g lsV djrk gSA bl izkWiVhZ dk mi;ksx VsDLVckWDl esa VsDLV dh yEckbZ dks izkIr djus esa gksrk gSA vki bl izkWiVhZ dk mi;ksx VsDLVckWDl ds VsDLV ds vanj VsDLV ds fo'ks"k fLaVªx gsrq lpZ tSls dk;ksZa ds fy, fLaVªx esa dSjsDVjksa dh la[;k dks lqfuf'pr dj ldrs gSaA bl izkWiVhZ dk mi;ksx daVªksy dks n`'; j[kus ;k vn`'; djus gsrq eku lsV djus esa gksrk gSA ;g izWkiVhZ rc dk;Z djsxk tc bldk Multiline izkWiVhZ True gksA ;g izWkiVhZ VsDLVckWDl (eYVhykbu) esa oMjSi dh lqfo/k miyC/ gks vFkok u gks dks Li"V djrk gSA bldk ckbZ fMiQkWYV eku True gksrk gSA

fo.Mks”k iQkWeZl~

SelectionStart Size

TextAlign TextLength

Visible WordWrap

NOTES

7.6.2 VsDLVckWDl ds eq[; esFkM (Main Methods of TextBox)

bl [k.M esa oh- ch- MkWV usV ds VsDLVckWDl daVªksy ds eq[; esFkMksa ds ckjs esa tkurs gSa A esFkM AppendText

Clear() ClearUndo() Copy() Cut() DeselectAll()

Paste() SelectAll() Undo()

fooj.k VsDLVckWDl esa miyC/ VsDLV ds lkFk u;s VsDLV dks tksM+rk gSA vki Text izkWiVhZ ds ekè;e ls dkWudWfVus'ku vkWijsVj (+) dk mi;ksx djds VsDLV dks tksM+us ds ctk; bl esFkM dk mi;ksx dj igys ls miyC/ VsDLV esa u;s VsDLV dks tksM+ ldrs gSaA VsDLVckWDl daVªksy ls VsDLV dks fjDr djrk gSA VsDLVckWDl ds vuMw ciQj ls lHkh lwpuk dks gVkrk gSA VsDLVckWDl ls orZeku p;u dks fDyicksMZ esa dkWih djrk gSA VsDLVckWDl ls p;fur VsDLV dks gVkdj fDyicksMZ esa Hkstrk gSA Li"V djrk gS fd SelectionLength izkWiVhZ dk eku 'kwU; gS rkfd daVªksy esa dksbZ dSjsDVj p;fur u jgsA SelectionLength izkWiVhZ VsDLVckWDl esa p;fur dSjsDVjksa dh la[;k dks lsV djrk gS A fDyicksMZ ds lkexzh dks VsDLVckWDl esa fpidkrk gSA VsDLVckWDl ds lHkh VsDLV dk p;u djrk gSA VsDLVckWDl esa fd;s x;s vafre vkWijs'ku dks vuMw djrk gSA

fparu % baVsfylsal dh lgk;rk ls daVªksy ds izkWiVhZ vkSj esFkM dks ,Dlsl djukA tc vki dksM ,fMVj fo.Mks esa fdlh daVªksy dk uke Vkbi djus ds ckn ihfj;M (.) Vkbi djrs gSa rc ,d fyLVckWDl izdV gksrk ftls baVsfylsal (IntelliSense) dgk tkrk gSA baVsfylsl dh lgk;rk ls vki ml daVªksy ds lHkh lnL; (members) dks ,Dlsl dj ldrs gSa ] mlds ckjs esa tku ldrs gSa rFkk mlesa mi;ksx gksus okys iSsjkehVj dks tku ldrs gSa A ;g daVªksy ds lHkh lnL;ksa ds ckjs esa 'kh/z lwpuk gkfly djus esa vkidh lgk;rk djrk gSA ;g vkids 'kCn dks iwjk

161


izksxzkfeax fon fotqvy csfld MkWV usV

Hkh djrk gSA fp=k T7.1 esa baVsfylsal ds }kjk lnL;ksa dh lwph rFkk mlds ckjs esa fn;s tk jgs lwpuk rFkk mlds iSjkehVj dks fn[kk;k x;k gSA baVsfylsal xyr dksfMax (;Fkk xyr daVªksy dk uke)] des.V dksM nsus ij ;k fiQj m}j.k fpUg ds vanj izdV ugha gksrk gSA baVsfylsal dks vkWiQ Hkh fd;k tk ldrk gSA bl fLFkfr esa Hkh baVsfylsl izdV ugha gksxkA

NOTES

fp=k T7.1 % baVsfylsal daVªksy ds lnL;ksa dh tkudkjh nsrs gq, 7.6.3 VsDLVckWDl ds eq[; bos.V (Main Events of TextBox)

bl [k.M esa oh- ch- MkWV usV ds VsDLVckWDl daVªksy ds izeq[k bos.V ds ckjs esa tkurs gSa A bos.V fooj.k FontChanged Font izkWiVhZ ds eku ds cnyus ij ?kfVr gksrk gSA ForeColorChanged ForeColor izkWiVhZ ds eku ds cnyus ij ?kfVr gksrk gSA ReadOnlyChanged ReadOnly izkWiVhZ ds eku esa cnyko gksus ij ?kfVr gksrk gSA TextChanged mi;ksxdÙkkZ }kjk VsDLVckWDl ds VsDLV dks cnyus ij ?kfVr gksrk gSA TextAlignChanged TextAlign izkWiVhZ ds eku esa cnyko gksus ij ?kfVr gksrk gSA fparu % baVsfylsal dks vkWiQ djuk baVsfylsal dksM fo.Mks esa ckbZ fMiQkWYV miyC/ gksrk gSA ysfdu bls vkWiQ Hkh fd;k dk ldrk gS A bls vkWiQ djus ds fy, ;g djsaA l Tools dks fDyd djsa rFkk Options... dk p;u djsaA l Text Editor + fpUg dks fDyd djsaA l fiQj Basic iQksYMj dk p;u djsa rFkk mlds vanj General dks fDyd djsaA l nk;ha vksj izdV gksus okys fodYi esa ls Statement Completion ds varxZr Auto list members rFkk Parameter information psdckWDl dks fDyd djsaA ,slk djus ij fyLVckWDl rFkk iSjkehVj lwpuk miyC/ ugha gksxkA (ns[ksa fp=k T7.2)

162

fp=k T7.2% baVsfylsal dks vkWiQ djrs gq,


7.7

fjpVsDLVckWDl daVªksy

(The RichTextBox Control)

fjpVsDLVckWDl daVªksy dk mi;ksx iQkWesZfVax ds lkFk VsDLV dks fMLIys djus] izfo"V djus rFkk efuI;wysV djus esa gksrk gSA fjpVsDLVckWDl daVªksy eYVhykbu iQhpj okys VsDLV ckWDl (ftl VsDLVckWDl daVªksy dk Multiline izkWiVhZ True lsV gks) dh Hkkafr gh dk;Z djrk gSA fjpVsDLVckWDl rFkk VsDLVckWDl esa dsoy varj ;g gS fd VsDLVckWDl ls vki dsoy lknk VsDLV (fcuk iQkWesZfVax dk VsDLV) gh fy[k ldrs gSa tcfd fjpVsDLVckWDl daVªksy vkids VsDLV dks iQkWesZV djus ds fy, Hkh fodYi nsrk gSA fjpVsDLVckWDl avki dks iQkW.V ds fy, Hkh fodYi miyC/ djkrk gSA fjpVsDLVckWDl esa vki iQkW.V vkSj jax dk p;u dj ldrs gSaA blesa vki gk;ijVsDLV (gk;ijfyad ds lkFk VsDLV) Hkh fy[k ldrs gSaA best dks yksM dj ldrs gSaA vkSj cgqr lkjs dk;Z dj ldrs gSaA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

fp=k 7.10 % fjpVsDLVckWDl daVªksy esa vyx&vyx iQkWjesV esa VsDLV dks n'kkZrs gq,

VsDLV ckWDl vkSj fjpVsDLVckWDl ds chp ,d cgqr cM+k varj gSA VsDLVckWDl esa miyC/ iQkWesZV fodYi dsoy ,d gh iQkWesZV dks iwjs VsDLVckWDl ij ykxw djrk gSA mnkgj.k ds fy, iwjs uksViSM esa vki dsoy ,d gh iQkW.V dk mi;ksx dj ldrs gSa tcfd oMZiSM esa vki ,d ls vf/d iQkW.V vyx&vyx VsDLV ds fy, mi;ksx dj ldrs gSaA fp=k 7-10 esa vki ns[k ldrs gSa fd fdl izdkj fjpVsDLVckWDl vyx izdkj ls VsDLV dks n'kkZ;k x;k gSA fjpVsDLVckWDl ds eq[; izkWiVhZ] esFkM rFkk bos.V dk fooj.k vkxs ds [k.Mksa esa izLrqr fd;k tk jgk gSA 7.7.1 fjpVsDLVckWDl ds eq[; izkWiVhZ (Main Properties of RichTextBox)

bl [k.M esa oh- ch- MkWV usV ds fjpVsDLVckWDl daVªksy ds izkWiVhZ ds ckjs esa tkurs gSa A buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt+ fo.Mks ds ek?;e ls lsV dj ldrs gSa A rFkk dqN tks izkWiVhZt+ fo.Mks esa izdV ugha gksrs gSa mugsa ju le; esa dksM ds ek?;e ls lsV dj ldrs gSa A gkykafd lHkh izkWiVhZ dks izksxzke ds ek?;e ls dksM fy[k dj lsV fd;k tk ldrk gSA izkWiVhZ AutoWordSelection

BorderStyle

fooj.k Lor% gh 'kCn p;u lfØ; gksxk ;k ugha dks Li"V djus okys eku dks lsV djrk gS ;k mlds ckjs esa lwpuk nsrk gSA ;fn ;g lR; gS rks 'kCn p;u lfØ; gksrk gS vU;Fkk vlR; gksrk gSA lR; bldk fMiQkWYV eku gksrk gSA ;fn ;g izkWiVhZ lR; lsV gS rks VsDLVckWDl esa VsDLV ds fdlh ,d fgLls ds p;u djus ij gh iwjk 'kCn p;u gks tkrk gSA fjpVsDLVckWDl ds ckWMjVkbi dks lsV djrk gS ;k mlds ckjs esa crkrk gSA vki BorderStyle izkWiVhZ dk mi;ksx dj fMiQkWYV f=k&foeh; (three dimensional) fjp VsDLV ckWDl cukus ds vfrfjDr lery :ih (flat style) rFkk ckWMZj jfgr borderless) fjp VsDLVckWDl cuk ldrs gSaA 163


izksxzkfeax fon fotqvy csfld MkWV usV

BulletIndent CanRedo

NOTES

CanUndo

ContextMenuStrip

DetectUrls

HideSelection

ImeMode

LanguageOption

Lines MaximumSize

MaxLength

164

fjpVsDLVckWDl esa baMus Vs'ku dks lsV djrk gS ;k mlds ckjs esa crkrk gSA ;g lwfpr djrk gS fd fjpVsDLVckWDl esa dqN ,sls ,D'ku gSa ftUgsa nksckjk ykxw fd;k tk ldrk gSA vki bl izkWiVhZ dk mi;ksx dj ;g lqfuf'pr dj ldrs gSa fd fjpVsDLVckWDl esa jn~n (undone) fd;k x;k vafre vkWijs'ku dks Redo esFkM dk mi;ksx dj iqu% lEiUu fd;k tk ldrk gS vFkok ughaA fiNys dk;Z dks vuMw fd;k ldrk gS ;k ugha dks Li"V djrk gqvk eku ykSVkrk gSA ;fn lR; gS rks ;wtj fjpVsDLVckWDl esa fiNys lEiUu fØ;k dks jn~n (undo) dj ldrk gS ;fn vlR; gS rks ;wtj bls ugha dj ldrk gSA ;g izkWiVhZ MkWV usV izsQeodZ laLdj.k 2-0 esa ifjfpr fd;k x;k gSA ;g bl fjpVsDLVckWDl daVªksy esa lac¼ ContextMenuStrip dks lsV djrk gS ;k mlds ckjs esa crkrk gSA fjpVsDLVckWDl esa Vkbi fd;s tkus ij ;w- vkj- ,y- (gkbijfyad) igpkuk tk;sxk ;k ugha dks Li"V djrk gqvk eku lsV djrk gS ;k mlds ckjs esa crkrk gSSA ;fn bldk eku lR; gks rks fjpVsDLVckWDl Lor% gh fjpVsDLVckWDl esa Vkbi fd;s x;s ;w-vkj-,y- dks fyad esa cny nsrk gSA ;fn vlR; gS rks blesa Vkbi fd;k x;k ;w-vkj-,y- lkekU; VsDLV dh Hkk¡fr gksrk gSA bldk fMiQkWYV eku lR; gksrk gSA RichTextBox daVªksy ls iQksdl gVus ij p;fur VsDLV gkbykbVsM gksxk ;k ugha dks Li"V djrk gqvk eku lsV djrk gS ;k mlds ckjs esa crkrk gSA ImeMode izkWiVhZ fjpVsDLVckWDl esa buiqV esFkM ,fMVj (Input Method Editor) ds eksM dks lsV djrk gSA buiqV esFkM ,fMVj ,d izksxzke gS tks ;wtj dks LVS.MMZ dh&cksMZ dh lgk;rk ls tkikuh dkuth (Japanese Kanji) v{kj tSls tfVy v{kjksa rFkk ladsrksa dks izfo"V djus dh {kerk iznku djrk gSA ;g izkWiVhZ MkWV usV izsQeodZ laLdj.k 2-0 esa u;k tksM+k x;k gSA ;g buiqV esFkM ,fMVj rFkk ,f'k;kbZ Hkk"kk liksVZ ds fy, fjpVsDLVckWDl lsfVaXl ls lacaf/r eku lsV djrk gSA fjpVsDLVckWDl daVªksy esa VsDLV dh iafDr;ksa dks lsV djrk gS ;k mlds ckjs esa crkrk gSA ;g izkWiVhZ MkWV usV izsQeodZ laLdj.k 2-0 esa u;k tksM+k x;k gSA ;g ml vkdkj dks lsV djrk gS tks og vf/dre lhek gksrk gS ftls GetPreferredSize Li"V djrk gSA fjpVsDLVckWDl esa mi;ksxdÙkkZ }kjk Vkbi fd;s tkus okys dSjDs Vjksa dh vf/ dre lhek dks lsV djrk gSA ;k blds ckjs esa crkrk gSA bl izkiW VhZ dk mi;ksx lkekU;r% rc gksrk gS tc vki fjpVsDLVckWDl dk mi;ksx ,d ykbu dk fjp VsDLV iQkWjesV (RTF) VsDLV fMLIys djus ds fy, dj jgs gksAa vki bl izkiW VhZ dk mi;ksx dj fjpVsDLVckWDl esa izfo"V fd;s tkus okys iksLVy dksM rFkk nwjHkk"k la[;k tSls ekuksa dh yEckbZ dks lhfer dj ldrs gSa ;k MkVkcsl esa MkVk dks izfo"V djus gsrq fd;s tk jgs VsDLVckWDl dh vf/dre lhek dks fu/kZfjr dj ldrs gSAa vki bldk mi;ksx dj daVkª y s esa izfo"V VsDLV dh lhek dks MkVkcsl ds lacfa /r iQhYM ds vf/ dre yEckbZ ds vuqlkj Hkh lhfer dj ldrs gSAa


MinimumSize

Modified

Multiline

ReadOnly

RightToLeft

Rtf

ScrollBars

SelectedRtf

SelectedText

;g izkWiVhZ MkWV usV izsQeodZ laLdj.k 2-0 esa igyh ckj ifjfpr djk;k x;k gSA ;g ml vkdkj dks lsV djrk gS tks og vf/dre lhek gksrk gS ftls GetPreferredSize Li"V djrk gSA ml eku dks lsV djrk gS ;k mlds ckjs esa lwpuk nsrk gS] tks ;g n'kkZrk gS fd daVkª y s ds cuus ds ckn mi;ksxdÙkkZ us bls laikfnr fd;k gS ;k blds fo"k;&cLrq esa vHkh&vHkh la'kks/u fd;k x;k gSA bl izkiW VhZ dk mi;ksx osfyMs'ku rFkk MkVk laj{k.k esFkM ds }kjk ;g lqfuf'pr djus ds fy, djrs gSa fd fjpVsDLVckWDl daVkª y s ds vanj cnyko gqvk gS vFkok ugha rkfd cnys gq, fo"k;&oLrq dks osfyMsV ;k lqjf{kr fd;k tk ldsA og eku lsV djrk gS ;k mlds ckjs esa crkrk gS tks ;g Li"V djrk gS fd ;g fjpVsDLVckWDl daVªksy eYVhykbu gS vFkok ughaA ;fn ;g lR; gS rks fjpVsDLVckWDl esa ,d ykbu ls vf/d VsDLV tksM+k tk ldrk gSA ;fn bldk eku vlR; lsV gS rks blesa dsoy ,d ykbu esa gh VsDLV gks ldrk gSA lR; bldk fMiQkWYV eku gksrk gSA fjpVsDLVckWDl dk VsDLV jhM vkWuyh gksxk vFkok ugha blds fy, ;g izkWiVhZ eku lsV djrk gSA bl izkWiVhZ ds eku esa lR; (True) lsV gksus ij ;wtj blds fo"k;&oLrq dks ju Vkbe esa cny ugha ldrkA bl izkWiVhZ dk mi;ksx dj vki lqfuf'pr dj ldrs gSa fd fjpVsDLVckWDl ds fo"k;&oLrq nk;sa ls ck;sa iQkW.V dk mi;ksx djus okys LFkkuh; Hkk"kkvksa dks liksVZ djsxk vFkok ughaA RightToLeft izkWiVhZ dk varjkZ"Vªh; ,fIyds'kuksa ds fy, mi;ksx gksrk gS tgk¡ fyfi nk;ha ls ck;ha vksj fy[kk tkrk gSA vjch] mnwZ bldk mnkgj.k gSA lHkh fjpVsDLV iQkWesZV (Rich Text Format) dksM dks lfEefyr djrs gq, fjpVsDLVckWDl daVªksy ds VsDLV dks lsV djrk gS ;k mlds ckjs esa crkrk gSA bl izkWiVhZ dk lkekU;r% mi;ksx rc gksrk gS tc vki vU; vkj-Vh-,iQ- (RTF) lzksr ;Fkk ekbØkslkWÝV oMZ ;k ekbØkslkWÝV oMZiSM ls daVªksy dks vkj-Vh-,iQ- VsDLV vlkbu dj jgs gksaA fjpVsDLVckWDl daVªksy esa iznf'kZr gksus okys LØkWyckjksa ds izdkj dks lsV djrk gS ;k blds ckjs esa lwpuk nsrk gSA ;g izkWiVhZ fjpVsDLVckWDl esa ;wtj dks {kSfrt rFkk mnxz LØkWyckj iQhpj iznku djrk gS rkfd fjpVsDLVckWDl ds vn`'; VsDLV dks ;wtj mij uhps nk;s ck;sa LØkWy dj ns[k ldsA vki bl izkWiVhZ dk mi;ksx dj fjpVsDLV ckWDl ls LØkWyckj gVkdj daVªksy ds lkexzh dks LØkWy djus ls jksd ldrs gSaA daVkª y s ls p;fur (orZeku es)a fjpVsDLVckWDl iQkWeVZs esa iQkWeVZs fd;s x;s VsDLV dks lsV djrk gS ;k mlds ckjs esa lwpuk nsrk gSA ;g izkiW VhZ vkidks daVkª y s esa vkj-Vh-,iQ- (RTF) iQkWjesfVax dksM ds lkFk p;fur VsDLV dks izkIr djus esa l{ke cukrk gSA vki bl izkiW VhZ dk mi;ksx dj vki vius daVkª y s ls VsDLV dks dkWih dj ldrs gS]a mldh iQkWjesfVax dj ldrs gSa rFkk ekbØkslkWÝV oMZ vkSj fo.Mkst oMZiMS tSls vU; ,fIyds'ku tks vkjVh-,iQ- iQkWjesV ds VsDLV dks Lohdkj djrs gSa esa VsDLV dks isLV dj ldrs gSAa cxSj vkj-Vh-,iQ- iQkWjesfVax dksM ds p;fur VsDLV dks izkIr djus ds fy, blds cnys SelectedText izkiW VhZ dk mi;ksx gksrk gSA ;fn orZeku esa dksbZ VsDLV p;fur ugha gS rks bl izkiW VhZ esa Li"V VsDLV bal'kZu Iokb.V ij balVZ gksrk gSA ;fn VsDLV p;fur gS rks bl izkiW VhZ ls vlkbu fd;k x;k VsDLV p;fur VsDLV dks cny nsrk gSA VsDLV dks lsV djrk gS ;k mlds ckjs esa lwpuk nsrk gSA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

viuh izxfr dks tk¡psa 1. Background izkWiVhZ ls vki D;k le>rs gks\ 2. Enabled izkiW VhZ dk D;k iz;ksx gS\ 165


izksxzkfeax fon fotqvy csfld MkWV usV

SelectionAlignment SelectionBullet

NOTES

SelectionColor SelectionFont SelectionHangingIndent

SelectionIndent

SelectionLength SelectionRightIndent

SelectionStart SelectionTabs Text WordWrap ZoomFactor

orZeku bal'kZu Iokb.V ;k p;u esa vykbues.V dks lsV djrk gS ;k mlds ckjs esa lwpuk nsrk gSA og eku lsV djrk gS ;k blds ckjs esa crkrk gS] tks Li"V djrk gS fd cwysV LVkby orZeku p;u ;k bul'kZu Iokb.V esa ykxw gks ;k ughaA baul'kZu IokbUV ;k orZeku VsDLV p;u ds VsDLV jax dks lsV djrk gS ;k mlds ckjs esa crkrk gSA bul'kZu IokbUV ;k orZeku VsDLV p;u ds iQkW.V dks lsV djrk gS ;k mlds ckjs esa crkrk gSA p;fur vuqPNsn (iSjkxzkiQ) esa VsDLV ds igys ykbu ds ck;sa fdukjs rFkk mlh vuqPNsn (iSjkxzkiQ) ds vxys ykbuksa ds ck;ha fdukjs dh nwjh dks lsV djrk gS ;k mlds ckjs esa lwpuk nsrk gSA fjpVsDLVckWDl ds ck;sa fdukjs rFkk bul'kZu Iokb.V ds ckn tksM+s x;s VsDLV ;k orZeku VsDLV p;u ds ck;sa fdukjs ds eè; dh nwjh dks fiDlsy esa lsV djrk gS ;k mlds ckjs esa crkrk gSA daVªksy ls p;fur dSjsDVj dh lhek dks lsV djrk gS ;k mlds ckjs esa crkrk gSA fjpVsDLVckWDl ds nk;sa fdukjs rFkk p;fur VsDLV ds nk;sa fdukjs ds eè; dh nwjh dks fiDlsy esa lsV djrk gS ;k mlds ckjs esa crkrk gSA VsDLVckWDl esa p;fur VsDLV ds izkjfEHkd Iokb.V dks lsV djrk gS ;k mlds ckjs esa lwpuk nsrk gSA fjpVsDLVckWDl daVªksy esa iw.kZ VSc LVkWi ikst+h'ku dks lsV djrk gS ;k mlds ckjs esa lwpuk nsrk gSA fjpVsDLVckWDl esa orZeku VsDLV dks lsV djrk gS ;k blds ckjs esa lwpuk nsrk gSA eYVhykbu fjpVsDLVckWDl daVªksy 'kCnksa esa oMZ jSi Lor% gh gksxk ;k ugha ;g lsV djrk ;k bldk ladsr nsrk gSA fjpVsDLVckWDl ds orZeku ”kwe Lrj dks lsV djrk gS ;k fiQj mlds ckjs esa crkrk gSA

7.7.2 fjpVsDLVckWDl ds eq[; esFkM (Main Methods of RichTextBox)

bl [k.M esa oh- ch- MkWV usV ds fjpVsDLVckWDl daVªksy ds izeq[k esFkMl~ ds ckjs esa tkurs gSa A esFkM AppendText() CanPaste() Clear() ClearUndo() Copy() Cut() DeselectAll 166

Find() LoadFile()

fooj.k fjpVsDLVckWDl ds orZeku VsDLV esa VsDLV dks tksM+rk gSA fDyicksMZ ls lwpuk dks vki isLV dj ldrs gSa ;k ugha ;g fu/kZfjr djrk gS fjpVsDLVckWDl daVªksy ls lHkh VsDLV dks fDy;j djrk gSA fjpVsDLVckWDl ds vuMw ciQj ls lcls gky ds vkWijs'ku ds ckjs esa lwpuk dks fDy;j djrk gSA fjpVsDLVckWDl ds orZeku p;u dks fDyicksMZ esa dkWih djrk gSA fjpVsDLVckWDl ds orZeku p;u dks ogkWa ls gVkdj fDyicksMZ esa Hkstrk gSA SelectionLength izkWiVhZ ds eku dks 0 lsV djrk gS rkfd fjpVsDLVckWDl ls v{kj p;fur u gksA fjpVsDLVckWDl ds fo"k; oLrq esa ls VsDLV dks <+wWa<+rk gSA fjpVsDLVckWDl daVªksy esa iQkby ds fo"k;oLrq dks yksM djrk gSA


fjpVsDLVckWDl daVªksy esa fDyi cksMZ ds fo"k;oLrq dks isLV djrk gSA Redo() fjpVsDLVckWDl daVªksy esa fujLr fd;s x;s vafre vkWijs'ku dks fiQj ls dk;kZfUor djrk gSA SaveFile() fjpVsDLVckWDl ds fo"k;&oLrq dks iQkby esa lqjf{kr djrk gSA ScrollToCaret() fjpVsDLVckWDl daVªksy ds fo"k;&oLrq dks orZeku dSjsV iksft'ku rd LØkWy djrk gSA Select() fjpVsDLVckWDl daVªksy ds vanj VsDLV dk p;u djrk gSA SelectAll() fjpVsDLVckWDl esa lHkh VsDLV dk p;u djrk gSA Undo() fjpVsDLVckWDl esa vafre laiknu fozQ;k (edit operation) dks vuMw djrk gSA Paste()

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

7.7.3 fjpVsDLVckWDl ds eq[; bos.V (Main Events of RichTextBox)

bl [k.M esa oh- ch- MkWV usV ds fjpVsDLVckWDl daVªksy ds izeq[k bos.V ds ckjs esa tkurs gSaA bos.V BackColorChanged FontChanged ForeColorChanged HScroll LinkClicked MarginChanged ModifiedChanged MouseWheel MultilineChanged ReadOnlyChanged RightToLeftChanged SelectionChanged VScroll

fooj.k BackColor izkWiVhZ ds eku ds cnyus ij ;g ?kfVr gksrk gSA Font izkWiVhZ ds eku ds cnyus ij ;g ?kfVr gksrk gSA ForeColor izkWiVhZ ds eku ds cnyus ij ;g ?kfVr gksrk gSA mi;ksxdÙkkZ ds }kjk daVªksy ds {kSfrt LØkWyckj dks fDyd djus ij ;g ?kfVr gksrk gSA mi;ksxdÙkkZ tc daVªksy ds VsDLV ds vanj fdlh fyad dks fDyd djrk gS rc ;g ?kfVr gksrk gSA daVªksy ds gkf'k, (margin) ds cnyko ij ;g ?kfVr gksrk gSA daVªksy ds Modified izkWiVhZ ds eku ds cnyus ij ;g ?kfVr gksrk gSA daVkª y s iQksdl jgus dh fLFkfr ekml Oghy ds ?kweus ij ?kfVr gksrk gSA Multiline izkWiVhZ ds eku esa cnyko gksus ij ;g ?kfVr gksrk gSA ReadOnly izkWiVhZ ds eku esa cnyko gksus ij ;g ?kfVr gksrk gSA RightToLeft izkWiVhZ ds eku esa cnyko gksus ij ;g ?kfVr gksrk gSA daVªksy ds vanj VsDLV ds p;u ds cnyus ij ;g ?kfVr gksrk gSA mi;ksxdÙkkZ ds }kjk mnxz LØkWyckj ij fDyd fd;s tkus ij ;g ?kfVr gksrk gSA

7.8 ysscy daVªksy (The Label Control) tc vki vius ;wtj baVjiQsl ds lery i`"B ij dqN VsDLV ;k ladsr igys ls fy[kdj izdV djuk pkgrs gksa rks yscy daVªksy lcls cf<+;k fodYi gSA yscy daVªksy dk lkekU; mi;ksx fdlh daVªksy ds fy, o.kZukRed 'kh"kZd (descriptive title) miyC/ djkuk gSA mnkgj.k ds fy, vki yscy dk iz;ksx dj VsDLVckWDl daVªksy dk o.kZu djus gsrw VsDLV tksM+ ldrs gSa rkfd ;wt+j dks daVªksy esa fdl izdkj dk MkVk buiqV djuk gS blls voxr fd;k tk ldsA yscy dh lgk;rk ls iQkWeZ ls lECakfèkr ;wt+j dks mi;ksxh tkudkjh nsus gsrw Hkh VsDLV dks izdV djk;k tk ldrk gSA mnkgj.k ds fy, vki iQkWeZ ds lcls mij ,d yscy tksM+ dj ;wt+j ds fy, mi;ksxh tkudkjh miyC/ dj ldrs gSaA yscy dk iz;ksx ,fIyds'ku ds LVsVl (status) ij ju Vkbe lwpuk nsus ds fy, Hkh gks ldrk gSA vki dksbZ 'kh"kZd] dksbZ fo'ks"k fpUg] izdk'kukf/dkj ;k dksbZ Hkh lwpuk bl daVªksy dh lgk;rk ls baVjiQsl ij fpidk ldrs gSaA yscy ij fpidk, x;s lwpuk ges'kk ukWu&,fMVscy (non editable) gksrk gSA yscy iQkWeZ ds VSc vkWMj esa fgLlk rks ysrk gS ijUrq bls iQksdl izkIr ugha gksrk gS cfYd iQksdl blds ckn okys daVªky s ij pyk tkrk gSA mnkgj.k ds fy, ;fn vki yscy ij ,Dlsl dh fMiQkbu djrs gSa

167


izksxzkfeax fon fotqvy csfld MkWV usV

vkSj mls ALT dh ds lkFk buoksd djrs rks og yscy iQksdl gksus ds ctk; mlds ckn okyk daVªky s ;Fkk VsDLVckWDl ij iQksdl gks tk;xk A blds vfrfjDr Image izkWiVhZ dk mi;ksx dj vki bl ij best Hkh fMLiys dj ldrs gSAa fp=k 7.11 esa iQkWeZ ij yscy ds fofHkUu :iksa dks ns[k ldrs gSAa

NOTES

fp=k 7.11 : iQkWeZ ij tksM+s x;s yscy ds fofHkUu :i 7.8.1 ysscy cuke VsDLVckWDl (Label Vs TextBox)

izksxzkej baVjiQsl fMtk;u djrs le; vDlj yscy vkSj VsDLVckWDl dks ,d nwljs ds LFkku ij mi;ksx dj ysrs gSaA VsDLVckWDl dgha Hkh yscy dh rjg mi;ksx fd;k tk ldrk gSA yscy Hkh dgha Hkh VsDLVckWDl dh rjg mi;ksx fd;k tk ldrk gSA ;gk¡ [kkl ckr è;ku nsus okyh ;g gksrh gS fd yscy }kjk izLrqr dh x;h lwpuk dsoy i<+us;ksX; (Read-only) gksrh gSA blesa dksbZ la'kks/u ugha fd;k tk ldrk gSA tcfd VsDLVckWDl dk mi;ksx lkekU;r% MkVk dks buiqV djokus esa gksrk gSA ijUrq ;fn blds ReadOnly, BackColor vkSj BorderStyle izkWiVhZ dks True, Control vkSj None Øe'k% lsV dj fn;k tk; rks ;g Hkh fcYdqy lkekU; yscy dh rjg yxsxkA ;fn vki yscy dks VsDLVckWDl dh rjg ns[kuk pkgrs gSa rks blds BackColor rFkk BorderStyle ds izkWiVhZ dks Window rFkk Fixed3D Øe'k% lsV dj nsaA ijUrq buds :iksa dks dsoy cnyk tk ldrk gS buds dk;Z djus dh izÑfr dks dHkh Hkh ugha cnyk tk ldrk gSA yscy daVªksy dk dk;Z lwpuk dks i<+us;ksX; :i esa baVjiQsl ij fpidkuk gS tcfd VsDLVckWDl daVªksy dk ewy dk;Z MkVk dks buiqV djokuk gS tcfd blds ekè;e ls jhM&vkWuyh MkVk dks baVjiQsl ij izLrqr fd;k tk ldrk gSA (ns[ksa fp=k 7-12)

168

fp=k 7.12 : iQkWeZ ij tksM+s x;s yscy rFkk VsDLVckWDl nksuksa ds chp ,d rqyukRed n`f"Vdks.k dks n'kkZrs gq,


7.8.2 yscy ds eq[; izkWiVhZ”k (Main Properties of Label)

bl [k.M esa oh- ch- MkWV usV ds yscy daVªksy ds izkWiVhZ ds ckjs esa tkurs gSa A buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt+ fo.Mks ds ek?;e ls lsV dj ldrs gSa A rFkk dqN tks izkWiVhZt+ fo.Mks esa izdV ugha gksrs gSa mugsa ju le; esa dksM ds ek?;e ls lsV dj ldrs gSa A gkykafd lHkh izkWiVhZ dks izksxzke ds ekè;e ls dksM fy[k dj lsV fd;k tk ldrk gSA fooj.k AutoEllipsis bl izkWiVhZ ds ekè;e ls vki ;g lsV dj ldrs gSa fd ;fn yscy dh yEckbZ ls vf/d cM+k bldk VsDLV gksrk gS rks yscy daVªksy ds nk;ha fdukjs ij bfyifll dSjsDVj (---) izdV gksxk vFkok ughaA bl izkWiVhZ dks True lsV djus ls igys yscy ds AutoSize izkWiVhZ dks False lsV djsaA AutoSize bl izkWiVhZ ds ekè;e ls vki ;g lsV dj ldrs gSa fd yscy vius VsDLV (tks bl ij fy[kk gS) ds vuqlkj Lo;a gh vkdkj dks c<+k&?kVk ldrk gS vFkok ugha blds fy, vkidks bls True lsV djuk gksxkA ;fn ,slk ugha pkgrs gS] rks False lsV dj nsaA BackColor yscy ds cSdxzkm.M jax dks lsV djrk gSA BorderStyle yscy ds LVkby dks lsV djrk gSA blesa None, FixedSingle rFkk Fixed3D fodYi gksrs gSaA FlatStyle yscy ds iQySV LVkby vfivjsUl (:i) dks lqfuf'pr djrk gS A ;g izkWiVhZ yscy ds fy, cgqr mi;ksxh ugha gS A blesa pkj eku Flat, Popup, Standard rFkk System miyC/ gksrs gSaA tc vki Flat dk p;u djrs gSa rks ;g lery (flat) rc rd izdV jgrk gS tc rd fd ekml IokbUVj blds mij u ys tk;k tk;A tc Popup daVªksy ds mij ekml IokbUVj dks ys tkrs gSa rc ;g rc rd Standard LVkby dh rjg gh izdV gksrk gS tc rd fd ekml IokbUVj dks bl ij ls u gVk;k tk;A System LVkby dks lsV djus ij daVªksy dk :i ;wtj ds }kjk mi;ksx fd;s tk jgs vkWijsfVax flLVe ds }kjk fu/kZfjr gksrk gS rFkk bldks lsV djus ij ImageAlign, Image, ImageIndex, ImageList rFkk TextAlign ds eku ykxw ugha gksaxsA Standard LVkby yscy dks f=k&foeh; :i esa fMLIys djrk gSA Image blds ekè;e ls vki yscy ij vkÑfr lsV dj ldrs gSaA ImageAlign yscy ij ;fn vkÑfr (Image) lsV fd;k x;k gS] rks mlds vykbues.V dks lsV djrk gSA MaximumSize yscy ds vf/dre vkdkj dks lsV djrk gSA blds vanj Width rFkk Height vki lsV dj ldrs gSaA ;k MaximumSize ds lkeus Width, Height iQkWesZV esa Hkh eku fy[k ldrs gSaA TextAlign yscy ds VsDLV dks vykbu djrk gSA MinimumSize bl izkWiVªhZ ds ekè;e ls vki ;g r; dj ldrss gSa fd yscy dk U;wUre pkSM+kbZ rFkk Å¡pkbZ D;k gksxhA UseMnemonic bl izkWiVhZ ds ekè;e ls vki VsDLV dks dsoy VsDLV vFkok VsDLV vkSj fueksfud dksM ds lek;kstu ds :i esa lsV dj ldrs gSaA mnkgj.k ds fy,] ;fn vki UseMnemonic dks True lsV fd;k gqvk gS] rks & Vkbi djus ij blds ckn vkus okyk dSjsDVj ,Dlsl dh esa cnysxkA ;fn ;g False lsV gS rks vki tks fy[krs gSa ogh yscy ij fy[kkrk gSA UseWaitCursor bl izWkiVhZ dks True lsV djus ij ,sIyhds'ku fØ;kfUor djus ds ckn tc vki yscy ij ekml ys tk;saxs rks ekml dk :i ,sjks ls cnydj (Me:) esa cny tk;sxk tks izkslsl pkyw gS dk lwpd gSA False lsV djus ij ges'kk ;g ,sjks gh jgsxkA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

izkWiVhZ

169


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

7.9 cVu (Button) cVu dks lkekU;r% ekml dk iz;ksx djds fDyd fd;k tk ldrk gS vkSj ;fn cVu iQksdl~M gS rks bls ,.Vj dh ;k Lislckj dh lgk;rk ls Hkh fDyd fd;k tk ldrk gSA vki cVu dk :i cny ldrs gSAa mnkgj.k ds fy, cVu dks osc :i nsus ds fy, blds FlatStyle izkiW VhZ dks Flat lsV dj ldrs gSAa cVu daVªksy dh lgk;rk ls ;wt+j bls fDyd dj fdlh ,D'ku dks lEiUu dj ldrk gS A cVu dks tc fDyd fd;k tkrk gS rks ;g ,slk fn[krk gS tSls bls iq'k ;k fjfyt fd;k tk jgk gks A tc tc ;wt+j cVu dks fDyd djrk gS rc rc Click bos.V gS.Myj tkx`r (invoke) gksrk gS A bfPNr ,D'ku dks lEiUu djus ds fy, Click bos.V gS.Myj esa dksM fy[kk tkrk gSA cVu ij VsDLV dks fMLiys djus ds fy, blds Text izkWiVhZ esa eku dks lsV djrs gSa A cVu ds VsDLV esa ,Dlsl dh Hkh fMiQkbu dj ldrs gSa tks dh&cksMZ usfoxs'ku dks lEHko cukrk gS A Image rFkk ImageList izkiW VhZ dh lgk;rk ls cVu daVkª y s ij best dks Hkh izdV fd;k tk ldrk gSA iQkWeZ ds AcceptButton rFkk CancelButton izkWiVhZ dks lsV djus ds i'pkr~ ;wt+j ENTER ;k ESC dh nckdj cVu dks fDyd dj ldrk gS pkgs cVu iQksdLM gks ;k u gks A ,slk djus ls iQkWeZ esa Mk;ykWx dk vkpj.k vk tkrk gS A vFkZkr vki ENTER dh nckdj cVu dks fDyd dj ldrs gSa A AcceptButton Enter dh dks rFkk CancelButton Esc dh dks izLrqr djrk gS A ,slk djus ds fy, vkidks AcceptButton rFkk CancelButton izkWiVhZ ds eku esa ml cVu dks lsV djuk gksxk ftlds fy, ozQe'k% vki Enter dh rFkk Esc dh lsV djuk pkgrs gSaA fp=k 7-13 esa iQkWeZ ij cVu ds fofHkUu :iksa dks n'kkZ;k x;k gSA

fp=k 7.13 : fofHkUu :i esa cVu 7.9.1 cVu ds eq[; izkWiVhZ”k (Main Properties of Button)

bl [k.M esa oh- ch- MkWV usV ds cVu daVªksy ds izkWiVhZ ds ckjs esa tkurs gSa A buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt+ fo.Mks ds ek?;e ls lsV dj ldrs gSa A rFkk dqN tks izkWiVhZt+ fo.Mks esa izdV ugha gksrs gSa mugsa ju le; esa dksM ds ek?;e ls lsV dj ldrs gSa A gkykafd lHkh izkWiVhZ dks izksxzke ds ek?;e ls dksM fy[k dj lsV fd;k tk ldrk gSA

170

fp=k 7.14 % bfyifll dSjsDVj ds lkFk cVu


izkWiVhZ AutoEllipsis

fooj.k bl izkWiVhZ ds ekè;e ls vki ;g lsV dj ldrs gSa fd ;fn cVu daVªksy dh yEckbZ ls vf/d cM+k bldk VsDLV gS rks cVu daVªksy ds nk;ha fdukjs ij bfyifll dSjsDVj (---) izdV gksxk vFkok ughaA bl izkWiVhZ dks True lsV djus ls igys cVu ds AutoSize izkWiVhZ ds eku dks ns[k ysa fd ;g False gS vFkok ughaA ;|fi False bldk ckb fMiQWkYV jgus nsaA bfyifll dSjsDVj ds lkFk cVu dks fp=k 7.14 esa fn[kk;k x;k gSA

AutoSize

bl izkWiVhZ ds ekè;e ls vki ;g lsV dj ldrs gSa fd cVu vius VsDLV (tks bl ij fy[kk gS) ds vuqlkj Lo;a gh vkdkj dks c<+k&?kVk ldsaA blds fy, vkidks bls True lsV djuk gksxkA ;fn ,slk ugha pkgrs gS] rks fMiQWkYV False jgus nsa A

FlatStyle

cVu ds iQySV LVkby vfivjsUl (:i) dks lqfuf'pr djrk gS A ;g izkWiVhZ cVu ds fy, cgqr mi;ksxh ugha gS A blesa pkj eku Flat, Popup, Standard rFkk System miyC/ gksrs gSaA bl izkWiVhZ dks yscy ds lanHkZ esa foLrkj ls crk;k x;k gS A

FlatAppearance

;g izkWiVhZ rc izklafxd gS tc FlatStyle dk izkWiVhZ Flat lsV gS A ;g ckWMj ds vfivjsu~l rFkk psd LVsV o ekml LVsV ds jax dks lsV djrk gS A bls lsV djus ds fy, FlatAppearance ds tksM+ fpUg (+) dks fDyd djsa rFkk BorderColor ] BorderSize ] MouseDownBackColor rFkk MouseOverBackColor ds ek?;e ls cVu ds ckWMZj jax] ckWMZj vkdkj] ekml ds fDyd djus ds i'pkr~ cVu dk cSdxzkm.M jax rFkk ekml dks cVu ds mij ys tkus ij bldk jax lsV djrk gS A

Image

blds ekè;e ls vki cVu ij vkÑfr lsV dj ldrs gSaA

ImageAlign

cVu ij ;fn vkÑfr (image) lsV fd;k x;k gS] rks mlds vykbues.V dks lsV djrk gSA

MaximumSize

cVu ds vf/dre vkdkj dks lsV djrk gSA blds vanj Width rFkk Height vki lsV dj ldrs gSaA ;k MaximumSize ds lkeus Width, Height iQkWesZV esa Hkh eku fy[k ldrs gSaA

TextAlign

cVu ds VsDLV dks vykbu djrk gSA

MinimumSize

bl izkWiVhZ ds ekè;e ls vki ;g r; dj ldrss gSa fd cVu dk U;wure pkSM+kbZ rFkk Å¡pkbZ D;k gksxhA

UseMnemonic

bl izkWiVhZ ds ekè;e ls vki VsDLV dks dsoy VsDLV vFkok VsDLV vkSj fueksfud dksM ds :i esa lsV dj ldrs gSaA mnkgj.k ds fy,] ;fn vki UseMnemonic dks True lsV fd;k gqvk gS] rks & Vkbi djus ij blds ckn vkus okyk dSjsDVj ,Dlsl dh esa cnysxkA ;fn ;g False lsV gS rks vki tks fy[krs gSa ogh cVu ij fy[kkrk gSA

UseWaitCursor

bl izWkiVhZ dks True lsV djus ij ,sIyhds'ku fØ;kfUor djus ds ckn tc vki cVu ij ekml ys tk;saxs rks ekml dk :i ,sjks ls cnydj (Me:) esa cny tk;sxk tks izkslsl pkyw gS dk lwpd gSA False lsV djus ij ges'kk ;g ,sjks gh jgsxkA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

171


izksxzkfeax fon fotqvy csfld MkWV usV

7.9.2 cVu ds eq[; esFkM (Main Methods of Button)

bl [k.M esa oh- ch- MkWV usV ds cVu daVªksy ds izeq[k esFkM ds ckjs esa tkurs gSa A esFkM

NOTES

BringToFront()

Hide() Show()

fooj.k Z-ozQe ds vkxs daVªksy dks ykrk gSA ;fn d.Vªksy fdlh vU; d.Vªksy dk pkbYM gS] rc og pkbYM dUVªksy Z Øe ds lcls vkxs izdV gksrk gSA BringToFront fdlh daVªksy dks 'kh"kZ Lrjh; daVªksy ugha cukrk gSA bl esFkM dks le>us ds fy;s ySc vH;kl 7.2 ns[ksaA cVu daVªksy dks iQkWeZ ij vn`'; cukrk gSA cVu daVªksy dks iQkWeZ ij n`'; cukrk gS ;fn cVu daVªksy vn`'; gSA

7.9.3 cVu ds eq[; bos.V (Main Events of Button)

bl [k.M esa oh- ch- MkWV usV ds cVu daVªksy ds izeq[k bos.V ds ckjs esa tkurs gSaA bos.V

fooj.k ;g rc ?kfVr gksrk gS tc cVu daVªksy dks fDyd fd;k tkrk gSA ;g cVu daVªksy dk fMiQkWYV bos.V gSA

Click

ySc vH;kl 7.2 (Lab Exercise 7.2) ,d fo.Mkst ,fIyds'ku cuk;saA blesa ,d yscy] ,d iSuy vkSj nks cVu tksM+saA ,d cVu dks nwljs ij j[ksa rkfd iQkWeZ ij dsoy ,d gh cVu fn[ksA bldk bUVjisQl fMtk;u le; esa fp=k LA7.3 dh Hkk¡fr gks rFkk buds izkWiVhZ bl izdkj gksaA vkWCtsDV iQkWeZ yscy

iSuy cVu cVu

172

izkWiVhZ

eku

Name Text Name Text Font TextAlign Name Name Text Name Text

Form1 Lab Exercise 7.2 Label1 A Windings, 26 MiddleCenter Panel1 btnShow Show btnHide Hide

fp=k LA7.3 : ySc vH;kl 7.2 dk baVjisQl


lek/ku %

GUI izksxzkfeax fon~

➪ File esU;w dks fDyd djsa rFkk New Project dk p;u djsaA

fo.Mks”k iQkWeZl~

➪ New Project Mk;ykWx ckWDl [kqyus ds i'pkr Templates isu esa Windows Application dks fDyd djsaA

NOTES

➪ Name VsDLVckWDl esa Lab Exercise 7.2 Vkbi djsa rFkk OK dks fDyd djsa A mlds ckn ,d u;k fo.Mkst iQkWeZl izkstsDV [kqysxkA ➪ iQkWeZ ij iz'u esa fn, x, fooj.k ds vuqlkj VwyckWDl ls daVªksy dks tksMsa+A rFkk iz'ukuqlkj muds izkWiVhZ dks lsV djsa rFkk fp=kkuqlkj mugsa ltk,Wa A ➪ iQkWeZ dks nks ckj fDyd djsa vkSj Form1_Load bos.V gS.Myj ds fy, fuEufyf[kr dksM fy[ksaµ Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Panel1.Contains(btnShow) Then btnShow.BringToFront() Label1.Hide() End If End Sub Private Sub btnShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShow.Click btnHide.BringToFront() Label1.Show() End Sub Private Sub btnHide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHide.Click btnShow.BringToFront() Label1.Hide() End Sub

➪ F5 nck,¡A rFkk ifj.kke dks ns[ksaA ifj.kke fp=k LA7.4 dh Hkk¡fr izdV gksxkA

fp=k LA7.4 : ySc vH;kl 7.2 dk ifj.kke bl ySc vH;kl esa BringToFront rFkk Show esFkM dk iz;ksx gqvk gSA

173


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

7.10

fyLVckWDl daVªksy (The ListBox Control)

fyLVckWDl daVªksy dh lgk;rk ls ge ,d gh rjg ds dbZ vo;oksa dks ,d lwph esa lwphc¼ djrs gSa rkfd mi;ksxdÙkkZ mUgha vo;oksa ds lhfer fodYiksa esa ls p;u dj ldsaA lwph yEch gksus dh fLFkfr esa LØkWy ckj dks tksM+k tk ldrk gS rkfd lwph dks Bhd ls czkmt+ fd;k tk ldsA lwph esa ge ,d ;k ,d ls vf/d vkbVeksa dk p;u dj ldrs gSaA fyLVckWDl dks ,sIyhds'ku ds vuqlkj dLVekbt djus ds fy, dbZ izkWiVhZ gSa ftUgsa le>uk vko';d gSA fp=k 7-15 esa iQkWeZ ij fofHkUu izdkj ds fyLVckWDl daVªksy dks fn[kk;k x;k gSA

fp=k 7.15 : iQkWeZ ij izdV fyLVckWDl ds fofHkUu :i 7.10.1 fyLVckWDl ds eq[; izkWiVhZ (Main Properties of ListBox)

bl [k.M esa oh- ch- MkWV usV ds fyLVckWDl daVªksy ds izkWiVhZ ds ckjs esa tkurs gSa A buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt+ fo.Mks ds ek?;e ls lsV dj ldrs gSa A rFkk dqN tks izkWiVhZt+ fo.Mks esa izdV ugha gksrs gSa mugsa ju le; esa dksM ds ek?;e ls lsV dj ldrs gSa A gkykafd lHkh izkWiVhZ dks izksxzke ds ek?;e ls dksM fy[k dj lsV fd;k tk ldrk gSA izkWiVhZ BorderStyle

ColumnWidth ContextMenuStrip DataSource DisplayMember DrawMode

174

fooj.k fyLVckWDl ds pkjksa vksj cuus okys ckWMZj ds izdkj dks lsV djrk gSA vki BorderStyle izkWiVhZ esa Fixed3D, FixedSingle rFkk None lsV dj Øe'k% f=k&foeh; ckWMZj] flaxy ykbu ckWMZj rFkk ckWMZj jfgr fyLVckWDl cuk ldrs gSaA dkWye dh pkSM+kbZ dks lsV djrk gSA bldh vko';drk rc gksrh gS tc ge ,d ls vf/d dkWye dh lwph cuk jgs gSaA fyLVckWDl ds lkFk tqM+s ContextMenuStrip dks lsV djrk gSA fyLV daVªksy ds fy, MkVk lkslZ dks lsV djrk gS ;k mlds ckjs esa crkrk gSA fyLVckWDl esa vkWCtsDV ds fdl izksiVhZ dks n'kkZ;sa ;g fn[kkrk gSA fyLVckWDl ds fy, Mªkb±x eksM dks lsV djrk gSA tc ;g Normal lsV gksrk gS rks daVªksy ds lHkh vo;o vkWijsfVax flLVe ds }kjk cuk;s tkrs gSa rFkk ,d gh vkdkj ds gksrs gSaA OwnerDrawFixed lsV gksus dh fLFkfr esa lHkh vo;o eSuqvyh cuk, tkrs gSa rFkk leku vkdkj ds gksrs gSaA OwnerDrawVariable lsV gksus ij daVªksy ds lHkh vo;o eSuqvy <ax ls curs gSa rFkk vkdkj esa vyx gksrs gSaA


;g izkWiVhZ MkWV usV izsQeodZ laLdj.k 2-0 esa u;k tksM+k x;k gSA ;g IFormatProvider lsV djrk gS tks dLVe iQkWjesfVax vkpj.k (behavior) miyC/ djkrk gSA FormatString ;g izkWiVhZ MkWV usV izsQeodZ laLdj.k 2-0 esa u;k tksM+k x;k gSA ;g mu iQkWjesV LisfliQk;j v{kjksa (Format Specifier Characters) dks lsV djrk gS tks ;g fufnZ"V djrk gS fd eku dSls fMLIys gksA FormattingEnabled ;g izkWiVhZ ml eku dks lsV djrk gS tks ;g crkrk gS fd iQkWjesfVax fyLVdaVªksy ds DisplayMember ij ykxw gksxk vFkok ughaA HorizontalExtent fyLVckWDl {kSfrt LØkWyckj ls fdruk LØkWy djsxk] ;g lsV djrk gSA HorizontalScorollbar fyLVckWDl esa {kSfrt LØkWy ckj gksxk vFkok ugha] ;g lsV djrk gSA IntegralHeight fyLVckWDl ds vkdkj esa cnyko gks lds rkfd ;g vkbVe dks iwjk fn[kk lds] bldks lsV djrk gSA ;fn ;g lR; (True) lsV gS rks daVªksy vius vkdkj esa cnyko dj ldrk gS rkfd ;g iwjk iwjk vkbVe fMLIys dj ldsA ;fn False lsV gS rks fyLVckWDl ds vkbVe vkaf'kd :i ls fMLIys gks ldrs gSaA bldk fMiQkWYV True gksrk gSA ItemHeight fyLVckWDl esa fdlh vo;o (Item) dh Å¡pkbZ dks lsV djrk gSA Items fyLVckWDl esa ls vkbVeksa dks tksM+us ;k gVkus esa gksrk gSA MultiColumn lwph esa ,d gh dkWye gksaxs ;k ,d ls vf/d dkWye gksaxs ;g lsV djrk gSA PreferredHeight fyLVckWDl esa lHkh vkbVeksa dh dqy Å¡pkbZ ykSVkrk gSA ScrollAlwaysVisible mnxz LØkWy ckj ges'kk fn[ksxk ;k ugha ;g lsV djrk gSA SelectedIndex fyLVckWDl ds vHkh ds p;fur (currently selected) vkbVe ij baMsDl lsV djrk gSA SelectedIndices ,d ladyu iznku djrk gS ftlesa fyLVckWDl ds lHkh p;fur vkbVeksa ds baMDs l gksrs gSAa SelectedItem fyLVckWDl esa ckbZ fMiQkWYV p;fur vkbVe dks lsV djrk gSA SelectedItems ,d ladyu iznku djrk gS ftlesa fyLVckWDl ds lHkh p;fur vkbVe gksrs gSaA SelectionMode fyLVckWDl ds vkbVeksa ds p;u dh fof/ dks lsV djrk gSA Sorted fyLVckWDl ds vo;o o.kZekyk Øe (alphabetic order) ;k c<+rs gq, (ascending order) Øe esa gksaxs ;k ugha ;g lsV djrk gSA TopIndex fyLVckWDl ds igys n`'; vkbVe ds baMsDl dks lsV djrk gSA FormatInfo

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

7.10.2 fyLVckWDl ds esFkM (Methods of ListBox)

bl [k.M esa oh- ch- MkWV usV ds fyLVckWDl daVªksy ds izeq[k esFkM ds ckjs esa tkurs gSa A esFkM BeginUpdate

ClearSelected DoDragDrop EndUpdate

fooj.k BeginUpdate fyLVckWDl esa ,d&,d vkbVe dks tksM+us ds nkSjku esuVsusUl dk;Z djrk gS iQyLo:i daVªksy dks rc rd MªkW djus ls jksdrk gS tc rd fd EndUpdate esFkM dkWy u gksA fyLVckWDl ds lHkh vkbVeksa ds p;u dks fujLr djrk gSA MªSx MªkWi vkWijs'ku dks 'kq: djrk gSA fyLVckWDl ds fotqvy viMsfVax dks iqu% 'kq: djrk gSA

175


izksxzkfeax fon fotqvy csfld MkWV usV

FindString FindStringExact

NOTES

GetItemHeight GetSelected

IndexFormPoint SetSelected

fyLVckWDl esa ,d fo'ks"k fLVªax ls 'kq: gksus okys igys vkbVe dks <w¡<rk gSA fyLVckWDl esa lcls igys ml vkbVe dks <w¡<rk gS] tks fo'ks"k fLVªax ls iwjk iwjk feyrk gSA fyLVckWDl ds vkbVe dh Å¡pkbZ ykSVkrk gSA mYys[k fd;k x;k vkbVe p;fur gS vFkok ugha bldk lwpd eku ykSVkrk gSA ;fn mYys[k fd;k x;k vkbVe p;fur gS rks ;g eku True gksrk gS vU;Fkk False gksrk gS A fn;s x;s dkWfMZusVl~ (coordinates) ij vkbVe dk baMsDl ykSVkrk gSA fyLVckWDl esa mYysf[kr vkbVe dk p;u ;k vkp;u djrk gSA

7.10.3 fyLVckWDl ds bos.V (Events of ListBox)

bl [k.M esa oh- ch- MkWV usV ds fyLVckWDl daVªksy ds izeq[k bos.V ds ckjs esa tkurs gSa A bos.V SelectedIndexChanged

fooj.k SelectedIndex izksiVhZ ds cnyus ij ?kfVr gksrk gSA ;g fyLVckWDl dk fMiQkWYV bos.V gksrk gSA

tc vki fyLVckWDl dks fDyd djrs gSa rks dksM fMtk;uj esa vkidks dksM dqN bl izdkj fn[ksxk& Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged End Sub 7.10.4 fyLVckWDl esa MkVk vkbVe dks fMtk;u le; esa tksM+uk ( Adding Data Items to A ListBox At Design Time)

fyLVckWDl esa fMtk;u le; esa MkVk vkbVe dks tksM+us ds fy;s fyLVckWDl ds Items izkWiVhZ dk mi;ksx djrs gSaA blds fy, fuEufyf[kr inksa dk vuqlj.k djsa& ➪ fyLVckWDl ds Items izkWiVhZ dks fDyd djsaA ,slk djus ij String Collection Editor Mk;ykWx ckWDl [kqysxkA (ns[ksa fp=k 7-16)

fp=k 7.16 : String Collection Editor Mk;ykWx ckWDl esa fyLVckWDl ds vkbVeksa dks tksM+rs gq,

176

fp=k 7.17 : ifj.kkeLo:i iQkWeZ ij fyLVckWDl esa tksMs+ x, vo;o

➪ bl Mk;ykWx ckWDl esa mu vkbVeksa dks Vkbi djsa tks vki tksM+uk pkgrs gSaA ,d ykbu esa ,d gh vkbVe Vkbi djsa rFkk nwljs vkbVe dks tksM+us ds fy, ,UVj dh nckdj nwljs ykbu ij vk;sa vkSj nwljk vkbVe Vkbi djsaA ➪ tc vkbVe dh lwph iw.kZ gks tk;s rc OK fDyd dj String Collection Editor Mk;ykWx ckWDl dks cUn dj nsaA


➪ F5 nckus ij ifj.kkeLo:i fyLVckWDl esa mu vkbVeksa dh lwph fn[ksxh tks vkius String Collection Editor Mk;ykWx ckWDl esa fn[krk gSA (ns[ksa fp=k 7-17) 7.10.5 fyLVckWDl ds MkVk vkbVe dks fMtk;u le; esa o.kZekyk Øe esa ltkuk ( Arranging Data Items in A ListBox)

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

tc vki fyLVckWDl esa MkVk vkbVe tksM+rs gSa rks og mlh Øe esa fyLVckWDl esa iznf'kZr gksrk gS ftl Øe esa vkius mUgsa String Collection Editor Mk;ykWx ckWDl esa izfo"V fd;k gSA vxj vki pkgsa rks bls o.kZekyk Øe esa ltk ldrs gSaA fyLVckWDl ds MkVk vkbVeksa dks o.kZekyk Øe esa ltkus ds fy, ;g djsa& ➪ fyLVckWDl ds Sorted izkWiVhZ dks True lsV djsaA blds ckn vki ns[ksaxs fd vkids }kjk izfo"V fd;k x;k MkVk vkbVe o.kZekyk Øe esa vk x;k gSA (ns[ksa fp=k 7-18)

fp=k 7.18 % Sorted izkWiVhZ dks True lsV djrs gq, (ck;sa) rFkk fyLVckWDl esa o.kZekyk Øe esa lts blds vkbVe 7.10.6 fyLVckWDl esa MkVk vkbVeksa dks fMtkbu le; esa gVkuk ( Removing Data Items From A ListBox At Design Time)

fyLVckWDl esa fMtkbu le; esa MkVk vkbVe dks gVkus ds fy;s fyLVckWDl ds Items izkWiVhZ dk gh mi;ksx djrs gSaA fyLVckWDl esa tksM+s x;s vkbVeksa dks gVkus ds fy;s fuEufyf[kr inksa dk vuqlj.k djsa& ➪ fyLVckWDl ds Items izkWiVhZ dks fDyd djsaA ,slk djus ij String Collection Editor Mk;ykWx ckWDl [kqysxkA ➪ bl Mk;ykWx ckWDl esa mu vkbVeksa dks ns[k ldrs gSa tks blesa igys ls izfo"V gSaA ➪ fdlh fo'ks"k vkbVe dks gVkus ds fy;s ml vkbVe dks gVk nsaA ;fn vki lHkh vkbVeksa dks gVkuk pkgrs gSa rks lHkh dk p;u djsa vkSj feVk nsaA OK fDyd dj String Collection Editor dks cUn djsaA ➪ F5 nckus ij ifj.kkeLo:i fyLVckWDl esa mu vkbVeksa dh lwph vc ugha fn[ksxhA 7.10.7 fyLVckWDl esa izksxzke ds ekè;e ls MkVk vkbVe tksM+uk (Adding Data Items to A ListBox Programmatically)

fyLVckWDl esa MkVk vkbVeksa dks izksxzke ds ekè;e ls juVkbe esa Hkh tksM+k tk ldrk gSA blds fy, bldk izk:i ;g gS& 177

<NameofListbox>.Items.Add("Name Of Items")


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

mnkgj.k ds fy, & ListBox1.Items.Add("Alisha")

LVsVes.V vkids fyLVckWDl esa Alisha dks tksM+ nsxkA vki ftruk pkgsa mruk vkbVEl fyLV esa tksM+ ldrs gSaA mnkgj.k ds fy;s ListBox1 esa ik¡p 'kgjksa ds uke tksM+us ds fy, dksM bl rjg ls fy[ksa& ListBox1.Items.Add ("New Delhi") ListBox1.Items.Add ("Agra") ListBox1.Items.Add ("Mathura") ListBox1.Items.Add ("Patna") ListBox1.Items.Add ("Bhopal")

izksxzke dks ju djus ij ;g vkbVe vkidks ListBox1 uke ds fyLVckWDl esa fn[ksxkA 7.10.8 fyLVckWDl esa izksxzke ds ekè;e ls MkVk vkbVe dks gVkuk (Removing Data Items From A ListBox Programmatically)

tc vki fyLVckWDl esa dksbZ vkbVe tksM+rs gSa rks oh- ch- MkWV usV bl fyLVckWDl dks ,d bUMsDl nsrk gSA ;g 0 ls 'kq: gksrk gSA ;g bUMsDl fyLVckWDl esa ml vkbVe dk LFkku gksrk gSA fdlh fo'ks"k vkbVe ds fyLVckWDl esa bUMsDl dSls irk djrs gSa bldks ySc vH;kl 7-3 esa fn[kk;k x;k gSA fyLVckWDl esa fdlh ,d vkbVe dks gVkus ds fy, ge ml vkbVe bUMsDl ds dek.M ls jsiQjsUl nsrs gSaA fdlh ,d vkbVe dks fyLVckWDl ls gVkus ds fy;s ;g izk:i gS& <NameOfListBox>.Items.RemoveAt(Index)

mnkgj.k ds fy;s vki fiNys [k.M esa ik¡p 'kgjksa ds uke dks fyLVckWDl esa tksM+s gSaA mlesa Mathura dk baMsDl 2 gSA ;fn vki bls feVkuk pkgrs gSa rks ;g dksM fy[kuk gksxk & ListBox1.Items.RemoveAt(2)

;fn vki fyLVckWDl ds lHkh vkbVeksa dks ,d ckj esa gVkuk pkgrs gSa rks bls bl dksM ds ekè;e ls gVk ldrs gSa & ListBox1.Items.Clear()

uksV % ;fn vkius vkbVeksa dks igys ls fMtkbu le; esa fyLVckWDl esa tksM+k gqvk gS rks og rc rd fyLVckWDl ls ugha gVrs tc rd dh vki mUgsa Items izkWiVhZ ls fMtk;u le; esa ugh gVk nsaA ySc vH;kl 7.3 (Lab Exercise 7.3) ,d fo.Mkst+ ,fIyds'ku cuk,¡A mlesa ,d fyLVckWDl rFkk ,d VsDLVckWDl tksM+saA bl ,fIyds'ku esa nl vkbVeksa dks izksxzke ds ekè;e ls fyLVckWDl esa tksM+saA rFkk ;wtj ds }kjk fdlh vkbVe dk p;u djus ij mldk bUMsDl VsDLVckWDl ij crk,A bldk baVjisQl fp=k LA7.5 dh Hkk¡fr gksxkA blesa tksM+s x;s vkWCtsDV muds izkWiVhZ rFkk eku dk fooj.k bl izdkj gS&

178

vkWCtsDV

izkWiVhZ

eku

iQkWeZ

Name

Form1

Text

ListBox Demo 1

fyLVckWDl

Name

ListBox1

VsDLVckWDl

Name

TextBox1

ReadOnly

True


GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

fp=k LA7.5 : ySc vH;kl 7.3 dk baVjisQl lek/ku % ➪ File esU;w dks fDyd djsa rFkk New Project dk p;u djsa A ➪ New Project Mk;ykWx ckWDl [kqyus ds i'pkr Templates isu esa Windows Application dks fDyd djsaA ➪ Name VsDLVckWDl esa Lab Exercise 7.3 Vkbi djsa rFkk OK dks fDyd djsa A mlds ckn ,d u;k fo.Mkst iQkWeZl izkstsDV [kqysxkA ➪ iQkWeZ ij iz'u esa fn, x, fooj.k ds vuqlkj VwyckWDl ls daVªksy dks tksMsa+A rFkk iz'ukuqlkj muds izkWiVhZ dks lsV djsa rFkk fp=kkuqlkj mugsa ltk,Wa A ➪ iQkWeZ dks nks ckj fDyd djsa vkSj Form_Load bos.V gS.Myj ds fy, fuEufyf[kr dksM fy[ksaµ ListBox1.Items.Add("Patna") ListBox1.Items.Add("Bhopal") ListBox1.Items.Add("Kolkata") ListBox1.Items.Add("Lucknow") ListBox1.Items.Add("Raipur") ListBox1.Items.Add("Chennai") ListBox1.Items.Add("Bangalore") ListBox1.Items.Add("Mumbai") ListBox1.Items.Add("Kohima") ListBox1.Items.Add("Panaji")

➪ vc mlds ckn vki fyLVckWDl dks nks ckj fDyd djsa rFkk ListBox1_Selected IndexChanged bos.V gS.Myj ds fy, ;g dksM fy[ksa& TextBox1.Text = ListBox1.SelectedIndex

➪ F5 nckdj bls ju djk;saA vkidks fp=k LA7.6 dh Hkk¡fr ifj.kke feysxkA

179


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

fp=k LA7.6 : ySc vH;kl 7.3 dk ifj.kke ySc vH;kl 7.4 (Lab Exercise 7.4) ,d fo.Mkst ,fIyds'ku cuk;saA mlesa ,d fyLVckWDl ,d VsDLVckWDl rFkk ,d cVu tksM+saA bl ,fIyds'ku esa dqN vkbVeksa dks Items izkWiVhZ ds ekè;e ls tksM+saA cVu dks fDyd djus ij VsDLVckWDl esa ml fyLVckWDl ds dqy vkbVeksa dh la[;k crk, blesa tksM+s x;s vkWCtsDV muds izkWiVhZ rFkk eku dk fooj.k bl izdkj gS rFkk bldk baVjisQl fp=k LA7.7 dh Hkk¡fr gksxkA vkWCtsDV iQkWeZ fyLVckWDl cVu VsDLVckWDl

izkWiVhZ

eku

Name Text Name Name Text Name ReadOnly

Form1 ListBox Demo2 ListBox1 btnCount Count Items TextBox1 True

fp=k LA7.7 : ySc vH;kl 7.4 dk baVjisQl lek/ku % ➪ File esU;w dks fDyd djsa rFkk New Project dk p;u djsa A 180

➪ New Project Mk;ykWx ckWDl [kqyus ds i'pkr Templates isu esa Windows Application dks fDyd djsaA


➪ Name VsDLVckWDl esa Lab Exercise 7.4 Vkbi djsa rFkk OK dks fDyd djsa A mlds ckn ,d u;k fo.Mkst iQkWeZl izkstsDV [kqysxkA ➪ iQkWeZ ij iz'u esa fn, x, fooj.k ds vuqlkj VwyckWDl ls daVªksy dks tksMsa+A rFkk iz'ukuqlkj muds izkWiVhZ dks lsV djsa rFkk fp=kkuqlkj mugsa ltk,WaA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

➪ iQkWeZ dks nks ckj fDyd djsa vkSj Form1_Load bos.V gS.Myj ds fy, fuEufyf[kr dksM fy[ksaµ ListBox1.ItemsAdd("Blaise Pascal") ListBox1.ItemsAdd("Charles Babbage") ListBox1.ItemsAdd("Ada Augusta") ListBox1.ItemsAdd("Dennis Ritchi") ListBox1.ItemsAdd("BJarne Stroustup") ListBox1.ItemsAdd("Bill Gates") ListBox1.ItemsAdd("James Gosling")

➪ mlds ckn okil iQkWeZ fMtk;uj ij ykSVsa rFkk Count Items cVu dks nks ckj fDyd djsa rFkk btnCount_Click bos.V gS.Myj ds fy, ;g dksM fy[ksa& TextBox1.Text = "Total Items in This ListBox is" &ListBox1.Items.Count

➪ F5 nckdj dhcksMZ ls bl izksxzke dks ju djk;saA izksxzke ds ju gksus ij Count Items dks fDyd djsaA ,slk djus ij VsDLVckWDl esa vkidks Total Items in This ListBox is ...... fn[ksxkA vki tks ifj.kke LØhu ij ns[ksaxs og fp=k LA7.8 dh Hkk¡fr gksuk pkfg,A

fp=k LA7.8 : ySc vH;kl 7.4 dk ifj.kke

7.11

dkWEcksckWDl daVªksy (The CombBox Control)

dkWEcks ckWDl dks lcls cf<;k rjhds ls ml VsDLVckWDl ds :i esa le>k tk ldrk gS ftlesa ,d lgk;d fyLV ckWDl tqM+k gks vFkkZr~ dkWEcks ckWDl fyLV ckWDl ls tqM+k gqvk ,d VsDLV ckWDl dh rjg gksrk gSA lkekU; VsDLV ckWDl esa ;wtj dks iwjk lwpuk ckWDl esa Vkbi djuk gksrk gSA dkWEcks ckWDl esa ;wtj ds ikl nks fodYi gksrs gSaA og lwpuk dks Vkbi dj ldrk gS ;k fiQj lgh lwpuk dks lwph ls p;u dj ldrk gSA p;u ds ckn og lwpuk dkWEcks ckWDl ds mQij izdV gksrk gSA dkWEcks ckWDl rhu izdkj ds Simple, DropDown rFkk DropDownList ds gksrs gSa tks blds DropDownStyle izkWiVhZ ds }kjk lsV fd;s tkrs gSaA (ns[ksa fp=k 7-19)

181


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

fp=k 7.19 : iQkWeZ ij rhuksa izdkj ds izdV dkWEcks ckWDl DropDown dkWEcks ckWDl dk mi;ksx fo.Mkst ,fIyds'ku esa oSls VsDLVckWDl ds :i esa gksrk gS

ftlds lkFk fiNys izfof"V;ksa dh lwph tqM+h gksrh gSA tgk¡ ls vki dksbZ u;h izfof"V tksM+ ldrs gSa ;k iqjkus izfof"V dk p;u dj ldrs gSaA dkWEcks ckWDl ds uke esa fu;ekuqlkj cbo milxZ tksM+k tkuk pkfg,A Simple dkWEcks ckWDl esa lwph ges'kk n`'; gksrk gSA DropDown dkWEcks ckWDl esa lwph uhps yVdrh

gS tc ;wtj ,sjks dks fDyd djrk gS rFkk p;u ds ckn ;g vn`'; gks tkrk gSA nksuksa gh fLFkfr esa lwph ls fdlh vkbVe dk p;u gksrk gS rks og vkbVe lcls mij VsDLVckWDl esa Lor% gh izdV gksrk gS rFkk bldk eku dkWEcks ckWDl ds Text izkWiVhZ esa vlkbu gks tkrk gSA DropDownList dkWEcks ckWDl DropDown ckWDl dh rjg gh fn[krk gS ijUrq nksuksa es iQdZ ;g gS fd ;wtj fyLV ls vkbVe dk p;u dj ldrk gS rFkk VsDLV ckWDl esa bls Vkbi ugha dj ldrk gSA dkWEcks ckWDl ds izkWiVhZ] esFkM rFkk bos.V fyLV ckWDl ds yxHkx leku gksrs gSaA fo'ks"kdj fyLVckWDl ij dh x;h iwjh ppkZ dkWEcks ckWDl ds fy, Hkh cjkcj izklafxd gksrk gSA Text izkWiVhZ ;g lqfuf'pr djrk gS fd dkWEcks ckWDl ds lcls mij D;k izdV gks tksfd fMtk;u le; esa gh Li"V gksuk pkfg,A 7.11.1 dkWEcksckWDl rFkk fyLVckWDl (CombBox Vs ListBox)

dkWEcks ckWDl rFkk fyLVckWDl daVªksy esa cgqr lekurk,¡ gSa rFkk nksuksa ds dk;Z Hkh yxHkx ,d tSls gSaA dqN ifjfLFkfr;ksa esa fyLVckWDl ds LFkku ij dkWEcksckWDl rFkk dkWEcksckWDl ds LFkku ij fyLVckWDl dk mi;ksx Hkh gks ldrk gSA ;|fi dHkh&dHkh fdlh fo'ks"k ifjfLFkfr esa ,slk Hkh gksrk gS fd dkWEcksckWDl fdlh dk;Z ds fy, fyLVckWDl ls vf/d mi;qDr gksA lkekU;r% dkWEcksckWDl ogkWa vf/d mi;qDr gksrk gS tgkWa fodYiksa dh ,d lwph gksrh gSA rFkk fyLVckWDl ogk¡ vf/d mi;qDr gksrk gS tgk¡ vki lwph ds vuqlkj gh buiqV dks lhfer dj nsrs gSaA vFkkZr~ dkWEcksckWDl esa vki viuk fodYi Vkbi djds ;g irk yxk ldrs gSa fd ;g fodYi lwph esa gS vFkok ugha tcfd fyLVckWDl esa fodYi dk p;u lwph ls gh djuk gksrk gSA bles ,d viokn Hkh gSA ;fn vkius dkWEcksckWDl ds DropDownStyle ds eku dks DropDownList lsV dj fn;k gS rks vki fodYi dks VsDLVckWDl esa Vkbi djds p;u ugha dj ldrs gSaA ijUrq fodYi dk igyk v{kj nsrs gh mlls 'kq# gksus okyk fodYi izdV gks tk;sxkA 182

blds vfrfjDr] dkWEcksckWDl iQkWeZ ij fyLVckWDl ds vis{kkÑr de LFkku ysrk gS D;ksafd blesa iwjh lwph ,d lkFk rc rd iznf'kZr ugha gksrk gS tcrd fd ;wtj Mkmu ,sjks dks fDyd ugha djrk gSA


dkWEcksckWDl dk DropDownStyle izkWiVhZ ;fn Simple lsV dj fn;k tk; rks og fyLVckWDl ftruk gh LFkku ysxk D;ksafd og fiQj fyLVckWDl dh rjg lwph ds ,d ls vf/d vkbVeksa dks ,d ckj esa gh iznf'kZr dj nsrk gSA fp=k 7-19 esa Simple dkWEcksckWDl, DropDown dkWEcksckWDl rFkk DropDownList dkWEcksckWDl fn[kk;k x;k gSA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

fp=k 7.20 % dkWEcksckWDl rFkk fyLVckWDl 7.11.2 dkWEcksckWDl ds eq[; izkWiVhZ (Main Properties of the CombBox)

bl [k.M esa oh- ch- MkWV usV ds dkWEcksckWDl daVªksy ds izkWiVhZ ds ckjs esa tkurs gSa A buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt+ fo.Mks ds ek?;e ls lsV dj ldrs gSa A rFkk dqN tks izkWiVhZt+ fo.Mks esa izdV ugha gksrs gSa mugsa ju le; esa dksM ds ek?;e ls lsV dj ldrs gSa A gkykafd lHkh izkWiVhZ dks izksxzke ds ek?;e ls dksM fy[k dj lsV fd;k tk ldrk gSA izkWiVhZ AutoCompleteCustomSource

AutoCompleteMode

AutoCompleteSource

DataSource DrawMode

DropDownHeight DisplayMember DropDownStyle

fooj.k dLVe System.Collection.Specialized.StringCollection (fLaVªx ds ladyu dks O;Dr djrk gSA) ds mi;ksx dks lsV djrk gS tc AutoCompleteSource izkWiVhZ CustomSource lsV gksrk gSA ml fodYi dks lsV djrk gS tks dkWEcksckWDl ds fy, Lor% dEiyh'ku (automatic completion) dSls dk;Z djrk gS dks fu;af=kr djrk gSA ;g izkWiVhZ MkWV usV izsQeodZ laLdj.k 2-0 ds fy, u;k gSA ml eku dks lsV djrk gS tks vkWVksesfVd dEIyh'ku (completion) ds fy, mi;ksx gksus okys lEiw.kZ fLaVªx~l ds fy, lkslZ dks Li"V djrk gSA bl dkWEcksckWDl ds fy, MkVk lkslZ dks lsV djrk gS ;k mlds ckjs esa crkrk gSA ml eku dks lsV djrk gS tks ;g Li"V djrk gS fd vkidk dksM ;k vkWijsfVax flLVe fyLV esa vo;oksa dh MªkbZax (drawing) dks gS.My djsxk vFkok ughaA dkWEcks ckWDl ds MªkWi Mkmu Hkkx dh m¡pkbZ dks fiDlsy esa lsV djrk gSA dkWEcksckWDl esa vkWCtsDV ds fdl izkWiVhZ dks fn[kkuk gS ;g crkrk gSA dkWEcksckWDl dk MªkWi Mkmu LVkby lsV djrk gSA

183


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

DropDownWidth DroppedDown FlatStyle Focused IntegralHeight ItemHeight Items MaxDropDownItems MaxLength PreferredHeight

SelectedIndex SelectedItem SelectedText SelectionLength SelectionStart Sorted

dkWEcksckWDl ds MªkWi Mkmu eku dh pkSM+kbZ dks lsV djrk gSA ;g lsV djrk gS fd dkWEcksckWDl viuk MªkWi Mkmu fgLlk fMLIys djs ;k u djsA dkWEcksckWDl ds :i (appearance) dks lsV djrk gSA og eku ysrk gS] tks Li"V djrk gS fd dkWEcksckWDl ij iQksdl gS vFkok ughaA ;g lsV djrk gS fd dkWEcksckWDl vkdkj cny lds ;k ugha rkfd iwjk&iwjk vkbVe fn[k ldsA dkWEcksckWDl esa vkbVe dh Å¡pkbZ izkIr djrk gSA dkWEcksckWDl esa vkbVeksa dks tksMr+ k gS ;k ogk¡ ls vkbVeksa dks gVkrk gSA dkWEcksckWDl ds MªkWi Mkmu fgLls esa n`'; vkbVeksa dh lhek dks lsV djrk gSA dkWEcks ckWDl ds VsDLVckWDl esa dSjsDVjksa dh vf/dre lhek lsV djrk gSA dkWEcks ckWDl ds ojh; (preferred) Å¡pkbZ dks lsV djrk gSA ojh; Å¡pkbZ dk eku iQkW.V ds Å¡pkbZ rFkk ckWMZj ds }kjk fy, x;s LFkku ij vk/kfjr gksrk gSA oÙkZeku p;fur vkbVe dks Li"V djrk gqvk baMsDl izkIr djrk ;k lsV djrk gSA dkWEcksckWDl esa orZeku ds p;fur vkbVe dks lsV djrk gSA ml VsDLV dks lsV djrk gS tks dkWEcksckWDl ds VsDLVckWDl Hkkx esa p;fur gksA dkWEcksckWDl ds VsDLVckWDl fgLls esa p;fur djSDVjksa dh lhek lsV djrk gSA dkWEcksckWDl esa p;fur VsDLV ds izkjfEHkd baMsDl dks lsV djrk gSA dkWEcksckWDl esa vkbVe lksVsZM gS ;k ugha ;g lsV djrk gSA

7.11.3 dkWEcksckWDl ds eq[; esFkM (Main Methods of the CombBox)

bl [k.M esa oh- ch- MkWV usV ds dkWEcksckWDl daVªksy ds izeq[k esFkMksa ds ckjs esa tkurs gSaA esFkM BeginUpdate Dispose EndUpdate FindString FindStringExact GetItemText Select 184

SelectAll

fooj.k dkWEcksckWDl esa ,d ,d dj ds vkbVeksa dks tksM+us ds nkSjku ijiQkWjesUl (performance) dks esuVsu djrk gSA dkWEcksckWDl ds }kjk mi;ksx fd;k tkus okys lalk/uksa dks fjyht djrk gSA dkWEcksckWDl ds fotqvy viMsfVax dks nksckjk izkjEHk djrk gSA dkWEcksckWDl esa lcls igys vkbVe dks <w¡<+rk gS] tks lkadsfrd fLVªax ls 'kq: gksrk gSA ml vkbVe dks <wa<+rk gS] tks lkadsfrd fLVaªx esa iwjk&iwjk feyrk gSA vkbVe dks VsDLV izkIr djrk gSA VsDLV dh jsUt dk p;u djrk gSA dkWEcksckWDl ds VsDLVckWDl esa lHkh VsDLV dk p;u djrk gSA


7.11.4 dkWEcksckWDl ds eq[; bos.V (Main Events of the CombBox)

bl [k.M esa oh- ch- MkWV usV ds dkWEcksckWDl daVªksy ds izeq[k bos.V ds ckjs esa tkurs gSaA bos.V DropDown DropDownStyleChanged SelectedIndexChanged

fooj.k rc ?kfVr gksrk gS tc dkWEcksckWDl dk MªkWi&Mkmu Hkkx fn[krk gSA DropDownStyle izkWiVhZ cnyus ij ?kfVr gksrk gSA SelectedIndex izkWiVhZ ds cnyus ij ?kfVr gksrk gSA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

7.11.5 dkWEcksckWDl esa MkVk vkbVe dks fMtk;u le; esa tksM+uk (Adding Data Items to A ComboBox In Design Time)

dkWEcks ckWDl esa fMtk;u le; esa MkVk vkbVe dks tksM+us ds fy;s dkWEcksckWDl ds Items izkWiVhZ dk mi;ksx djrs gSaA blds fy;s fuEufyf[kr inksa dk vuqlj.k djsa & ➪ dkWEcksckWDl ds Items izkWiVhZ dks fDyd djsaA ,slk djus ij String Collection Editor Mk;ykWx ckWDl [kqysxkA ➪ bl Mk;ykWx ckWDl esa mu vkbVeksa dks Vkbi djsa tks vki tksM+uk pkgrs gSaA ,d ykbu esa ,d gh vkbVe Vkbi djsa rFkk nwljs vkbVe dks tksM+us ds fy;s ,.Vj dh nckdj nwljs ykbu ij vk;sa vkSj nwljk vkbVe Vkbi djsaA ➪ tc vkbVe dh lwph iw.kZ gks tk;s rc OK fDyd dj String Collection Editor Mk;ykWx ckWDl dks cUn dj nsaA ➪ F5 nckus ij ifj.kkeLo:i dkWEcksckWDl esa mu vkbVeksa dh lwph fn[ksxh tks vkius String Collection Editor Mk;ykWx ckWDl esa ns[kk gSA (ns[ksa fp=k 7-21)

fp=k 7.21 : dkWEcks ckWDl esa izdV vkbVe 7.11.6 dkWEcksckWDl ds MkVk vkbVe dks fMtk;u le; esa o.kZekyk Øe esa ltkuk ( Arranging Data Items in A ComboBox Alphabetically in Design Time)

tc vki dkWEcksckWDl esa MkVk vkbVe tksM+rs gSa rks og mlh Øe esa dkWEcksckWDl esa iznf'kZr gksrk gS ftl Øe esa vkius mUgha String Collection Editor Mk;ykWx ckWDl esa izfo"V fd;k gSA vxj vki pkgsa rks bls o.kZekyk Øe esa ltk ldrs gSaA dkWEcksckWDl ds MkVk vkbVeksa dks o.kZekyk Øe esa ltkus ds fy;s ;g djsa & ➪ dkWEcksckWDl ds Sorted izkWiVhZ dks True lsV djsaA blds ckn vki ns[ksaxs fd vkids }kjk izfo"B fd;k x;k MkVk vkbVe o.kZekyk Øe esa vk x;k gSA (ns[ksa fp=k 7-22)

185


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

fp=k 7.22 : dkWEcksckWDl esa o.kZekyk Øe esa lts vkbVe (nk;sa) 7.11.7 dkWEcksckWDl esa MkVk vkbVe dks fMtk;u le; esa gVkuk ( Removing Data Items From A ComboBox At Design Time)

dkWEcksckWDl esa fMtk;u le; esa MkVk vkbVe dks gVkus ds fy;s dkWEcksckWDl ds Items izkWiVhZ dk gh mi;ksx djrs gSaA dkWEcksckWDl esa tksM+s x;s vkbVeksa dks gVkus ds fy;s fuEufyf[kr inksa dk vuqlj.k djsa& ➪ dkWEcksckWDl ds Items izkWiVhZ dks fDyd djsaA ,slk djus ij String Collection Editor Mk;ykWx ckWDl [kqysxkA ➪ bl Mk;ykWx ckWDl esa mu vkbVeksa dks ns[k ldrs gSa tks blesa igys ls izfo"V gSaA ➪ fdlh fo'ks"k vkbVe dks gVkus ds fy;s ml vkbVe dks gVk nsaA ;fn vki lHkh vkbVeksa dks gVkuk pkgrs gSa rks lHkh dk p;u djsa vkSj feVk nsaA OK fDyd dj String Collection Editor dks cUn djsaA ➪ F5 nckus ij ifj.kkeLo:i dkWEcksckWDl esa mu vkbVeksa dh lwph vc ugha fn[ksxhA ySc vH;kl 7.5 (Lab Exercise 7.5) ,d fo.Mkst izksxzke fy[ksa tks Simple dkWEcks ckWDl dk mi;ksx i=k ds irs ds igys ykbu ds fy, DropDown dkWEcks ckWDl ls O;Dr dj VkbVy rFkk Simple dkWEcks ckWDl ls O;fDr dk uke izkIr djrk gSA rFkk Display Full Name dks fDyd djus ds i'pkr~ VsDLVckWDl eas ifj.kkeLo:i iwjk uke izdV djsaA blesa mi;ksx gksus okys vkWCtsDV] izkWiVhZ rFkk muds eku bl izdkj gSaA bldk baVjisQl fp=k LA7.9 dh Hkk¡fr gksxkA

186

vkWCtsDV iQkWeZ

izkWiVhZ

eku

Name Text

Form1 Lab Exercise 7.5

yscy

Name Text

Label1 Title

dkWEcksckWDl

Name Items

cboTitle Ms. Mr. Mrs. Dr. DropDown

DropDownStyle


dkWEcksckWDl

yscy cVu VsDLVckWDl

Name Items

DropDownStyle Name Text Name Text Name ReadOnly

cboName Mansoor Alam Kamal Ashraf Sunita Agarwal Himanshi Bhatia Raj Malhotra Alok Singh Simple Label2 Name btnDisplay Display Full Name txtResult True

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

fp=k LA7.9 : ySc vH;kl 7.5 dk baVjisQl lek/ku % ➪ File esU;w dks fDyd djsa rFkk New Project dk p;u djsa A ➪ New Project Mk;ykWx ckWDl [kqyus ds i'pkr Templates isu esa Windows Application dks fDyd djsaA ➪ Name VsDLVckWDl esa Lab Exercise 7.5 Vkbi djsa rFkk OK dks fDyd djsa A mlds ckn ,d u;k fo.Mkst iQkWeZl izkstsDV [kqysxkA ➪ iQkWeZ ij iz'u esa fn, x, fooj.k ds vuqlkj VwyckWDl ls daVªksy dks tksMsa+A rFkk iz'ukuqlkj muds izkWiVhZ dks lsV djsa rFkk fp=kkuqlkj mugsa ltk,Wa A ➪ Display Full Name dks nks ckj fDyd djsa rFkk btnDisplay_Click bos.V gS.Myj ds fy;s ;g dksM fy[ksa& txtResult.Text = cboTitle.Text & “ “ & cboName.Text

➪ F5 dk mi;ksx djds dhcksMZ ls izksxzke dks ju djk;saA blesa nks izdkj ds dkWEcks ckWDl dk mi;ksx gqvk gSA VkbVy okyk dkWEcksckWDl DropDown rFkk Name okyk dkWEcksckWDl Simple dkWEcksckWDl gSA blds ifj.kke dks tk¡pus ds fy;s Title dkWEcksckWDl ls Mr. dk

187


p;u djsa rFkk Name dkWEcksckWDl ls Mansoor Alam dk p;u djsaA mlds ckn Display Full Name cVu dks fDyd djsaA vki fp=k LA7.10 dh Hkk¡fr ifj.kke ns[ksaxsA

izksxzkfeax fon fotqvy csfld MkWV usV NOTES

fp=k LA7.10 : ySc vH;kl dk ifj.kke

7.12

psdckWDl daVªksy (The CheckBox Control)

psdckWDl daVªksy dksbZ fo'ks"k dafM'ku vkWu ;k vkWiQ gS ;g crkus ds fy, mi;ksx gksrk gSAA lkekU;r% bldk mi;ksx Yes/No vFkok True/False esa ls p;u ds fy, gksrk gSA bldk mi;ksx fn;s x;s fodYiksa esa ls ,d ls vf/d fodYiksa ds p;u ds fy, Hkh gksrk gSA psdckWDl dqN vFkZ esa] jsfM;ks daVªksy dh rjg gksrk gS D;ksafd nksuksa gh dk ,d mi;ksx fodYikas esa ls bPNkuqlkj fodYi ds p;u ds fy, gksrk gSA nksukas esa eq[; varj dsoy ;gh gS fd psdckWDl fodYiksa esa ,d ls vf/d dk p;u gks ldrk gS tcfd jsfM;ks cVu daVªksy dsoy ,d fodYi ds p;u rd lhfer gSA

fp=k 7.23 : iQkWeZ ij iznf'kZr psdckWDl daVªksy psdckWDl dh lgk;rk ls lkekU; MkVk ckbfUMax dk mi;ksx djrs gq, vo;oksa (elements) dks MkVkcsl ls tksM+k tk ldrk gSA eYVhiy psdckWDl dks xzqickWDl daVªksy dh lgk;rk ls lewg esa Hkh j[kk tk ldrk gSA ;g fotqvy izdVhdj.k (Appearance) rFkk ;wtj baVjiQsl fMtk;u ds fy, Hkh vPNk le>k tkrk gS D;ksafd xzqiM daVªksYl dks iQkWeZ fMtkbuj ij ,d lkFk ?kqek;k tk ldrk gSA 188

psdckWDl daVªksy dh nks egRoiw.kZ izkWiVhZ”k Checked rFkk CheckState gSaA Checked izkWiVhZ lR; ;k vlR; ykSVkrk gSA CheckState izkWiVhZ Checked vFkok Unchecked ykSVkrk gSA vkSj ;fn bldk


ThreeState izkWiVhZ True lsV gS] rks CheckState izkWiVhZ Indeterminate eku Hkh ykSVk ldrk gSA

baMhVjfeusV voLFkk esa psdckWDl ef¼e gks tkrk gS] tks ml fodYi dh vuqiyC/rk dk lwpd gSA fp=k 7-23 esa iQkWeZ ij psdckWDl daVªksy fn[kk;k x;k gSA 7.12.1 psdckWDl ds izkWiVhZ (Properties of CheckBox)

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

bl [k.M esa oh- ch- MkWV usV ds psdckWDl daVªksy ds izkWiVhZ ds ckjs esa tkurs gSaA buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkiVhZt fo.Mks ds ekè;e ls lsV dj ldrs gSaA rFkk dqN tks izkWiVhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSaA gkykafd lHkh izkWiVhZ dks izksxzke ds ekè;e ls dksM fy[kdj lsV fd;k tk ldrk gSA Appearance Autocheck CheckAlign Checked CheckState FlatStyle TextAlign ThreeState

psdckWDl ds :i&jax dks lsV djrk gSA psdckWDl ds fDyd fd;s tkus ij Checked ;k Check State eku rFkk psdckWDl dk :i&jax Lor% gh cnysxk ;g Li"V djrk gSA fdlh daVªksy esa psdckWDl ds {kfrt rFkk mnxz vykbuesUV dks lsV djrk gSA psdckWDl psd~M voLFkk esa gS vFkok ugha bldks Li"V djus okyk eku lsV djrk gSA psdckWDl dh voLFkk (state) dks lsV djrk gSA psdckWDl dk lery :ih jax&:i lsV djrk gSA psdckWDl daVªksy esa VsDLV ds vykbues.V dks lsV djrk gSA ;g Li"V djrk gS fd psdckWDl nks ds ctk; rhu psd voLFkk esa fn[ksxkA

7.12.2 psdckWDl ds bos.V (Events of CheckBox)

bl [k.M esa oh- ch- MkWV usV ds psdckWDl daVªksy ds izeq[k bos.V ds ckjs esa tkurs gSaA AppearanceChanged

Appearance izkWiVhZ ds cnyus ij ?kfVr gksrh gSA

CheckedChanged

Checked izkWiVhZ ds cnyus ij ?kfVr gksrh gSA

CheckStateChanged

CheckState izkWiVhZ ds eku esa cnyko gksus ij ?kfVr gksrh gSA

7.13

jsfM;ks cVu daVªksy (The Radio Button Control)

jsfM;ks cVu daVªksy ;wtj dks nks ;k vf/d ikjLifjd vuU; fodYiksa dk ,d lsV izLrqr djrk gSA jsfM;ks cVu rFkk psdckWDl dk dk;Z leku rks yxrk gS ijUrq mlesa ,d cqfu;knh iQdZ gSA jsfM;ks cVu fodYiksa ds lsV esa ls dsoy ,d fodYi ds p;u dh vuqefr nsrk gS tcfd psdckWDl dh lgk;rk ls fodYiksa esa ls ,d ls vf/d dk Hkh pquko fd;k tk ldrk gSA jsfM;ks cVu daVªksy ds fodYiksa esa ;wtj ds ikl p;u djus dks dsoy ,d gh fodYi jgrk gSA ,d ds p;u ds ckn 'ks"k Lor% gh vp;fur gks tkrk gSA tc jsfM;ks daVªksy dks fDyd fd;k tkrk gS rc bldk Checked izkWiVhZ lR; (True) gks tkrk gSA rFkk Click bos.V gS.Myj dkWy gks tkrk gSA Checked izkWiVhZ ds eku ds cnyus ij CheckedChanged bos.V tkx`r gksrk gSA AutoCheck izkWiVhZ ds lR; (True) lsV gksus dh fLFkfr esa ,d jsfM;ks cVu p;fur gksus ds i'pkr~ xqzi esa lHkh vU; Lor% gh fjDr gks tkrs gSaA izkWiVhZ vlR; (false) lkekU;r% rc gh lsV gksrk gS] tc oSfyMs'ku dksM dk iz;ksx og lqfuf'pr djus ds fy, gksrk gS fd p;fur jsfM;ks cVu rd Lohdkj;ksX; fodYi gSA daVªksy dk VsDLV (Text) izksiVhZ ds lkFk lsV fd;k tkrk gS ftlesa ,Dlsl dh 'kkWVdV gks ldrs gSaA ,Dlsl dks ifjHkkf"kr djus ds ckn vki ml ,Dlsl dh dks ALT ds lkFk nckdj jsfM;ks cVu fodYi dk p;u dj ldrs gSaA jsfM;ks cVu daVªksy dks dek.M cVu ds :i esa cny ldrs gSa ftlds fy, Appearance izkWiVhZ ls Button lsV djuk gksxkA fp=k 7-24 esa fofHkUu izdkj ds jsfM;ks cVu dks fn[kk;k x;k gSA

viuh izxfr dks tk¡psa 3. Text izkWiVhZ dk D;k mn~ns'; gS\ 4. TextBox dUVªksy D;k gS\ 189


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

fp=k 7.24 : iQkWeZ ij tksM+s x;s fofHkUu izdkj ds jsfM;ks cVu 7.13.1 jsfM;ks cVu ds izkWiVhZ (Properties of Radio Button)

bl [k.M esa oh-ch- MkWV usV ds jsfM;ks cVu daVªksy ds izkWiVhZ ds ckjs esa tkurs gSaA buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt fo.Mks ds ekè;e ls lsV dj ldrs gSaA rFkk dqN tks izkWiVhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSaA ;|fi lHkh izkWiVhZ dks izksxzke ds ekè;e ls dksM fy[k dj lsV fd;k tk ldrk gSA izkWiVhZ Apperarnce AutoCheck CheckAlign Checked FlatStyle Image ImageAlign ImageIndex TabStop TextAlign

fooj.k og eku lsV djrk gS tks jsfM;ks cVu ds :i&jax dks fu/kZfjr djrk gSA eku lsV@izkIr djrk gS ;g lwfpr djrs gq, fd Checked oSY;w rFkk daVªksy dk :i&jax jsfM;ks cVu ds fDyd gksus ij Lor% gh cnysxk ;k ughaA jsfM;kscVu ds psdckWDl Hkkx ds yksds'ku dks lsV djrk gSA eku lsV@izkIr djrk gS ;g lwfpr djrs gq, fd jsfM;ks cVu psd gS vFkok ughaA jsfM;ks cVu ds lery :ih (Flat-Style) jax&:i dks lsV djrk gSA jsfM;ks cVu esa iznf'kZr gksus okys best dks lsV djrk gSA jsfM;ks cVu esa best ds vykbues.V dks lsV djrk gSA jsfM;ks cVu esa iznf'kZr best ds best fyLV baMsDl eku dks lsV djrk gSA ml eku dks lsV djrk gS tks ;g Li"V djrk gS fd ;wtj TAB dh dk mi;ksx dj daVªksy dks iQksdl dj ldrk gS vFkok ughaA jsfM;ks cVu esa VsDLV vkykbues.V dks lsV djrk gSA

7.13.2 jsfM;ks cVu ds esFkM (Methods of Radio Button)

bl [k.M esa oh- ch- MkWV usV ds jsfM;ks cVu daVªksy ds izeq[k esFkM ds ckjs esa tkurs gSaA esFkM PerformClick

fooj.k jsfM;ks cVu ds fy, Click bos.V dks tsusjsV djrk gSA

7.13.3 jsfM;ks cVu ds bos.V (Events of Radio Button)

bl [k.M esa oh- ch- MkWV usV ds jsfM;ks cVu daVªksy ds izeq[k bos.V ds ckjs esa tkurs gSaA bos.V 190

AppearanceChanged CheckedChanged

fooj.k Appearance izkWiVhZ ds eku esa cnyko gksus ij ?kfVr gksrk gSA Checked izkWiVhZ ds eku ds cnyus ij ?kfVr gksrk gSA


7.14

isuy (Panel)

GUI izksxzkfeax fon~

isuy ,d ,slk daVªksy gS tks vU; daVªksy dks j[krk gS A vki isuy dk iz;ksx djds daVªksy ds ladyu dks ,d txg bdV~Bk dj ldrs gS A mnkgj.k ds fy, vki dbZ jsfM;kscVu daVªksy dks iSuy dh lgk;rk ls xzqi dj ldrs gSa A xzqickWDl daVªksy dh gh rjg ;fn isuy daVªksy ds Enabled izkWiVhZ dks False lsV dj fn;k tk; rks bl ij j[ks x, lHkh daVªksy fuf"ozQ; gks tkrs gSaA

fo.Mks”k iQkWeZl~ NOTES

isuy daVªksy ckb fMiQkWYV cxSj ckWMZj ds fMLIys gksrs gSa A ijUrq blds BorderStyle izkWiVhZ dk iz;ksx djds vki blesa ckWMZj tksM+ ldrs gSa ftlls isuy daVªksy rFkk iQkWeZ ds 'ks"k Hkkx ds chp varj Li"V gks tkrk gS A isuy daVªksy esa vki pkgsa rks AutoScroll izkWiVhZ dk mi;ksx djds LozQkWyckj Hkh tksM+ ldrs gSa A isuy daVªksy dSI'ku fMLIys ugha djrk gS ;fn vki dSI'ku pkgrs gSa rks xzqickWDl daVªksy dk iz;ksx djsaA isuy daVªksy baVjiQsl fMtk;u djus esa Hkh lqfo/ktud gksrk gSA bl ij j[ks gq, lHkh daVªksy dks vki ,d lkFk ewo dj ldrs gSaA fp=k 7-25 esa isuy daVªksy dks fn[kk;k x;k gSA

fp=k 7.25 : iQkWeZ ij izdV isuy daVªksy fparu % isuy rFkk xzqickWDl daVªksy esa dbZ lekurk,a gSa A ysfdu ,d varj Hkh gS A isuy daVªksy esa vki LozQkWyckj tksM+ ldrs gSa tcfd blesa dksb dSI'ku ugha ns ldrs gSa vkSj xzqickWDl esa vki dSI'ku ns ldrs gSa tcfd LozQkWyckj ugha tksM+ ldrs gSa A 7.14.1 isuy daVªksy ds izkWiVhZ (Properties of Panel)

bl [k.M esa oh- ch- MkWV usV ds isuy daVªksy ds izkWiVhZ ds ckjs esa tkurs gSaA buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt fo.Mks ds ekè;e ls lsV dj ldrs gSaA rFkk dqN tks izkWiVhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSaA gkykafd lHkh izkWiVhZ dks izksxzke ds ekè;e ls dksM fy[kdj lsV fd;k tk ldrk gSA izkWiVhZ AutoSize

AutoSizeMode BorderStyle TabStop

fooj.k isuy daVkª y s ds fy, bl izkiW VhZ dks MkWV usV izQs eodZ laLdj.k 2-0 esa igyh ckj tksMk+ x;k gSA bl izkiW VhZ ds ekè;e ls vki isuy daVkª y s ds Lor% vkdkj ds cnyus ds vkpj.k dks lsV dj ldrs gSAa ;fn bldk eku lR; lsV gS rks ;g vkdkj blds vanj j[ks x;s lkexzh ds vuqlkj Lo;a cnysxk rFkk bldk eku ;fn vlR; lsV gS rks blds vkdkj esa Lor% dksbZ cnyko ugha vk,xkA daVªksy ds Lopkfyr vkdkj cnyus ds vkpj.k dks lwfpr djrk gSA daVªksy ds ckWMZj LVkby dks lsV djrk gSA ml eku dks lsV djrk gS tks ;g Li"V djrk gS fd ;wtj TAB dh dk mi;ksx dj daVªksy dks iQksdl dj ldrk gS vFkok ughaA

191


izksxzkfeax fon fotqvy csfld MkWV usV

7.14.2 isuy daVªksy ds bos.V (Event of the Panel Control)

bl [k.M esa oh- ch- MkWV usV ds isuy daVªksy ds bos.V ds ckjs esa tkurs gSaA bos.V

NOTES

AutoSizeChanged

7.15

fooj.k blds AutoSize izkWiVhZ ds cnyus ij ;g ?kfVr gksrk gSA

xqzickWDl (GroupBox)

xqzickWDl daVªksy dk mi;ksx iQkWeZ ij daVªksy ds ladyu dks xzqi djus esa gksrk gS A mnkgj.k ds fy, vki Hkqxrku ls lacafèkr fodYiksa ds daVªksy dks ,d xzqickWDl esa j[k ldrs gSa A fodYiksa dks xzqickWDl esa xzqi djus dk ;g ykHk gksrk gS fd vki mugsa vklkuh ds lkFk b/j m/j ewo dj ldrs gSa A xqzickWDl daVªksy daVªksy ladyu ds pkjks vksj ,d izsQe fMLIys djrk gS tks dSI'ku ds lkFk ;k blds cxSj Hkh gks ldrk gSA xzqickWDl daVªksy dk lkekU; mi;ksx ;gh gS fd vki jsfM;kscVu daVªksyksa ds ,d ykWftdy lewg dks j[k ldrs gSaA xqzickWDl daVªksy esa LozQkWyckj fodYi dks ugha tksMk tk ldrk gSA fp=k 7-26 esa xzqickWDl daVªksy dks fn[kk;k x;k gSA

fp=k 7.26 : xzqickWDl daVªksy xqzickWDl daVªksy ds izkWiVhZ ] esFkM rFkk bos.V dks vkxs ds [k.Mksa esa crk;k x;k gSA 7.15.1 xzqickWDl daVªksy ds eq[; izkWiVhZ (Main Properties of the GroupBox Control)

bl [k.M esa oh- ch- MkWV usV ds xzqickWDl daVªksy ds izkWiVhZ ds ckjs esa tkurs gSaA buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSaA ;|fi lHkh izkWiVhZ dks izksxzke ds ekè;e ls dksM fy[kdj Hkh lsV fd;k tk ldrk gSA izkWiVhZ AllowDrop AutoSize AutoSizeMode DisplayRectangle 192

fooj.k ml eku dks lsV djrk gS tks ;g lwfpr djrk gS fd daVªksy MªSx rFkk MªkWi fØ;kvksa rFkk bos.V dh vuqefr nsxk vFkok ughaA ml eku dks lsV djrk gS tks ;g crkrk gS fd xzqickWDl vius lkexzh (contents) ds vkèkkj ij vkdkj esa cnyko dj ldrk gS vFkok ughaA xziq ckWDl ds AutoSize izkiW VhZ ds lfØ; gksus ij xziq ckWDl dSls vkpj.k djs ;g lsV djrk gSA ml vk;r dks izkIr djrk gS tks xzqickWDl ds foekvksa (dimensions) dks O;Dr djrk gSA


FlatStyle TabStop

xzqickWDl daVªksy ds ÝySV LVkby :i dks lsV djrk gS ;k blls lacaf/r lwpuk nsrk gSA ml eku dks lsV djrk gS tks ;g crkrk gS fd ;wtj TAB dh dk mi;ksx dj xzqickWDl dks iQksdl dj ldrk gS vFkok ughaA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

7.15.2 xzqickWDl ds bos.V (Events of GroupBox)

bl [k.M esa ge xzqickWDl ds eq[; bos.V ij ppkZ djsaxsA bos.V AutoSizeChanged Click DoubleClick KeyDown KeyUp TabStopChanged

7.16

fooj.k xzqickWDl ds AutoSize izkWiVhZ ds eku ds cnyus ij ?kfVr gksrk gSA ;wtj }kjk xzqickWDl daVªksy ij fDyd djus ij ;g ?kfVr gksrk gSA ;wtj }kjk xziq ckWDl daVkª y s ij nks ckj fDyd djus ij ;g ?kfVr gksrk gSA xzqickWDl daVªksy ij iQksdl jgus dh fLFkfr tc ;wtj dksbZ dh nckrk gS rc ;g ?kfVr gksrk gSA xzqickWDl daVªksy ds iQksDl jgus dh fLFkfr esa tc ;wtj nck, x;s dh dks fjyht djrk gS rc ;g ?kfVr gksrk gSA blds TabStop izkWiVhZ ds eku esa cnyko gksus ij ?kfVr gksrk gSA

fiDpj ckWDl (The PictureBox Control)

fiDpj ckWDl daVªksy dk mi;ksx iQkWeZ esa eupkgs fp=k dks tksM+us esa gksrk gSA ch- ch- 6 esa fiDpj ckWDl daVªksy ds cnys best daVªksy dk mi;ksx gksrk FkkA bldk mi;ksx vki oh- ch- MkWV usV dh lgk;rk ls cuk;s x;s js[kkfp=k (Drawings) dks iznf'kZr djus esa Hkh dj ldrs gSaA fiDpj ckWDl daVªksy dh lgk;rk ls ch- ,e- ih- (BMP), vkbdu iQkby] th- vkbZ- ,iQ- (GIF), ts- ih- bZ- th- (JPEG) bR;kfn iQkWesZV iQkbyksa ds fp=k dks iznf'kZr dj ldrs gSaA fp=k 7-27 esa fiDpjckWDl daVªksy esa j[ks x;s fp=k dks vyx&vyx lkbt eksM esa fn[kk;k x;k gSA

fp=k 7.27 : iQkWeZ ij tksM+s x;s fiDpjckWDl daVªksy esa vyx&vyx lkbt eksM esa fp=k 7.16.1 fiDpjckWDl daVªksy ds izkWiVhZ (Properties of the PictureBox Control)

bl [k.M esa oh- ch- MkWV usV ds fiDpjckWDl daVªksy ds izkWiVhZ ds ckjs esa tkurs gSaA buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt fo.Mks ds ekè;e ls lsV dj ldrs gSaA rFkk dqN izkWiVhZt

193


izksxzkfeax fon fotqvy csfld MkWV usV

fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSaA ;|fi lHkh izkWiVhZ dks izksxzke ds ekè;e ls dksM fy[kdj lsV fd;k tk ldrk gSA izkWiVhZ

NOTES

ErrorImage Image SizeMode

InitialImage TabIndex WaitOnLoad

fooj.k best dks yksM gksus dh izfØ;k ds nkSjku =kqfV vkus dh fLFkfr esa ;k best yksM ds jn~n gksus dh fLFkfr esa fMLIys gksus okys best dks lsV djrk gSA ml best dks lsV djrk gS ftls fiDpjckWDl daVªksy ij fMLIys gksuk gksrk gSA bl izkWiVhZ ds vanj pkj fodYi miyC/ gksrs gSaA ;s Normal, StretchImage, AutoSize, CenterImage rFkk Zoom gSaA AutoSize ds p;u djus ij fiDpjckWDl daVªksy dk vkdkj blesa tksM+s x;s fp=k ds vuqlkj gksxkA CenterImage dk p;u ;fn vki djrs gSa rks fp=k fiDpjckWDl daVªksy ls cM+h gksus dh fLFkfr esa og fp=k fiDpjckWDl daVªksy ds dsUnz esa fLFkr gks tkrk gS rFkk fiDpj dk ckgjh fdukjk dV tkrk gSA ;fn best daVªksy ls NksVh gS rc ;g daVªksy ds dsUnz esa fLFkr gksrk gSA ;fn fiDpjckWDl daVªksy ls fp=k cM+h gS rks ;g fodYi Bhd ugha D;ksafd blls fiDpj ds fdukjs dVus ds dkj.k iwjk fp=k izdV ugha gks ikrk gSA Normal dk mi;ksx rc djsa tc vki fiDpjckWDl daVªksy ds mijh ck;sa dksus ij vkÑfr dks fLFkr djuk pkgrs gSaA blesa Hkh ;fn fp=k fiDpjckWDl ls cM+h gS rks bldk dqN Hkkx dV tkrk gSA blesa CentreImage ds vis{kkÑr fp=k dk eq[; Hkkx Hkh dV ldrk gSA StretchImage dk p;u rc djsa tc fp=k dks fdlh Hkh ifjfLFkfr esa fiDpjckWDl daVªksy esa lekuk pkgrs gSaA blesa fiDpj dk vkdkj iSQy ;k fldqM+ ldrk gS tks fiDpjckWDl daVªksy ds vkdkj ij fuHkZj djrk gsA Zoom ds p;u djus ij fp=k dk vkdkj ,d fu;r vuqikr esa fiDpjckWDl daVªksy ds lkFk c<+rk ;k ?kVrk gSA eq[; best ds yksM gksus ds nkSjku fiDpjckWDl daVªksy esa fMLIys gksus okys best dks lsV djrk gSA VSc baMsDl eku dks lsV djrk gSA ml eku dks lsV djrk gS tks ;g crkrk gS fd best flaØksulyh (synchronously) yksM gksrk gS vFkok ughaA

7.16.2 fiDpjckWDl daVªksy ds esFkM (Methods of the PictureBox Control)

bl [k.M esa ge fiDpjckWDl daVªksy ds esFkMksa ij ppkZ djsaxsA esFkM CancelAsync Dispose Load LoadAsync

fooj.k vflaØksul (asynchronous) best yksM dks jn~n djrk gSA fiDpjckWDl ds }kjk mi;ksx fd;s x;s lHkh lalk/uksa dks fjyht djrk gSA fiDpjckWDl esa best dks fMLIys djrk gSA best dks vflaØksulyh yksM djrk gSA

7.16.3 fiDpj ckWDl daVªksy ds bos.V (Events of the PictureBox Control)

bl [k.M esa ge fiDpjckWDl daVªksy ds eq[; bos.V ds ckjs esa ppkZ djsaxsA bos.V LoadCompleted 194

fooj.k ;g bos.V MkWV usV izsQeodZ laLdj.k 2-0 esa u;k gSA LoadCompleted rc gh ?kfVr gksrk gS tc LoadAsync esFkM esa ls fdlh dk mi;ksx dj best dks vflaØksulyh yksM fd;k tkrk gS rFkk WaitOnLoad izkWiVhZ False gksrk gSA


LoadProgressChanged fdlh vflaØksul best yksfMax izfØ;k ds cnyus ij ;g ?kfVr gksrk gSA Resize SizeModeChanged TabIndexChanged TabStopChanged

fiDpjckWDl ds vkdkj ds cnyus ij ;g ?kfVr gksrk gSA SizeMode ds cnyus ij ?kfVr gksrk gSA TabIndex izkWiVhZ ds eku ds cnyus ij ?kfVr gksrk gSA TabStop izkWiVhZ ds eku ds cnyus ij ?kfVr gksrk gSA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

7.16.4 fMtk;u le; esa fp=k fMLIys djuk (Displaying a Picture at Design Time)

fo.Mkst iQkWeZ~l fiDpjckWDl daVªksy ds lkFk vki iQkWeZ ij fp=k dks yksM rFkk fMLIys dj ldrs gSaA blds fy, Image izkWiVhZ ls oS/ fp=k dks lsV djrs gSaA fcVeSi (.bmp), vkbdu (.ico), ts- vkbZ,iQ- (.gif), esVkiQkby (.wmf), ts-ih-bZ-th- (.jpg) Lohdkj;ksX; iQkby ds izdkj gSaA fMtk;u le; esa fp=k dks fMLIys djus ds fy, ;g djsa& ➪ iQkWeZ ij PictureBox daVªksy tksM+saA ➪ izkWiVhZt fo.Mks dks F4 dh nckdj fMLIys djsa ;fn ;g miyC/ u gksA ➪ Image izkWiVhZ dk p;u djsa rFkk blds bfyifll cVu dks fDyd djsaA rRi'pkr~ Select Resource Mk;ykWx ckWDl fp=k 7.28 dh rjg izdV gksxkA

fp=k 7.28 : Select Resource Mk;ykWx ckWDl ➪ Import dks fDyd dj Open Mk;ykWx ckWDl dks [kksysaA ;fn Import cVu gkbykbVsM u gks rks Project resource file: jsfM;ks cVu dks igys fDyd djsaA ➪ ;fn vki fdlh fo'ks"k iQkby Vkbi (;Fkk .gif iQkby) dks <w¡<+ jgs gks rks Files of type fyLV ckWDl ls bldk p;u djsaA (ns[ksa fp=k 7.29)

195

fp=k 7.29 : fo'ks"k izdkj ds fp=k dk p;u djrs gq,


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

➪ ml iQkby dk p;u djsa ftls vki fMLIys djuk pkgrs gSaA Open dks fDyd dj Open Mk;ykWx ckWDl dks can djsaA mijksDr inksa dks djus ds ckn Resources uke dk ,d iQksYMj vkids izkstsDV esa tqM+ tk,xk ftlesa ;g best LVksj gksxkA 7.16.5 fMtk;u le; esa fp=k dks gVkuk (Removing the Picture At Design Time) tc vki ,slk vuqHko djsa fd vc vkidks fiDpj ckWDl daVªksy esa fp=k dh vko';drk ugha gS rks bls fMtk;u le; esa fiDpjckWDl ls gVk ldrs gSaA fiDpjckWDl daVªksy ls fp=k dks gVkus ds fy, ;g djsa& ➪ F4 dh nckdj izkWiVhZt fo.Mks dks fMLIys djsa ;fn ;g LØhu ij miyC/ u gksA ➪ Image izkWiVhZ dk p;u djsa rFkk best vkWCtsDV ds uke ds ck;ha vksj izdV ml NksVs FkEcusy best dks nk;k¡ fDyd djsaA fiQj Reset dk p;u djsaA (ns[ksa fp=k 7.30) mijksDr inksa dks djus ds ckn vkids fiDpjckWDl daVªksy ls og fp=k gV tk,xkA fdUrq ;g vkids izkstsDV iQksYMj esa Resources iQksYMj ds vanj myiC/ jgrk gSA 7.16.6 ju le; esa fp=k dks fMLIys djuk (Displaying a Picture at Run Time)

vki pkgsa rks izzksxzke ds ek?;e ls Hkh vius iWQkeZ ij fiDpjckWDl daVªksy dh lgk;rk ls fiDpj dks tksM+ ldrs gSa A blds fy, ;g izk:i gS&

fp=k 7.30 : fiDpjckWDl ls fp=k dks gVkrs gq,

NameOfPictureBoxControl.Image = Image.FromFile(Name of Picture with exact location)

mnkgj.kkFkZ] PictureBox1.Image = Image.FromFile ("C:\image1.jpg")

mijksDr dksM ls igys blds SizeMode izkWiVhZ dks lsV djus ds fy, ;g dksM tksM+sa& PictureBox1.SizeMode = PictureBoxSizeMode. AutoSize

mijksDr dksM PictureBox1 ds SizeMode izkWiVhZ dks AutoSize lsV djrk gS A ySc vH;kl 7.6 (Lab Exercise 7.6) ,d fo.Mkst ,fIyds'ku ckuk,¡A rFkk iQkWeZ ij ,d fiDpj ckWDl daVªksy dks tksM+saA bl ij tksM+s x;s vkWCtsDV izkWiVhZ rFkk muds eku bl izdkj gksaxs rFkk bldk baVjisQl fp=k LA7.11 dh Hkk¡fr gksxkA vkWCtsDV iQkWeZ fiDpjckWDl

196

izkWiVhZ

eku

Name Text Name

Form1 Lab Exercise 7.6 PictureBox1

lek/ku % ➪ File esU;w dks fDyd djsa rFkk New Project dk p;u djsaA


➪ New Project Mk;ykWx ckWDl [kqyus ds i'pkr Templates isu esa Windows Application dks fDyd djsaA ➪ Name VsDLVckWDl esa Lab Exercise 7.6 Vkbi djsa rFkk OK dks fDyd djsaA mlds ckn ,d u;k fo.Mkst iQkWeZl izkstsDV [kqysxkA ➪ iQkWeZ ij VwyckWDl ls PictureBox daVªksy dks nks ckj fDyd dj tksMsa+A rFkk blds izkWiVhZ dks fMiQkWYV jgus nsaA ➪ iQkWeZ dks nks ckj fDyd djsaA rFkk Form1_Load bos.V gS.Myj esa bl ,d ykbu ds dksM dks tksM+sa& LoadNewPict()

➪ mlds ckn Form1_Load bos . V gS.Myj ds ckgj bl lc:Vhu dks Vkbi djsa&

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

fp=k LA7.11 : ySc vH;kl 7.6 dk baVjisQl

Private Sub LoadNewPict() PictureBox1.Image = Image.FromFile(“C:\image1.jpg”) End Sub

➪ F5 nck,¡A vki fp=k LA7.12 dh Hkk¡fr ifj.kke dks ns[ksaxsA

fp=k LA7.12 : ySc vH;kl 7.6 dk ifj.kke 7.16.7 ju le; esa xzkfiQd dks gVkuk (Removing a Graphic At Run Time)

tc pkgsa vki vkids }kjk tksM+s x, xzkfiQd@fp=k dks gVk ldrs gSaA xzkfiQd dks gVkus ds fy, ;g izk:i gS& NameOfPictureBox.Image = Nothing

mnkgj.k ds fy, & PictureBox1.Image = Nothing 197


izksxzkfeax fon fotqvy csfld MkWV usV

;fn vki fiDpjckWDl esa tksM+s x;s best ds }kjk mi;ksx fd, x, lalk/uksa (;Fkk eseksjh esa LFkku) dks Hkh fjyht djuk pkgrs gSa rks ;g fy[ksa& PictureBox1.Image.Dispose()

NOTES

mijksDr dksM best }kjk fy, tk jgs eseksjh dks fjDr dj nsxkA ySc vH;kl 7.7 (Lab Exercise 7.7) ,d fo.Mkst izksxzke cuk,¡A rFkk vius iQkWeZ ij ,d fiDpjckWDl daVªksy dks tksM+saA nks cVu dks iQkWeZ ij tksM+saA cVuksa ds uke Load An Image rFkk Clear The Image djsaA tc ;wtj Load An Image dks fDyd djs rks iQkWeZ ij best fMLIys gks rFkk tc ;wtj Clear The Image cVu dks fDyd djsa rks og best ogk¡ ls gV tk;A bl vkWCtsDV ds izkWiVhZ rFkk eku bl izdkj gksaxsA bldk baVjisQl fp=k LA7.13 dh Hkk¡fr gksuk pkfg,A vkWCtsDV iQkWeZ fiDpjckWDl cVu cVu

izkWiVhZ

eku

Name Text Name Name Text Name Text

Form1 Lab Exercise 7.7 PictureBox1 btnLoad Load An Image btnClear Clear The Image

fp=k LA7.13 : ySc vH;kl 7.7 dk baVjisQl lek/ku % ➪ File esU;w dks fDyd djsa rFkk New Project dk p;u djsa A ➪ New Project Mk;ykWx ckWDl [kqyus ds i'pkr Templates isu esa Windows Application dks fDyd djsaA ➪ Name VsDLVckWDl esa Lab Exercise 7.7 Vkbi djsa rFkk OK dks fDyd djsa A mlds ckn ,d u;k fo.Mkst iQkWeZl izkstsDV [kqysxkA ➪ Load an Image cVu dks nks ckj fDyd djsa rFkk btnLoad_Click gS.Myj esa bl dksM dks tksM+sa& PictureBox1.Image = Image.FromFile(“C:\image1.jpg”) 198

PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize


➪ fiQj Clear the Image dks nks ckj fDyd djsa vkSj btnClear_Click bos.V gS.Myj ds fy, bl dksM dks tksM+sa& PICTUREBOX1.IMAGE.DISPOSE() PICTUREBOX1.IMAGE = NOTHING

➪ F5 nck,¡ rFkk ifj.kke dks ns[ksaA fp=k LA7.14 dh Hkk¡fr izdV gksuk pkfg,A

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

fp=k LA7.14 : ySc vH;kl 7.7 dk ifj.kke

7.17 LØkWyckj (ScrollBars) LØkWyckj daVªksy dk iz;ksx vkbVeksa dh ,d yEch lwph ;k cMh ek=kk esa lwpuk dks fdlh ,fIyds'ku ;k daVªksy ;Fkk isuy ds vanj {kSfrt ;k mnxz :i esa vklkuh ls usfoxsV djus esa gksrk gS A LozQkWyckj fo.Mkst+ baVjiQsl dk ,d lkekU; vo;o gSA ,pLozQkWyckj (HScrollBar) rFkk ohLØkWyckj (VScrollBar) daVkª y s vU; daVkª y s ls eqDr gksdj dk;Z djrs gSa rFkk buds vius bos.V] izkiW VhZ rFkk esFkM gksrs gSAa LØkWyckj daVkª y s mu fcYV&bu LØkWyckj daVkª y s ls fcYdqy vyx gksrs gSa tks VsDLVckWDl] fyLVckWDl] dkWEcksckWDl ;k ,e Mh vkb iQkWeZ esa gksrs gSAa vf/drj daVªksy ;Fkk eYVhykbu VsDLVckWDl] fyLVckWDl rFkk dkWEcksckWDl ftugsa LØkWyckj dh vko';drk gksrh gS igys ls gh mugsa miyC/ djk, x, gksrs gSa rFkk mugsa bldh vyx ls vko';drk ugha iMrhA bldk iz;ksx mu duVsujksa esa LozQkWfyax ykxw djus ds fy, gksrk gS ftugsa viuk LozQkWyckj miyC/ ughs gksrk gSA mnkgj.k ds fy, fiDpjckWDl dk viuk LozQkWyckWDl ughs gksrk gS blfy, vki blesa bl LozQkWyckWDl dks tksM+ ldrs gSaA Scroll bos.V dk iz;ksx LØkWyckj esa LozQkWyckWDl ds xfrfof/;ksa dks ekWfuVj djus ds fy, gksrk gSA

blds izkWiVhZ] esFkM rFkk bos.V ij vkxs ds [k.Mksa esa ppkZ gksxhA fp=k 7-31 LØkWy ckj ds nks izdkj dks fn[kkrk gSA ;wtj tc ,sjks cVu ij fDyd djrk gS rc LØkWy ckWDl ,sjks dh vksj NksVh nwjh r; djrk gSA rFkk ;wtj tc LØkWy ckWDl vkSj ,sjks cVu ds eè; fDyd djrk gS rc LØkWy ckWDl ml ,sjks dh vksj yEch nwjh r; djrk gSA ;wtj LØkWy ckWDl dks MªSx dj Hkh ewo dj ldrk gSA Minimum, Maximum, Value, SmallChange rFkk LargeChange LØkWyckj daVªksy ds eq[; izkWiVhZ gSa ftUgsa bafVtj esa lsV fd;k tkrk gSA {kSfrt LØkWy ckj (horizontal scroll bar) ds uke ds lkFk hsb milxZ tksM+k tkrk gSA rFkk mnxz LØkWy ckj (vertical scroll bar) ds uke ds lkFk vsb milxZ tksM+k tkrk gSA Value izkWiVhZ dk eku LØkWyckWDl ds ck;sa vksj ds iksth'ku }kjk fuèkkZfjr Minimum rFkk Maximum ds chp dk la[;k gksrk gSA ;fn LØkWy ckWDl dk ck;k¡

199


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

fp=k 7.31 : iQkWeZ ij izdV LØkWy ckj Hkkx nksuks ,sjks ds chp esa gS rks Value dh la[;k Minimum rFkk Maximum ds chp dh la[;k gksxhA ;fn LØkWy ckWDl ck;sa ,sjks cVu ds utnhd gS rc bldk Value Minimum ds vuqikr esa gh gksxkA {kSfrt LØkWyckj ds ,sjks cVu ds fDyd gksus ij SmallChange ds }kjk Value ds eku esa cnyko gksrk gS rFkk LØkWy ckWDl rFkk tc blds nksuks ,sjks cVu ds chp ds ckj ij fDyd fd;k tkrk gS rc {kSfrt LØkWyckj dk Value LargeChange ds vuqlkj cnyrk gSA Minimum, Maximum, Value, SmallChange rFkk LargeChange ds fMiQkWYV eku Øe'k% 0] 100] 0] 1 rFkk 10 gksrs gSaA ;s eku lkekU;r% fMtk;u le; esa lsV gksrs gSaA nksuks gh LØkWyckj ,d gh rjg ls dk;Z djrs gSaA bldks le>us ds fy, ySc vH;kl 7-8 ns[ksaA 7.17.1 LØkWyckj ds daVªksy ds eq[; izkWiVhZ (Main Properties of ScrollBar Control)

bl [k.M esa oh- ch- MkWV usV ds LØkWyckj daVªksy ds izkWiVhZ ds ckjs esa tkurs gSaA buesa dqN izkWiVhZ ,sls gSa ftUgs vki fMtk;u le; esa izkiVhZt fo.Mks ds ekè;e ls lsV dj ldrs gSaA rFkk dqN tks izkWiVhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSaA ;|fi lHkh izkWiVhZ dks izksxzke ds ekè;e ls dksM fy[kdj lsV fd;k tk ldrk gSA izkWiVhZ AutoSize

ForeColor ImeMode LargeChange Maximum Minimum SmallChange 200

fooj.k LØkWyckj Lo;a vius fo"k;&oLrq ds vuqlkj vius vkdkj esa cnyko djrk gS vFkok ugha dk lwpd eku lsV djrk gS ;k mlds ckjs esa crkrk gSA LØkWyckj daVªksy ds iQksjxzkm.M jax dks lsV djrk gSA bl daVªksy ds }kjk liksVZ fd;s tkus okys buiqV esFkM ,fMVj (Input Method Editor) dks lsV djrk gSA LØkWyckWDl ds yEch (large) nwjh r; djus ij Value izkWiVhZ esa tksM+k tkus okyk ;k mlesa ls ?kVk;k tkus okyk eku lsV djrk gSA LØkWy fd;s tkus ;ksX; jsUt ds ekuksa dh mijh lhek (upper limit) dks lsV djrk gSA LØkWy fd;s tkus ;ksX; (scrollable) ds ekuksa dh uhpyh lhek (lower limit) dks lsV djrk gSA LØkWyckWDl ds }kjk NksVh (small) nwjh r; djus ij Value izkWiVhZ esa tksM+k tkus okyk ;k mlesa ls ?kVk;k tkus okyk eku lsV djrk gSA


mi;ksxdrkZ VSc (TAB) dh dk mi;ksx dj LØkWyckj daVªksy dks iQksdl dj ldrk gS vFkok ugha blds fy, eku dks lsV djrk gSA ml la[;kRed eku dks lsV djrk gS tks LØkWy ckj daVªksy ij LØkWy ckWDl ds orZeku iksth'ku dks O;Dr djrk gSA

TabStop Value

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

7.17.2 LØkWyckj daVªksy ds eq[; bos.V (Main Events of the ScrollBar Control)

bl [k.M esa ge LØkWyckj daVªksy ds eq[; bos.V ij ppkZ djrs gSaA bos.V AutoSizeChanged BackColorChanged Click DoubleClick ForeColorChanged ImeModeChanged Scroll ValueChanged

fooj.k AutoSize izkWiVhZ ds eku ds cnyus ij ;g ?kfVr gksrk gSA BackColor izkWiVhZ ds eku esa cnyko gksus ij ;g ?kfVr gksrk gSA LØkWyckj daVªksy ds fDyd gksus ij ;g ?kfVr gksrk gSA LØkWyckj daVªksy ij nks ckj fDyd gksrk gS rc ;g ?kfVr gksrk gSA ForeColor izkWiVhZ ds eku ds cnyus ij ;g ?kfVr gksrk gSA ImeMode izkWiVhZ ds eku ds cnyus ij ;g ?kfVr gksrk gSA ekml ;k dh&cksMZ ds }kjk LØkWy ckWDl ds ewo gksus ij ;g ?kfVr gksrk gSA izksxzke ds ekè;e ls ;k Scroll bos.V ds Value izkWiVhZ ds cnyus ij ;g ?kfVr gksrk gSA

ySc vH;kl 7.8 (Lab Exercise 7.8) ,d fo.Mkst ,fIyds'ku cuk,¡A blesa iQkWeZ ij {kSfrt LØkWy ckj (HScrollBar) daVªksy tksM+saA rFkk nks yscy tksM+saA bl ij tksM+s tkus okys vkWCtsDV rFkk muds izkWiVhZ vkSj eku bl izdkj gSaA rFkk bldk fMtk;u le; esa baVjisQl fp=k LA7.15 dh Hkk¡fr gksxkA vkWCtsDV iQkWeZ {kSfrt LØkWyckj yscy yscy

izkWiVhZ

eku

Name Text Name Name Text Font Name Text

Form1 Lab Exercise 7.8 HScrollBar1 Label1 Q Wingdings, 26 Label2

ckbZ fMiQkWYV

201

fp=k LA7.15 : ySc vH;kl 7.8 dk baVjisQl


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

lek/ku % ➪ File esU;w dks fDyd djsa rFkk New Project dk p;u djsaA ➪ New Project Mk;ykWx ckWDl [kqyus ds i'pkr~ Templates isu esa Windows Application dks fDyd djsaA ➪ Name VsDLVckWDl esa Lab Exercise 7.8 Vkbi djsa rFkk OK dks fDyd djsa A mlds ckn ,d u;k fo.Mkst iQkWeZl izkstsDV [kqysxkA ➪ iQkWeZ dks nks ckj fDyd djsaA rFkk Form1_Load bos.V gS.Myj ds fy, bl dksM dks fy[ksa tks {kSfrt LØkWyckj ds fofHkUu izkWiVhZ ds eku dks lsV djrk gS& HScrollBar1.Minimum = 0 HScrollBar1.Maximum = 300 HScrollBar1.SmallChange = 10 HScrollBar1.LargeChange = 50 HScrollBar1.Value = 0

➪ blds ckn {kSfrt LØkWy ckj dks nks ckj fDyd djsaA rFkk ;g dksM Vkbi djsa& Label1.Text = HScrollBar1.Value Label2.Left = HScrollBar1.Value

➪ F5 nckdj izksxzke dks ju djsaA tc vki nk;sa ,sjks cVu dks fDyd djrs gSa rc og 10&10 LVsi vkxs ewo djrk gS rFkk vkids }kjk nk;sa ,sjks cVu vkSj LØkWy ckWDl ds chp ds ckj ij fDyd djus ij 50&50 vkxs c<+sxkA rFkk tgk”k (tks Q ds Wingdings lsV djus ij izdV gksrk gSA) mlh vuqlkj c<+rk gSA Label1 ij og eku izdV gksxk tks Value dk eku gksrk gSA bldk ifj.kke fp=k LA7.16 dh Hkk¡fr izdV gksxkA

fp=k LA7.16 : ySc vH;kl 7.8 dk ifj.kke

7.18 Vkbej (Timer) Vkbej og dEiksus.V gS tks ,d fu;fer varjky ij bos.V dks tkx`r djrk gSA Vkbej daVªksy dk mi;ksx vki vkids dEI;wVj ds vkarfjd ?kM+h ds vk/kj ij jsLikWUl tsusjsV djus esa djrs gSaA vki Vkbej dk iz;ksx djds fdlh dksM dks ,d fuf'pr le; varjky ds ckn ,fDt+D;wV djok ldrs gSa rFkk Vkbej dk iz;ksx cSdxzkm.M izkslsflax ds fy, Hkh dj ldrs gSaA vkidk dEI;wVj dh ?kM+h ,d lsd.M esa Vkbej bos.V dks 18 ckj tkx`r djrk gSA ;g ?kM+h vkids lh ih ;w] eseksjh rFkk fMLd ds fy, egRoiw.kZ gksrk gS D;ksafd MkVk fcYdqy ozQe esa rFkk le;kuqlkj izokg djrk gSA fotqvy csfld MkWV usV ?kM+h ds le; ls bos.Vl dks fjLikW.M dj ldrk gS A ;|fi ;wtj+ Vkbej bos.V dks tsujs Vs ugha djrk gS ysfdu vkidk dEI;wVj bls djrk gS rFkk fo.Mkst+ mu bos.V dks izR;sd jfuax izkxs kz e dks ikl djrk gSA vki ,d fizlVs le; varjky lsV vi dj ldrs gSa ftlds ckn fo.Mkst+ vkids ,fIyds'ku dks ,d bos.V lan's k Hkstrk gSA tSls fd vki lHkh bos.V ds lkFk bos.V izkl W htj fy[k ldrs gSa tks ,d le; varjky ds ckn ,fDtD;wV gksrk gSA rFkk vkidks blds fy, ;wtj+ ds dEI;wVj dh xfr ij fdlh Hkh rjg fuHkZj ugha gksuk iM+rk gS D;ksfd le; blesa fu;fer (constant) gksrk gSA 202

Vkbej daVªksy Vkbej bos.V dks izkIr djrk gS rFkk vkids }kjk lsV fd, x, izkWiVhZ ds vuqlkj jsLikW.M djrk gS A tc vki Vkbej daVªksy dks iWQkeZ ij j[krs gSa rc vki le; varjky lsV vi djrs gSa tks Vkbej bos.V ds izQhDosulh dks fu/kZfjr djrk gSA ;g le; varjky Vkbej ds Interval izkWiVhZ }kjk


GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

fp=k 7.32 : iQkWeZ fMtk;uj ds uhps dEiksus.V~l Vªs esa Vkbej lsV fd;k tkrk gS A ml le; varjky ds ikl gks tkus ij Vkbej daVªksy ml bos.V izkWlhtj dks tkx`r djrk gS tks vkius Vkbej bos.V dks gS.My djus ds fy, lsV vi fd;k gqvk gS A Vkbej daVªksy dks iWQkeZ ij j[kus ds fy, Timer daVªksy vkbdu dks VwyckWDl ij nks ckj fDyd djsaA Vkbej daVªksy ds vkdkj esa ifjorZu ugha fd;k tk ldrk gS vkSj u gh ;g juVkbe esa iWQkeZ ij ekStwn gksrk gSA (ns[ks fp=k 7-32) 7.18.1 Vkbej daVªksy ds izkWiVhZt (Properties of Timer Control)

bl [k.M esa oh-ch- MkWV usV ds Vkbej daVªksy ds izkWiVhZ ds ckjs esa tkurs gSaA buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt fo.Mks ds ekè;e ls lsV dj ldrs gSaA rFkk dqN tks izkWiVhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSaA ;|fi lHkh izkWiVhZ dks izksxzke ds ekè;e ls dksM fy[k dj lsV fd;k tk ldrk gSA izkWiVhZ Enabled Interval

fooj.k Vkbej dks izkjEHk djus gsrq eku dks lsV djrk gSA bldks lfØ; djus ds fy, True lsV djsa vU;Fkk False lsV djsaA Vkbej Bhd ds eè; feyhlsd.M esa le; dks lsV djrk gSA 1 lsd.M esa 1000 feyhlsd.M gksrk gSA

7.18.2 Vkbej daVªksy ds esFkM (Methods of Timer Control)

bl [k.M esa ge Vkbej ds eq[; esFkM ij ppkZ djsaxsA esFkM Start

fooj.k Vkbej dks 'kq: djrk gSA

Stop

Vkbej dks can djrk gSA

7.18.3 Vkbej daVªksy ds bos.V (Events of Timer Control)

bl [k.M esa ge Vkbej ds eq[; bos.V ij ppkZ djsaxsA Tick

Vkbej lfØ; (enabled) gksus dh fLFkfr esa Li"V fd;s x;s Vkbej varjky (interval) ds lekIr gksus ij ?kfVr gksrk gSA ;g Vkbej daVªksy dk fMiQkWYV bos.V gSA

203


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

ySc vH;kl 7.9 (Lab Exercise 7.9) ,d fo.Mkst izksxzke cuk,¡ tks le; dks vkids iQkWeZ ij dh ?kM+h dks ,d lsd.M ds nj ls c<+krk gSA blesa ,d yscy] ,d cVu rFkk ,d Vkbej dEiksus.V tksM+saA bldk baVjisQl fp=k LA7.17 dh Hkk¡fr gksxkA blesa tksM+s x, vkWCtsDV] izkWiVhZ rFkk eku bl izdkj gSa& vkWCtsDV iQkWeZ

izkWiVhZ

eku

Name Text

Form1 Timer Demo

cVu

Name Text Name

Button1 ........... Label

Text

ckbZ fMiQkWYV

Name

Timer1

yscy Vkbej

fp=k LA7.17 : ySc vH;kl 7.9 dk baVjisQl lek/ku % ➪ File esU;w dks fDyd djsa rFkk New Project dk p;u djsaA ➪ New Project Mk;ykWx ckWDl [kqyus ds i'pkr Templates isu esa Windows Application dks fDyd djsaA ➪ Name VsDLVckWDl esa Lab Exercise 7.9 Vkbi djsa rFkk OK dks fDyd djsa A mlds ckn ,d u;k fo.Mkst iQkWeZl izkstsDV [kqysxkA ➪ iQkWeZ ij dgha Hkh nk;k¡ fDyd djsa vkSj View Code dk p;u djsa rFkk fuEufyf[kr dksM Vkbi djsa& Private Sub InitializeTimer() Timer1.Interval = 1000 ' 1 second Timer1.Enabled = True End Sub Private Sub Timer1_Tick(ByVal Sender As Object, ByVal e_ As EventArgs) Handles Timer1.Tick Label1.Text = TimeOfDay' End Sub 204


Private Sub Button1_Click(ByVal Sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click If Button1.Text = "Stop" Then Button1.Text = "Start" Timer1.Enabled = False Else Button1.Text = "Stop" Timer1.Enabled = True End If End Sub ➪ F5 nck,¡ rFkk ifj.kke ns[ksaA ;g fp=k LA7.18 dh Hkk¡fr fn[kuk pkfg,A

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

fp=k LA7.18 : ySc vH;kl 7.9 dk ifj.kke

7.19

fyLVO;w (ListView)

fyLVO;w daVªksy dk mi;ksx dj vki vkbdu ds lkFk vkbVeksa dh lwph dks fMLIys dj ldrs gSaA vki fyLVO;w dk iz;ksx fo.Mkst+ ,DlIyksjj ds nk;sa isu dh rjg ;wt+j baVjiQsl cukus esa dj ldrs gSaA bl daVªksy ds pkj O;w LargeIcon, SmalIIcon, List rFkk Details miyC/ gSaA LargeIcon eksM vkbVe VsDLV ds lkeus cM+s vkbdu dks fMLIys djrs gSaA daVªksy ds cgqr cM+s gksus ij vkbVe nks dkWye esa izdV gksrs gSa A SmallIcon eksM esa lc dqN LargeIcon eksM dh rjg gh gksrk gS dsoy blds vkbdu NksVs gksrs gSaA List eksM NksVs vkbdu gh iznf'kZr djrs gSa ijUrq ;g ges'kk ,d gh dkWye esa izdV gksrs gSaA Details eksM ,d ls vf/d dkWye esa vkbVe dks izdV djrs gSaA blds vfrfjDr fo.Mkst+ ,Dl ih rFkk fo.Mkst+ lZoj 2003 ij ,d vkSj O;w Tile eksM esa miyC/

gksrk gSA fyLVO;w daVªksy dk eq[; izkWiVhZ Items gS tks daVªksy ds }kjk fn[kk, x, vkbVeksa dks j[krk gSA SelectedItems izkWiVhZ daVªksy esa orZeku p;fur vkbVeksa ds ladyu dks j[krk gS A ;wt+j ,d ls vf/ d vkbVeksa dks p;u dj ldrk gSA mnkgj.k ds fy, ;fn bldk MultiSelect izkWiVhZ True lsV gS rks ,d le; esa dbZ vkbVeksa dks nwljs daVªksy esa MªSx o MªkWi dj ldrk gSA fyLVO;w daVªksy vkbVeksa ds lkeus psdckWDl dks fMLiys dj ldrk gS ;fn CheckBoxes izkWiVhZ True lsV gSA Activation izkWiVhZ] fyLV esa fdlh vkbVe dks ,fDVosV djus ds fy, ;wt+j fdl izdkj dk ,D'ku ys ;g fu/kZfjr djrk gSA Standard, OneClick, rFkk TwoClick blds fodYi gSaA OneClick ,fDVos'ku ,d gh fDyd esa vkbVe dks ,fDVosV djrk gS A TwoClick ,fDVos'ku fodYi p;u jgus

ij ;wt+j dks fdlh vkbVe dks ,fDVosV djus ds fy, nks fDyd djuk iM+rk gS rFkk ,d fDyd djus ij vkbVe dk jax cny tkrk gSA Standard ,fDVos'ku fodYi p;u jgus ij ;wt+j dks nks gh fDyd djuk iM+rk gS ijUrq vkbVe dk :i ugha cnyrk gSA fyLVO;w daVªksy fo.Mkst+ IysViWQkeZ ij miyC/ lHkh iQhpjksa dks liksVZ djrk gSA

205


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

fp=k 7.33 : fyLVO;w dk ,d mnkgj.k 7.19.1

fyLVO;w daVªksy ds izkWiVhZ

(Properties of The ListView Control)

bl [k.M esa oh-ch- MkWV usV ds fyLVO;w daVªksy ds izkWiVhZ ds ckjs esa tkurs gSaA buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt fo.Mks ds ekè;e ls lsV dj ldrs gSaA rFkk dqN tks izkWiVhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSaA ;|fi lHkh izkWiVhZ dks izksxzke ds ekè;e ls dksM fy[k dj lsV fd;k tk ldrk gSA izkWiVhZ

206

fooj.k Activation ;wtj dks fdlh vkbVe dks ,fDVosV djus gsrq fy, tkus okys ,D'ku ds izdkj dks lsV djrk gSA Alignment daVªksy esa vkbVeksa ds vykbues.V dks lsV djrk gSA AllowColumnReorder ;wtj dkWye gsMj dks MªSx dj daVªksy esa dkWye ds Øe dks cny ldrk gS vFkok ugha blds eku dks lsV djrk gSA AutoArrange vkbVe Lo;a O;ofLFkr gksrs gSa vFkok ugha bls ;g izkWiVhZ lsV djrk gSA BorderStyle daVªksy ds ckWMj LVkby dks lsV djrk gSA CheckBoxes daVªksy esa izR;sd vkbVe ds lkFk psdckWDl izdV gks vFkok ugha bldks lsV djrk gSA CheckedIndices daVªksy esa orZeku p;fur vkbVeksa ds baMsDl dks izkIr djrk gSA CheckedItems daVªksy esa orZeku ds p;fur vkbVeksa dks izkIr djrk gSA Columns daVªksy esa izdV gksus okys lHkh dkWye gsMjksa ds ladyu dks izkIr djrk gSA FocusedItem daVªksy esa ml vkbVe dks izkIr djrk gS ftlij vHkh iQksdl gSA FullRowSelect fdlh vkbVe ds p;u fd;s tkus ij blds vanj ds lHkh vkbVe Hkh p;u gksaxs vFkok ugha bldks lsV djrk gSA GridLines iafDr;ksa rFkk dkWyeksa ds eè; xzhMykbu izdV gks vFkok ugha blds eku dks lsV djrk gSA


Groups HeaderStyle HideSelection HotTracking HoverSelection InsertionMark Items LabelEdit LabelWrap

LargeImageList ListViewItemSorter

MultiSelect OwnerDraw Padding RightToLeftLayout Scrollable

SelectedIndices SelectedItems ShowGroups ShowItemToolTips SmallImageList Sorting StateImageList

daVªksy dks vlkbu fd;s x;s ListViewGroup vkWCtsDV ds ladyu dks izkIr djrk gSA dkWye gsMj ds LVkby dks lsV djrk gSA daVªksy ls iQksDl gVus ds ckn daVªksy dk p;fur vkbVe gkbykbVsM jgrk gS vFkok ugha bls lsV djrk gSA ekml Iokb.Vj dks fdlh vkbVe ;k mi vkbVe ij ys tkus ij ;g gk;ijfyad esa ifjofrZr gks vFkok ugha bldks lsV djrk gSA ekml IokbUVj dks dqN lsd.M rd ds fy, fdlh vkbVe ij j[kus ds ckn og vkbVe Lor% gh p;fur gks vFkok ugha bldks lsV djrk gSA daVªksy ds vanj fyLVO;w fdlh vkbVe dks MªSx fd;s tkus ij vkisf{kr MªkWi yksds'ku dks bafxr djus okyk vkWCtsDV izkIr djrk gSA daVªksy ds lHkh vkbVeksa dks j[kus okyk ladyu izkIr djrk gSA daVªksy ;wtj vkbVeksa ds yscy dks laikfnr dj ldrk gS vFkok ugha bldks bafxr djus okyk eku lsV djrk gSA vkbVe ds vkbdu ds :i esa daVªksy esa fMLIys fd;s tkus ij vkbVe dk yscy jSi (wrap) gks vFkok ugha bldks bafxr djus okyk eku lsV djrk gSA daVªksy esa vkbVe ds cM+s vkbdu ds :i esa fMLIys gksus ij ImageList ds mi;ksx dks lsV djrk gSA ListViewItemSorter izkWiVhZ dk mi;ksx vki ml vkWCtsDV dks Li"V djus esa djrs gSa tks fyLVO;w daVªksy esa vkbVeksa ds lkWfVZax dks lEiUu djrk gSA ,slk rc gksrk gS Sort esFkM dk mi;ksx gksrk gS ;k tc vkbVeksa dks lwph esa tksM+k tkrk gSA ,d ls vf/d vkbVeksa dk p;u fd;k tk ldrk gS vFkok ugha bldks bafxr djus okyk eku lsV djrk gSA fyLVO;w daVªksy vkWijsfVax flLVe }kjk MªkW gks ;k vkids dksM }kjk MªkW gks vFkok ugha bldk lwpd eku lsV djrk gSA fyLVO;w daVªksy rFkk blds fo"k;&oLrq ds eè; ds LFkku dks lsV djrk gSA daVªksy nk;ha ls ck;ha vksj izLrqr gksaxs vFkok ugha bldk lwpd eku lsV djrk gSA lHkh vkbVeksa ds fMLIys gksus ij LFkku ds deh dh fLFkfr esa daVªksy esa LØkWy ckj tqM+s vFkok ugha blds fy, ;g izkWiVhZ eku lsV djrk gSA daVªksy esa p;fur vkbVeksa ds baMsDl dks izkIr djrk gSA daVªksy esa p;fur vkbVeksa dks izkIr djrk gSA vkbVe lewg esa fMLIys gks vFkok ugha bldk lwpd eku lsV djrk gSA fyLVO;w ds ListViewItem vkWCtsDV ds fy, Vwy fVi izdV gks vFkok ugha bldk lwpd eku lsV djrk gSA ml ImageList dks lsV djrk gS dks daVªksy esa vkbVeksa ds NksVs vkbdu ds :i esa fMLIys gksus ij mi;ksx gksxkA daVªksy esa vkbVeksa ds fy, lkWVZ vkWMZj dks lsV djrk gSA daVªksy esa ,fIyds'ku ifjHkkf"kr voLFkkvksa ds lkFk tqM+s ImageList dks lsV djrk gSA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

207


izksxzkfeax fon fotqvy csfld MkWV usV

TileSize TopItem View

NOTES

VirtualListSize VirtualMode

Vkby O;w esa fn[kk;s x;s Vkby ds vkdkj dks lsV djrk gSA daVªksy esa igys n`'; (visible) vkbVe dks lsV djrk gSA daVªksy esa vkbVe dSls fMLIys gks ;g lsV djrk gSA opqv Z y eksM esa jgus ij vkbVe dS'k (cache) esa miyC/ ListViewItem vkWCtsDV dh la[;k dks lsV djrk gSA fyLVO;w daVªksy ds fy, MkVk eSustes.V fØ;k vkius viuk miyC/ djk;k gS vFkok ugha bldk lwpd eku lsV djrk gSA

7.19.2 fyLVO;w daVªksy ds esFkM (Methods of the ListView Control)

bl [k.M esa ge fyLVO;w daVªksy ds esFkM dh ppkZ djrs gSaA esFkM ArrangeIcons AutoResizeColum AutoResizeColumns Clear EnsureVisible

FindItemWithText FindNearestItem GetItemAt Sort

fooj.k daVªksy esa vkbVeksa dks O;ofLFkr djrk gS tc os vkbdu ds :i esa fMLIys gksrs gSaA fn;s x;s dkWye dh pkSM+kbZ ds vkdkj dks cnyrk gS tSlk fd fjlkbt (resize) LVkby }kjk n'kkZ;k tkrk gSA lHkh dkWyeks dh pkSM+kbZ ds vkdkj dks cnyrk gS tSlkfd fjlkbt (resize) LVkby }kjk n'kkZ;k tkrk gSA daVªksy ls lHkh vkbVeksa rFkk dkWyeksa dks gVkrk gSA daVªksy ds vanj Li"V fd;s x;s vkbVe dh foftfcfyfV dks lqfuf'pr djrk gS rFkk vko';drkuqlkj daVªksy ds fo"k;oLrq dks LØkWy Hkh djrk gSA fn;s x;s VsDLV oSY;w ds lkFk 'kq# gksus okys igys ListViewItem dks <w¡<+rk gSA fn;s x;s yksds'ku ls ,d fo'ks"k fn'kk esa <w¡<+rs gq, vxys vkbVe dks izkIr djrk gSA ,d fo'ks"k yksds'ku ij vkbVe dks izkIr djrk gSA fyLV O;w ds vkbVeksa dks lkWVZ djrk gSA

7.19.3 fyLVO;w daVªksy ds bos.V (Events of the ListView Control)

bl [k.M esa fyLVO;w daVªksy ds izeq[k bos.V dh ppkZ djsaxsA bos.V AfterLabelEdit BackgroundImageLayoutChanged BeforeLabelEdit CacheVirtualItems

ColumnClick 208

fooj.k ;wtj }kjk fdlh vkbVe ds yscy dks laikfnr djus ds i'pkr~ ?kfVr gksrk gSA BackgroundImageLayout izkWiVhZ ds cnyus ij ?kfVr gksrk gSA ;wtj ds }kjk fdlh vkbVe ds yscy dk laiknu 'kq: djus ij ?kfVr gksrk gSA opqZvy eksM esa tc fyLVO;w ds fMLIys ,fj;k dk fo"k;&oLrq cnyrk gS rFkk fyLVO;w ;g fu/kZfjr djrk gS fd vkbVeksa dk ,d u;k jsat vko';d gS rc ;g bos.V ?kfVr gksrk gSA fyLV O;w daVªksy ds dkWye gsMj dks tc ;wtj fDyd djrk gS rc ;g ?kfVr gksrk gSA


ColumnReordered ColumnWidthChanged ColumnWidthChanging DrawColumnHeader

DrawItem ItemActivate ItemCheck ItemDrag ItemMouseHover ItemSelectionChanged PaddingChanged Paint RetrieveVirtualItem RightToLeftLayoutChanged SearchForVirtualItem SelectedIndexChanged TextChanged VirtualItemsSelectionRangeChanged

dkWye gsMj ds Øe ds cnyus ij ?kfVr gksrk gSA dkWye ds pkSM+kbZ esa liQy cnyko gksus ij ;g ?kfVr gksrk gSA dkWye dh pkSM+kbZ ds cnyus ds Øe esa ;g ?kfVr gksrk gSA fyLVO;w ds fMVsy~l (details) O;w ds MªkW gksus ij rFkk OwnerDraw izkWiVhZ ds lR; lsV gksus ij ;g ?kfVr gksrk gSA fyLVO;w ds MªkW gksus ij rFkk OwnerDraw izkWiVhZ ds lR; lsV gksus ij ;g ?kfVr gksrk gSA fdlh vkbVe ds ,fDVosV gksus ij ;g ?kfVr gksrk gSA fdlh vkbVe ds psd voLFkk ds cnyus ij ?kfVr gksrk gSA ;wtj }kjk fdlh vkbVe dks MªSx djuk 'kq: djus ij ;g ?kfVr gksrk gSA ekml Iokb.Vj dks fdlh vkbVe ij ys tkus ij ;g ?kfVr gksrk gSA fdlh vkbVe ds p;u voLFkk ds cnyus ij ?kfVr gksrk gSA Padding izkWiVhZ ds eku ds cnyus ij ;g ?kfVr gksrk gSA fyLVO;w daVªksy ds is.V gksus ij ;g ?kfVr gksrk gSA fyLVO;w ds opqZvy eksM esa jgus rFkk ListViewItem dh vko';drk gksus ij ;g ?kfVr gksrk gSA RightToLeftLayout izkWiVhZ ds eku ds cnyus ij ;g ?kfVr gksrk gSA fyLVO;w ds opqZvy eksM esa jgus ij rFkk lpZ ds 'kq: gksus ij ;g ?kfVr gksrk gSA fyLVO;w daVªksy esa p;fur vkbVe ds baMsDl ds cnyus ij ;g ?kfVr gksrk gSA Text izkWiVhZ ds cnyus ij ;g ?kfVr gksrk gSA fyLVO;w ds opqv Z y eksM esa jgus ij rFkk vkbVeksa ds jsUt ds p;u voLFkk ds cnyus ds ckn ?kfVr gksrk gSA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

7.20 fVªO;w (TreeView) fVªO;w daVªksy dh lgk;rk ls vki ;wt+j ds fy, uksM dh gk;jSjfd dks fMLIys dj ldrs gSaA fVªO;w daVªksy uksM dh gk;jSjfd dks Bhd mlh izdkj fMLIys djrk gS ftl izdkj iQkby vkSj iQksYMj fo.Mkst+ vkWijsfVax flLVe ds fo.Mkst+ ,DLiyksjj ds ck;ha isu esa fMLIys gksrk gSA fVªO;w ds izR;sd uksM esa vU; uksM ftugsa pkbYM uksM (child node) dgrs gSa gksrk gSA vki isjs.V uksM (parent node) rFkk oSls uksM dks ftuds vanj vkSj uksM jgrs gSa dks foLrkfjr (expanded) ;k ladqfpr (collapsed) :i esa fMLIys dj ldrk gSA vki fVªO;w ds CheckBoxes izkWiVhZ dks True lsV djds psdckWDl ds lkFk Hkh fVªO;w dks fMLIys dj ldrs gSaA vki Checked izkWiVhZ dks izksxzke ds ekè;e ls lsV djds blds uksM dks p;u ;k fjDr dj ldrs gSaA 209


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

fp=k 7.34 : VªhO;w dk ,d mnkgj.k Nodes vkSj SelectedNode fVªO;w daVªksy ds eq[; izkWiVhZ gSaA Nodes izkWiVhZ Vªh O;w esa 'kh"kZ Lrjh; lwph dks j[krk gSA SelectedNode izkWiVhZ orZeku esa p;fur uksM dks lsV djrk gS A vki uksM ds lkeus vkbdu dks fMLIys dj ldrs gSaA daVªksy O;w ds ImageList dk iz;ksx dj vki blesa vkbdu dks tksM+rs gSa A ImageIndex izkWiVhZ Vªh O;w esa uksM ds fy, fMiQkWYV best dks lsV djrk gS A fotqvy LVwfM;ks 2005 esa best dh ,d cM+h yk;czsjh dks tksM+k x;k gS ftls vki \...\Program Files\Microsoft Visual Studio 8\Common7\VS2005ImageLibrary\VS2005Image Library.zip ls ,Dlsl dj ldrs gSaA 7.20.1

fVªO;w daVªksy ds izkWiVhZ (Properties of TreeView Control)

bl [k.M esa oh-ch- MkWV usV ds fVªO;w daVªksy ds izkWiVhZ ds ckjs esa tkurs gSaA buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt fo.Mks ds ekè;e ls lsV dj ldrs gSaA rFkk dqN tks izkWiVhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSaA ;|fi lHkh izkWiVhZ dks izksxzke ds ekè;e ls dksM fy[k dj lsV fd;k tk ldrk gSA izkWiVhZ BackgroundImage BackgroundImageLayout BorderStyle CheckBoxes 210

DrawMode

fooj.k fVªO;w daVªksy ds fy, cSdxzkm.M best dks lsV djrk gSA fVªO;w daVªksy ds fy, cSdxzkm.M best ds ysvkmV dks lsV djrk gSA fVªO;w daVªksy ds ckWMj LVkby dks lsV djrk gSA fVªO;w daVªksy esa Vªh uksM ds vkxs psd ckWDl fMLIys gks vFkok ugha bldks lsV djrk gSA ml eksM dks lsV djrk gS ftlesa MªkW gksrk gSA


ForeColor FullRowSelect HideSelection HotTracking ImageIndex ImageKey ImageList Indent ItemHeight LabelEdit LinkColor Nodes Padding PathSeparator RightToLeftLayout Scrollable SelectedImageIndex SelectedImageKey SelectedNode ShowLines ShowNodeToolTips ShowPlusMinus

ShowRootLines

;g bl daVªksy ds fy, orZeku iQksjxzkm.M jax gksrk gS tks daVªksy ds }kjk VsDLV ds fy, mi;ksx gksrk gSA p;u gkbykbV (selection highlight) VªhO;w daVªksy ds iwjs pkSM+kbZ rd (span) iSQyrk gS vFkok ugha bl eku dks lsV djrk gSA VªhO;w daVªksy esa iQksdl gVus ij Hkh p;fur Vªh uksM gkbykbVsM jgrk gS vFkok ugha bl eku dks lsV djrk gSA ekml ds Vªh uksM yscy ds mij ls xqtjus ij ;g gk;ijfyad dk :i ysrk gS vFkok ugha bl eku dks lsV djrk gSA ml fMiQkWYV best ds best fyLV baMsDl oSY;w dks lsV djrk gS tks Vªh uksM }kjk fMLIys gksrk gSA VªhO;w daVªksy esa izR;sd uksM ds fy, fMiQkWYV best ds dh dks lsV djrk gS tc ;g vp;fur voLFkk esa gksrk gSA ml bestfyLV dks lsV djrk gS tks Vªh uksM ds }kjk mi;ksx gksus okys best vkWCtsDV dks j[krk gSA izR;sd pkbYM Vªh uksM Lrj ds baMs.V (indent) dh nwjh dks lsV djrk gSA Vªh O;w daVªksy esa izR;sd Vªh uksM dh m¡pkbZ dks lsV djrk gSA Vªh uksM ds yscy VsDLV dks laikfnr fd;k tk ldrk gS vFkok ugha bldk lwpd eku lsV djrk gSA VªhO;w daVªksy ds uksM dks tksM+us okys ykbuksa ds jax dks lsV djrk gSA Vªh O;w daVkª y s dks vlkbu fd;s x;s Vªh uksM ds ladyu dks lsV djrk gSA VªhO;w daVªksy ds fo"k;oLrq rFkk buds fdukjksa ds chp ds LFkku dks lsV djrk gSA ml fMyhehVj fLaVxª (delimiter string) dks lsV djrk gS tks Vªh uksM ikFk mi;ksx djrk gSA Vªh O;w dks nk;ha ls ck;ha vksj cuk gksuk pkfg, vFkok ugha bldk lwpd eku lsV djrk gSA VªhO;w daVkª y s vko';drkuqlkj LØkWyckj dks fMLIys djsxk vFkok ugha bldks lsV djrk gSA ml best ds best fyLV baMsDl dks lsV djrk gS tks Vªh uksM ds p;u gksus ij fMLIys gksrk gSA Vªh uksM ds p;u jgus dh voLFkk esa fn[kk;s x;s fMiQkWYV best ds dh dks lsV djrk gSA VªhO;w daVªksy esa orZeku esa p;fur Vªh uksM dks lsV djrk gSA VªhO;w daVkª y s esa ykbu Vªh uksM ds eè; MªkW gks vFkok ugha bldk lwpd eku lsV djrk gSA Vªh uksM ds ekml dks ys tkus ij Vwy fVIl izdV gks blds fy, eku dks lsV djrk gSA oSls Vªh uksM ftuds vanj pkbYM Vªh uksM gksrs gSa vius vkxs (+) fpUg rFkk (–) fpUg dks fMLIys djs vFkok ugha blds fy, eku dks lsV djrk gSA Vªh uksM tks Vªh O;w ds ewy ij gksrk gS ds eè; ykbu cusaxs vFkok ugha bldk lwpd eku lsV djrk gSA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

211


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

Sorted StateImageList TopNode VisibleCount

Vªh O;w ds Vªh uksM lkWVZ gksxa s vFkok ugha bldk lwpd eku lsV djrk gSA Vªh O;w rFkk blds uksM ds voLFkk dks n'kkZrs gq, mi;ksx fd;s x;s best lwph dks lsV djrk gSA Vªh O;w daVªksy esa iwjh rjg ls n`'; igys Vªh uksM dks izkIr djrk gSA Vªh O;w daVªksy esa Vªh uksM ds ml la[;k dks izkIr djrk gS tks iw.kZr% foftcy gks ldrk gSA

7.20.2 fVªO;w daVªksy ds esFkM (Methods of the TreeView Control)

bl [k.M esa ge fVªO;w daVªksy ds esFkM ds ckjs esa ppkZ djsaxsA esFkM CollapseAll ExpandAll GetNodeAt GetNodeCount Sort

fooj.k lHkh Vªh uksM dks ladqfpr (collapse) djrk gSA lHkh Vªh uksM dks foLrkfjr (expand) djrk gSA ml Vªh uksM dks izkIr djrk gS tks ,d fo'ks"k yksds'ku ij gksrk gSA Vªh uksM rFkk muds lc Vªh”k (sub trees) dh la[;k dks izkIr djrk gS tks Vªh O;w daVªksy esa vlkbu fd;s x;s gksrs gSaA vkbVeksa dks lkWVZ djrk gSA

7.20.3 fVªO;w daVªksy ds bos.V (Events of the TreeView Control)

bl [k.M esa ge fVªO;w daVªksy ds izeq[k bos.V ds ckjs esa ppkZ dj jgs gSaA bos.V AfterCheck AfterCollapse AfterExpand AfterLabelEdit AfterSelect BackgroundImageChanged BackgroundImageLayoutChanged BeforeCheck BeforeCollapse BeforeExpand BeforeLabelEdit BeforeSelect DrawMode 212

ItemDrag

fooj.k Vªh uksM psd ckWDl ds psd gksus ds ckn ;g ?kfVr gksrk gSA Vªh uksM ds ladfq pr (collapse) gksus ds ckn ?kfVr gksrk gSA Vªh uksM ds iQSyus (expand) ds ckn ;g ?kfVr gksrk gSA Vªh uksM ds yscy VsDLV ds laikfnr fd;s tkus ds i'pkr~ ;g ?kfVr gksrk gSA Vªh uksM ds p;u gksus ds ckn ;g ?kfVr gksrk gSA BackgroundImage izkWiVhZ ds cnyus ij ;g ?kfVr gksrk gSA BackgroundImageLayout izkWiVhZ ds cnyus ij ;g ?kfVr gksrk gSA Vªh uksM psd ckWDl ds psd gksus ls igys ;g ;g ?kfVr gksrk gSA Vªh uksM ds ladqfpr gksus ls igys ;g ?kfVr gksrk gSA Vªh uksM ds iSQyus ls igys ;g ?kfVr gksrk gSA Vªh uksM yscy VsDLV ds laikfnr gksus ls igys ;g ?kfVr gksrk gSA Vªh uksM ds p;u gksus ls igys ;g ?kfVr gksrk gSA tc VªhO;w MªkW gksrk gS rFkk DrawMode ds Normal dks NksM+ dj fdlh Hkh eku ds lsV gksus ij ?kfVr gksrk gSA ;wtj }kjk uksM dks MªSx djuk izkjEHk djus ij ;g ?kfVr gksrk gSA


NodeMouseClick NodeMouseDoubleClick NodeMouseHover PaddingChanged Paint RightToLeftLayoutChanged TextChanged

7.21 Vwyckj

;wtj }kjk fdlh uksM ij fDyd djus ij ;g ?kfVr gksrk gSA ;wtj }kjk Vªh uksM ij nks ckj fDyd djus ij ;g ?kfVr gksrk gSA Vªh uksM ij ekml ds ys tkus ij ;g ?kfVr gksrk gSA Padding izkWiVhZ ds eku esa cnyko gksus ij ;g ?kfVr gksrk gSA fVªO;w ds MªkW gksus ij ;g ?kfVr gksrk gSA RightToLeftLayout izkWiVhZ ds eku ds cnyus ij ;g ?kfVr gksrk gSA Text izkiW VhZ ds eku esa cnyko gksus ij ;g ?kfVr gksrk gSA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

daVªksy (The Toolbar Control)

Vwyckj (ToolBar) daVªksy dk mi;ksx iQkWeZ ij ,d daVªksy ckj dh rjg gksrk gS tks ,d iafDr esa MªkWi Mkmu esU;w rFkk cVu dks fMLIys djrs gSa ftudk dk;Z lacaf/r dek.M dks ,fDVosV djuk gksrk gSA Vwyckj ij fdlh cVu dks fDyd djuk esU;w dek.M ds p;u djus ds leku gksrk gSA cVu dks iq'k cVu~l] MªkWi Mkmu esU;w ;k lsisjsVj dh rjg blds :i rFkk vkpj.k dks dufiQxj fd;k tk ldrk gSA lkekU;r% Vwyckj oSls cVu rFkk esU;w dks j[krs gSa tks ,fIyds'ku ds esU;w lajpuk esa vkbVeksa dks O;Dr djrk gS rFkk ,fIyds'ku ds vf/drj mi;ksx gksus okys iaQD'ku rFkk dek.M dk 'kh?kz ,Dlsl iznku djrk gSA Vwyckj daVªksy vkerkSj ij isjs.V fo.Mks ds lcls mij yxk (docked) gksrk gSA ijUrq bls fo.Mks ds fdlh fdukjs ij yxk;k tk ldrk gSA Vwyckj ;wtj ds }kjk Vwyckj cVu ij ekml ls bafxr djus ij VwyfVIl (tooltips) dks fMLIys dj ldrk gSA VwyfVi (ToolTip) ,d NksVk ikWi vi fo.Mks gksrk gS tks cVu ;k esU;w ds mn~ns';ksa dks la{ksi esa o.kZu djrk gSA VwyfVIl dks fMLIys djus ds fy, ShowToolTips izkWiVhZ dks lR; (True) lsV gksuk pkfg,A oh- ch- MkWV usV 2005 esa ToolBar daVªksy dks ToolStrip daVªksy ds lkFk izfrLFkkfir fd;k x;k gS fdUrq bls cSdoMZ dEiSfVfcfyfV rFkk Hkkoh mi;ksx ds fy, j[kk x;k gSA ;fn vki pkgsa rks Vwyckj daVªksy dk Hkh mi;ksx dj ldrs gSaA Vwyckj rFkk VwyfLVªi daVªksy dk;Z ,d gh djrs gSa ijUrq nksuksa ds cukus ds rjhds vyx gSaA ;gk¡ ge VwyfLVªi daVªksy dk gh mi;ksx dj jgs gSa rFkk tks WritePad uke dk izkstsDV iqLrd ds lkFk gS mlesa eSaus VwyfLVªi (ToolStrip) daVªksy dk gh mi;ksx fd;k gSA Vwyckj daVªksy ges'kk blds isjs.V fo.Mks ls mijh fdukjs ij yxk gksrk gSA ijUrq bls fo.Mks ds fdlh Hkh fdukjs ls yxk;k tk ldrk gSA Vwyckj ;wt+j }kjk blds fdlh cVu dks bafxr djus ij VwyfVIl fMLIys dj ldrk gSA VwyfVi ,d NksVk ikWi vi fo.Mks gksrk gS tks la{ksi esa cVu ;k esU;w ds dk;Z dks crkrk gSA VwyfVi dks fMLIys djus ds fy, ShowToolTips izkWiVhZ dks True lsV djrs gSaA VwyfLVªi daVªksy lkekU;r% iQkWeZ fMtk;uj ds lcls mijh fgLls esa fLFkr gksrk gS tSlkfd fp=k 7-35 esa fn[kk;k x;k gSA

fp=k 7.35 : VwyfLVªi daVªksy iQkWeZ fMtk;uj ij

213


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

fparu % Vwyckj daVªksy dks VwyckWDl ij izdV djuk Vwyckj pw¡fd bl laLdj.k esa ekStwn ugha gS rks ;g ckbZ fMiQkWYV VwyckWDl ij miyC/ ugha gksxkA blfy, bls ,d fo'ks"k rjhds ls izdV djokuk gksxkA blds fy, ;s djsa& ➪ Tools dks fDyd djsa rFkk Choose Toolbox Items... dk p;u djsaA rRi'pkr~ Choose Toolbox Items fp=k T7.3 dh Hkk¡fr izdV gksxkA

fp=k T7.3 : Choose Toolbox Items Mk;ykWx ckWDl ➪ .NET Framework Components VSc dk p;u djsa ;fn ;g p;fur ugha gSA rFkk LØkWy djrs gq, Toolbox rd tk;sa vkSj ml dk p;u djsaA ➪ blds ckn OK fDyd dj Choose Toolbox Items Mk;ykWx ckWDl dks can djsaA blds ckn VwyckWDl ij Menus & Toolbars ds varxZr Toolbar daVªksy fn[ksxkA (ns[ksa fp=k T7.4)

214

fp=k T7.4 : Vwyckj daVªksy VwyckWDl ij izdV


7.21.1 VwyfLVªi daVªksy ds izkWiVhZ (Main Properties ToolStrip Control)

bl [k.M esa oh-ch- MkWV usV ds VwyfLVªi daVªksy ds izkWiVhZ ds ckjs esa tkurs gSaA buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt fo.Mks ds ekè;e ls lsV dj ldrs gSaA rFkk dqN tks izkWiVhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSaA ;|fi lHkh izkWiVhZ dks izksxzke ds ekè;e ls dksM fy[k dj lsV fd;k tk ldrk gSA izkWiVhZ AllowItemReorder

AllowMerge

AutoSize

BackColor BindingContext CanOverFlow CausesValidation

Cursor DefaultDropDownDirection

Font ForeColor GripDisplayStyle GripMargin GripRectangle GripStyle ImageList ImageScalingSize IsDropDown Items

fooj.k ToolStrip ds }kjk MªSx MªkWi rFkk vkbVe fjvkWMfjax dks futh :i ls gS.My fd;k tk;xk ;k ugha ds lwpd eku dks lsV djrk gSA ,d ls vf/d MenuStrip, ToolStripDropDownMenu, ToolStripMenuItem rFkk vU; Vkbi dks feyk;k tk ldrk gS vFkok ugha bldk lwpd eku lsV djrk gSA ml eku dks lsV djrk gS tks ;g crkrk gS fd daVªksy vius fo"k;&oLrq (contents) ds vuqlkj vius vkdkj esa cnyko djsxk vFkok ughaA VwyfLVªi ds fy, cSdxzkm.M jax dks lsV djrk gSA VwyfLVªi ds fy, ckbfUMax dUVsDLV (binding context) dks lsV djrk gSA VwyfLVªi esa vkbVeksa dks vksojÝyks esU;w esa Hkstk tk ldrk gS vFkok ugha bldk lwpd eku lsV djrk gSA ml eku dks lsV djrk gS tks ;g crkrk gS fd VwyfLVªi fdlh Hkh daVªksy ij iQksdl gksus ij oSfyMs'ku dh vko';drk iM+us ij osfyMs'ku lEiUu djok,xk vFkok ughaA VwyfLVªi ds mij ekml ys tkus ij fMLIys gksus okyk dlZj lsV djrk gSA ml fMiQkWYV fn'kk (direction) dks O;Dr djrk gqvk eku lsV djrk gS ftlesa ToolStripDropDown VwyfLVªi ds lkis{k esa fMLIys gksxkA VwyfLVªi ds mij ds VsDLV ds iQkW.V dks lsV djrk gSA VwyfLVªi ds iQksjxzkm.M jax dks lsV djrk gSA VwyfLVªi ewo gSa.My ds vksfj,.Vs'ku (orientation) dks lsV djrk gSA VwyfLVªi ewo gs.My ds pkjksa vksj ds LFkku dks lsV djrk gSA VwyfLVªi ewo gS.My ds ckm.Mªh (boundaries) dks lsV djrk gSA VwyfLVªi n`'; gks vFkok vn`'; blds fy, eku lsV djrk gSA VwyfLVªi vkbVe ij izdV gksus okys best ds fy, best fyLV dks lsV djrk gSA VwyfLVªi ij mi;ksx gksus okyk best ds vkdkj dks fiDlsy (pixels) esa lsV djrk gSA ml eku dks izkIr djrk gS tks ;g crkrk gS fd ;g VwyfLVªi ToolStripDropDown gS vFkok ughaA VwyfLVªi ls lacaf/r lHkh vkbVeksa dks izkIr djrk gSA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

viuh izxfr dks tk¡psa 5. Button dUVªky s ds ize[q k eSFkM dkSuls gSa\ 6. ComboBox dUVªksy D;k gS\ 215


izksxzkfeax fon fotqvy csfld MkWV usV

LayoutSettings

ysvkmV Ldhe iQhpjksa dks lsV djrk gSA

LayoutStyle

VwyfLVªi vkbVe ladyu dks fdl izdkj ys vkmV djrk gS blds fy, eku dks lsV djrk gSA blds laHkkfor eku Table, Flow, StackWithOverFlow, HorizontalStackWithOverFlow rFkk VerticalStackWithOverflow gks ldrs gSaA

Orientation

VwyfLVªiiSuy dk vksfj,.Vs'ku lsV djrk gSA VwyfLVªiiSuy (ToolStripPanel) og daVsuj daVªksy gS tks ,d lkFk ,d ls vf/d VwyfLVªi rFkk esU;wfLVªi daVªksy dks j[k ldrk gSA

OverFlowButton

ml ToolStripItem dks izkIr djrk gS tks vksojÝyks lfØ; VwyfLVªi ds fy, vksojÝyks cVu gksrk gSA

Renderer

ToolStripRender dks lsV djrk gS ftldk mi;ksx VwyfLVªi ds :i dks

NOTES

dLVekbt djus esa gksrk gSA RenderMode

VwyfLVªi ij ykxw gksus okyk isafVax LVkby dks lsV djrk gSA

ShowItemToolTips

VwyfLVªi vkbVeksa ij VwyfVi fMLIys gks vFkok ugha blds fy, eku dks lsV djrk gSA

TabStop

VwyfLVªi ds fdlh vkbVe dks VSc dh ds lkFk iQksdl fd;k tk ldrk gS vFkok ugha blds fy, eku dks lsV djrk gSA

TextDirection

VwyfLVªi ij VsDLV fdl fn'kk esa fy[kk tk;xk ;g lsV djrk gSA

7.21.2 VwyfLVªi daVªksy ds esFkM (Methods of the ToolStrip Control)

bl [k.M esa ge VwyfLVªi daVªksy ds eq[; esFkM ds ckjs esa ppkZ djsaxsA esFkM GetItemAt GetNextItem

fooj.k Li"V fd;s x;s yksds'ku ls vkbVe dks izkIr djrk gSA Li"V fd;s x;s jsizsQUl Iokb.V rFkk Li"V fd;s x;s fn'kk esa ewo gks jgs vxys ToolStripItem dks izkIr djrk gSA

7.21.3 VwyfLVªi daVªksy ds bos.V (Events of the ToolStrip Control)

bl [k.M esa ge VwyfLVªi daVªksy ds eq[; bos.V ds ckjs esa tkusaxsA bos.V AutoSizeChange BeginDrag

fooj.k AutoSize izkWiVhZ ds eku ds cnyus ij ;g ?kfVr gksrk gSA ;wtj }kjk VwyfLVªi daVªksy ds MªSx fd;s tkus ij ;g ?kfVr gksrk gSA

7.21.4 fMtk;u le; esa VwyfLVªi ij LVS.MMZ Vwyckj tksM+uk (Adding Standard Toolbar to the ToolStrip At Design Time)

vkius uksViSM ds LVS.MMZ Vwyckj dks ns[kk gksxkA bls vkidks oh- ch- MkWV usV esa cukus ds fy, cgqr dqN djus dh vko';drk ughaA dsoy bu inksa dks djsa& ➪ VwyckWDl ls ToolStrip dks nks ckj fDyd djds bls iQkWeZ ij tksM+saA rRi'pkr~ vkids iQkWeZ ij VwyfLVªi tqM+ tk,xk rFkk ToolStrip1 fp=k 7-36 dh Hkk¡fr dEiksus.V~l Vªs esa izdV gksxkA

216

➪ ToolStrip ds mijh nk;ha fdukjs ij LekVZ VkLd ,sjks ( ) dks fDyd djsaA iQyLo:i ToolStrip Tasks isu fp=k 7-37 dh Hkk¡fr izdV gksxk


GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

fp=k 7.36 : iQkWeZ ds 'kh"kZd ckj ds fy, VwyfLVªi rFkk ToolStrip1 dEiksus.V~l Vªs esa

fp=k 7.37 : LekVZ VkLd ,sjks dks fDyd dj ToolStrip Tasks isu dks izdV djrs gq, ➪ mlds ckn ToolStrip Tasks isu esa Insert Standard Items dks fDyd djsaA blds ckn vki ns[ksaxs fd ,d lkekU; LVS.MMZ Vwyckj ij izdV gksus okys lHkh vkbVEl ;Fkk New, Open, Save, Print, Cut, Copy, Paste rFkk Help izdV gks x;s gSaA ➪ F5 nck,¡ rFkk ju djds ns[ksaA vki ns[ksaxs fd lHkh cVu~l ds lkFk gh muds VwyfVi~l Hkh tqM+ x;s gSaA

217


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

fp=k 7.38 : iQkWeZ ij tqM+s LVS.MMZ Vwyckj

7.22

fp=k 7.39 : LVS.MMZ Vwyckj cVu~l ds lkFk izdV VwyfVi~l

LVsVlckj (StatusBar)

fotqvy LVwfM;ks MkWV usV 2005 esa LVsVslckj daVªksy ds cnys LVsVlfLVªi (StatusStrip) daVªksy dks ifjfpr djk;k x;k gSA ijUrq LVsVlckj daVªksy dks gVk;k ugha x;k gSA bls cSdoMZ dEiSfVfcfyfV ds fy, rFkk Hkfo"; ds mi;ksx ds fy, j[kk x;k gSA LVsVlckj daVªksy dk mi;ksx ml {ks=k ds :i esa gksrk gS tks ,fIyds'ku fo.Mks ds lcls uhps fLFkr gksrk gS rFkk tgkWa ,fIyds'ku fofHkUu izdkj ds LVsVl lwpuk dks fMLiys djrk gSA LVsVlfLVªi daVªksy dk ,d iSuy gksrk gS tks VsDLV] vkbdu vFkok ,fuesVsM vkbdu j[krk gS tks izkslsl ds gksus ;k vU; lwpuk dks fMLIys djrk gSA mnkgj.k ds fy, b.VjusV ,DlIyksjj LVsVl ckj dk iz;ksx djrk gS tks gk;ijfyad ij ekml ds ys tkus ij ml ist dk ;w vkj ,y fMLiys djrk gSA ekbozQkslkWiQV oMZ LVsVl ckj ij orZeku i`"B la[;k] i`"Bksa dh dqy la[;k vkfn tSls lwpuk dks fMLIys djrk gSA 7.22.1 LVsVlfLVªi daVªksy ds izkWiVhZ (Properties of the StatusStrip Control)

bl [k.M esa oh-ch- MkWV usV ds LVsVlfLVªi daVkª y s ds izkiW VhZ ds ckjs esa tkurs gSAa buesa dqN izkiW VhZ ,sls gSa tks vki fMtk;u le; esa izkiW VhZt fo.Mks ds ekè;e ls lsV dj ldrs gSAa rFkk dqN tks izkiW VhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSAa ;|fi lHkh izkiW VhZ dks izkxs kz e ds ekè;e ls dksM fy[k dj lsV fd;k tk ldrk gSA izkWiVhZ

218

fooj.k CanOverflow ml eku dks lsV djrk gS tks n'kkZrk gS fd StatusStrip vksojÝyks iaQD'kuSfyfV (overflow functionality) dks liksVZ djsa vFkok u djsaA GripStyle daVkª y s dks iksth'ku cnyus esa mi;ksx gksus okys xzhi (grip) dh foftfcfyfV dks lsV djrk gSA LayoutStyle ml eku dks lsV djrk gS tks ;g n'kkZrk gS fd fdl izdkj LVsVlfLVªi vkbVeksa ds ladyu dks ysvkmV djrk gSA ShowItemToolTips ml eku dks lsV djrk gS tks ;g n'kkZrk gS fd LVsVlfLVªi ds fy, VwyfVi~l fn[kk;k tk; vFkok ughaA SizeGripBounds LVsVlfLVªi ds lkbftax gS.My (fxzi) ds ckm.Mªh dks izkIr djrk gSA SizingGrip ml eku dks lsV djrk gS tks ;g n'kkZrk gS fd lkbftax gS.My (sizing handle) ;k fxzi (grip) daVkª y s ds uhpys nk;sa dksus esa izdV gks vFkok ughaA Stretch ml eku dks lsV djrk gS tks ;g crkrk gS fd LVsVlfLVªi dSjsDVj ij iwjh rjg iQSys vFkok ughaA


ySc vH;kl 7.10 (Lab Exercise 7.10) ,d fo.Mkst ,fIyds'ku ckuk,¡A rFkk iQkWeZ ij MenuStrip daVªksy dks tksM+dj ,d esU;w fMtk;u djsaA rFkk StatusStrip daVªksy dks tksM+saA bl ,fIyds'ku esa ;wtj tc esU;w dk p;u djs rc LVsVlckj ij ml esU;w ds p;u dh lwpuk izdV gksA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

lek/ku % ➪ File esU;w dks fDyd djsa rFkk New Project dk p;u djsaA ➪ New Project Mk;ykWx ckWDl [kqyus ds i'pkr Templates isu esa Windows Application dks fDyd djsaA ➪ Name VsDLVckWDl esa Lab Exercise 7.10 Vkbi djsa rFkk OK dks fDyd djsa A mlds ckn ,d u;k fo.Mkst iQkWeZl izkstsDV [kqysxkA ➪ iQkWeZ ij VwyckWDl ls PictureBox daVªksy dks nks ckj fDyd dj tksMsa+A rFkk blds izkWiVhZ dks fMiQkWYV jgus nsaA ➪ iQkWeZ ij esU;wckj dks tksM+us ds fy, VwyckWDl ls MenuStrip daVªksy dks nks ckj fDyd djsaA iQyLo:i esU;wfLVªi vkids iQkWeZ fp=k LA7.19 : iQkWeZ ij tksM+k x;k esU;wfLVªi ij tqM+ tk;xkA rFkk MenuStrip1 rFkk MenuStrip1 dEiksus.V~l Vªs esa dEiksus.V~l Vªs esa fp=k LA7.19 dh Hkk¡fr fn[ksxkA ➪ mlds ckn esU;wfLVªi ds nk;ha mijh dksuk esa LekVZ VkLd ,sjks (LekVZ VSx XfyiQ) dk p;u djsaA rRi'pkr~ MenuStrip Tasks isu [kqysxkA Insert Standard Items dk p;u djsa (ns[ksa fp=k LA7.20)

219

fp=k LA7.20 : MenuStrip Tasks isu


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

➪ rRi'pkr~ vki ns[ksaxs fd iQkWeZ ij dqN esU;w ds lkFk ,d esU;wckj fp=k LA7.21 dh Hkk¡fr izdV gks x;kA ➪ vc VwyckWDl esa Menus & Toolbars ds varxZr StatusStrip daVªksy dks nks ckj fDyd dj iQkWeZ ij tksM+saA ,slk djus ij iQkWeZ ds lcls uhps StatusStrip fn[ksxk rFkk StatusStrip1 dEiksus.V~l Vªs esa izdV gksxkA (ns[ks fp=k LA7.22)

fp=k LA7.21 % fufeZr esU;wckj

fp=k LA7.22 % iQkWeZ ij tqM+k LVsVlfLVªi rFkk StatusStrip1 dEiksus.V~l Vªs esa

➪ StatusStrip daVªksy ds MªkWi Mkmu fyLV dks fDyd djsa rFkk StatusLabel dk p;u djsaA (ns[ksa fp=k LA7.23) ➪ vc bldk dksfMax fy[ksaA blds fy, File esU;w vkbVe dks fDyd djsa rFkk Properties fo.Mks ls Events dk p;u djsaA (ns[ksa fp=k LA7.24)

220

fp=k : LA7.23 % StatusStrip MªkWi Mkmu fyLV ls StatusLabel dk p;u djrs gq,

fp=k LA7.24 : File esU;w dk p;u dj izkWiVhZt fo.Mks esa Events dk p;u djrs gq,


➪ izkWiVhZt fo.Mks esa Events p;u djus ds ckn ml p;fur vkbVe dk bos.V~l izdV gksxkA (ns[ksa fp=k LA7.25) ➪ ;gk¡ DropDownItemClicked bos.V dks nks ckj fDyd djsaA rRi'pkr~ vkidks FileToolStripMenuItem DropDownItemClicked bos.V gS.Myj ds lkFk dksM fMtk;uj [kqysxkA (ns[ksa fp=k LA7.26)

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

fp=k :A7.26 : dksM fMtk;uj fp=k LA7.25 : FileToolStripMenuItem ds lHkh bos.V izkWiVhZt fo.Mks esa izdV ➪ Private Sub rFkk End Sub ds eè; bl ,d ykbu dk dksM fy[ksa& Me.UpdateStatus(e.ClickedItem)

➪ mlds ckn End Sub ds ckn Update Status iaQD'ku dks cukus ds fy, ;s dksM fy[ksa& Private Sub UpdateStatus(ByVal item As ToolStripItem) If item IsNot Nothing Then Dim msg As String = String.Format("(0) Selected", item.Text) Me.StatusStrip1.Items(0).Text = msg End If End Sub

➪ blds ckn F5 nckdj ifj.kke ns[ksaA File dks fDyd djsa rFkk New dks fDyd djsaA vkidks iQkWeZ ds uhps LVsVlfLVªi ij New selected lans'k fn[ksxkA

fp=k LA7.27 ySc vH;kl 7.10 dk ifj.kke

7.23

fyadyscy (LinkLabel)

fyadyscy daVªksy dk mi;ksx dj vki fo.Mkst+ iQkWeZ ,fIyds'ku esa gk;ijfyad dks tksM+ ldrs gSaA vki fyadyscy dk mi;ksx mu lc ds fy, dj ldrs gSa tks vki yscy ls djrs gSaA vki fyadyscy

221


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

ds mij ds VsDLV ds ,d fgLls dks fdlh iQkby] iQksYMj ;k osc ist ds fyad ds :i esa lsV dj ldrs gSaA yscy daVªksy ds lHkh izkWiVhZ] esFkM rFkk bos.V ds vfrfjDr fyadyscy esa gk;ijfyad rFkk fyad jaxksa ds fy, [kkl izkWiVhZ gSA LinkArea VsDLV ds ml ,fj;k (area) dks lsV djrk gS tks fyad dks ,fDVosV djrk gSA blds LinkColor, VisitedLinkColor rFkk ActiveLinkColor izkWiVhZ fyad ds jaxksa dks lsV djrk gSA LinkClicked bos.V ;g lqfuf'pr djrk gS fd fyad VsDLV dk p;u djus ij D;k gksrk gSA fyadyscy (LinkLabel) daVªksy dk lcls lkekU; mi;ksx LinkArea izkWiVhZ dh lgk;rk ls flaxy fyad dks fMLIys djrk gS ijUrq Links izkWiVhZ ,slk izkWiVhZ Hkh gS ftldk mi;ksx dj vki ,d ls vf/d gk;ijfyad dks fMLIys dj ldrs gSaA Links izkWiVhZ fyad ds ,d iwjs ladyu dks ,Dlsl djuk vklku cukrk gSA vki LinkData izkWiVhZ esa izR;sd fyad vkWCtsDV ds fy, MkVk dks Hkh Li"V dj ldrs gSaA LinkData izkWiVhZ ds eku dk mi;ksx iQkby ds yksds'ku ;k osclkbV ds ;w- vkj- ,y- dks LVksj djus esa gksrk gSA 7.23.1 fyadyscy daVªksy ds izkWiVhZ (Main Properties of the LinkLabel Control)

bl [k.M esa oh-ch- MkWV usV ds fyadyscy daVkª y s ds izkiW VhZ ds ckjs esa tkurs gSAa buesa dqN izkiW VhZ ,sls gSa tks vki fMtk;u le; esa izkiW VhZt fo.Mks ds ekè;e ls lsV dj ldrs gSAa rFkk dqN tks izkiW VhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSAa ;|fi lHkh izkiW VhZ dks izkxs kz e ds ekè;e ls dksM fy[k dj lsV fd;k tk ldrk gSA izkWiVhZ DisableLinkColor FlatStyle LinkBehaviour LinkArea LinkColor VisitedLinkColor ActiveLinkColor LinkData Links

LinkVisited

Padding

fooj.k fuf"Ø; (disabled) fyad dks fMLIys djus ds le; mi;ksx gksus okyk jax dks lsV djrk gSA fyadyscy ds ÝySV LVkby :i (flat style appearance) dks lsV djrk gSA ml eku dks lsV djrk gS tks fyad ds vkpj.k (behaviour) dks O;Dr djrk gSA VsDLV ds ml {ks=k dks lsV djrk gS tks fyad dks ,fDVosV djrk gS A fyad ds jax dks lsV djrk gS A fyad dks fDyd fd, tkus ij bldk jax D;k gksxk bls lsV djrk gS A lfozQ; fyad ds jax dks lsV djrk gS A bl izkWiVhZ dk mi;ksx fMLIys gksus okys iQkby ds yksds'ku rFkk osclkbV ds ;w- vkj- ,y- dks LVksj djus esa gksrk gSA fyadyscy ds vanj j[ks x;s fyad ds ladyu (collection) dks izkIr djrk gSA lkekU; 'kCnksa esa dgsa rks bldk mi;ksx fyadyscy ij ,d ls vf/d fyad cukus esa gksrk gSA ml eku dks lsV djrk gS tks ;g n'kkZrk gS fd fyad dks bl izdkj izdV gksuk pkfg, tSls fd yxs bl fyad dks foftV fd;k tk pqdk gS vFkok ughaA fyadyscy ds fdukjksa (edges) rFkk blds fo"k;&oLrq ds eè; dh vkarfjd Lisflax (interior spacing) dks fiDlsy esa lsV djrk gSA

7.23.2 fyadyscy daVªksy ds izeq[k bos.V (Main Events of LinkLabel Control)

bl [k.M esa ge fyadyscy daVªksy ds izeq[k bos.V ij ppkZ djsaxsA LinkClicked 222

daVªksy ds vanj ds fyad dks fDyd djus ij ;g ?kfVr gksrk gSA lkekU;r% bldk mi;ksx mu dk;ksZa dks lEiUu djus esa gksrk gSA tc bl daVªksy ds fyad dks ;wtj fDyd djrk gSA ;g fyadyscy dk fMiQkWYV bos.V gSA


7.23.3

fyadyscy dk mi;ksx djds ,d iQkWeZ dks nwljs iQkWeZ ls fyad djuk (Linking One Form To The Other Using Link Label)

vki fyadyscy dk mi;ksx djds ,d iQkWeZ dks nwljs iQkWeZ ls fyad dj ldrs gSaA blds fy, fuEufyf[kr inksa dk vuqlj.k djsa&

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

➪ iQkW e Z ij Vw y ckW D l ls LinkLabel da V ª k s y dks tksM+saA ➪ blds ckn fyadyscy dk p;u djsaA vkSj blds Text izkWiVhZ esa Visit Us Vkbi djsaA vc vkidks ;fn iwjs yscy dks gk;ijfyad esa cnyuk gS rks bls ckbZ fMiQkWYV jgus nsaA (ns[ksa fp=k 7-40)

fp=k 7.40 : fyad yscy iQkWeZ ij izdV

➪ ;fn blds ,d fo'ks"k Hkkx d ks gk;ijfyad esa cnyuk pkgrs gSa rks ;g djsa& ➪ fyadyscy dk p;u djsa rFkk blds LinkArea izkWiVhZ esa la[;k dks lsV djsa A bl izkWiVhZ es nks la[;k fn;k gksrk gSA igyk la[;k dSjsDVj ds igys ikst+h'ku dks rFkk nwljk la[;k dSjsDVj dh yEckbZ dks O;Dr djrk gSA vki iwjs VsDLV esa fdl dSjsDVj ls ysdj fdl dSjsDVj rd dks fyad esa cnyuk pkgrs gSa blh vuqlkj nksuksa la[;k dks fy[ksaA mnkgj.kkFkZ ;fn vki Visit Us esa dsoy Us dks gh fyad cukuk pkgrs gSa rks LinkArea izkWiVhZ dk eku 6, 2 lsV djsaA 6 bldk izkjfEHkd eku rFkk 2 dSjsDVlZ dh yEckbZ gSaA vki pkgsa rks LinkArea ds + cVu dks fDyd dj blds Start rFkk Length esa Hkh og eku lsV dj ldrs gSaA bldk izkjfEHkd iksth'ku 0 ls 'kq: gksrk gSA vklku fof/ ds fy, blds bfyifll cVu (...) dks fDyd djds LinkArea Editor fp=k 7-41 dh Hkk¡fr [kksysaA vkSj VsDLV ds ml fgLls dk p;u djsa ftls vki fyad cukuk pkgrs gSaA LinkArea Editor Mk;ykWx ckWDl dks can djus ds fy, OK fDyd djsaA

fp=k 7.41 : LinkArea Aditor Mk;ykWx ckWDl ➪ rRi'pkr~ vki iQkWeZ ij fyadyscy VsDLV fgLls esa dsoy Us dks gh fyad ds :i esa ns[ksxa As (ns[ksa fp=k 7-42) 223


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

fp=k 7.42 : Us yscy ij fyad ds :i esa ➪ bls vki izksxzke ds ekè;e ls Hkh cuk ldrs gSaA blds fy, iQkWeZ dks nks ckj fDyd djsa rFkk Form1_Load bos.V gS.Myj ds fy, ;g dksM fy[ksa & LinkLabel1.LinkArea = New LinkArea(6, 2)

➪ mlds ckn izkstsDV ds nwljs iQWkeZ dks [kksyus ds fy, LinkLabel1_LinkClicked bos.V gS.Myj esa ;g dksM fy[ksa & Dim f2 As New Form() f2.Show LinkLabel1.LinkVisited = True LinkVisited izkWiVhZ dks bl dksM esa blfy, True lsV fd;k x;k gS rkfd tc ;wt+j

gk;ijfyad dks fDyd djs rc mldk jax cny tk;A ➪ mlds ckn F5 nckdj izksxzke dks ju djsaA ju gksus ds i'pkr~ iQkWeZ ij Us dks fDyd djsaA vki ns[ksaxs fd fp=k 7-43 dh Hkk¡fr iznf'kZr gSA

fp=k 7.43 : Us dks fDyd djus ij vU; iQkWeZ izdV gksrk gqvk 7.23.4 fyadyscy dk Using Link Label)

224

mi;ksx djds osc ist dks fyad djuk (Linking A Web Page

fyadyscy dk mi;ksx djds vki fdlh osc ist dks Hkh fyad dj ldrs gSa A fdlh osc ist dks fyad djus ds fy, bu inksa dk vuqlj.k djsa & ➪ LinkLabel daVªksy dks iQkWeZ ij tksM+saA rFkk blds Text izkWiVhZ dk mi;ksx bls mi;qDr dSI'ku nsus ds fy, djsaA geus bldk dSI'ku bl izdkj lsV fd;k gS&


We are a leading publisher in bringing out syllabus based texts on Computer Science for a number of universities. Click More to know about us.

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

➪ TextAlign ds eku dks MiddleCenter lsV djsaA ➪ rFkk dSI'ku ls dsoy More dks fyad cukus ds fy, LinkArea izkWiVhZ ds bfyifll cVu dks fDyd dj LinkArea Editor Mk;ykWx ckWDl [kksysa rFkk More dks gk;ijfyad lsV djus ds fy, More dk p;u djsa rFkk OK fDyd djsa rkfd Mk;ykWx ckWDl can gks tk;A ➪ rRi'pkr~ yscyfyad dks nks ckj fDyd djsa rFkk LinkLabel1_LinkedClicked bos.V gs.Myj ds fy, ;g dksM fy[ksa& LinkLabel1.LinkVisited = True System.Diagnostics.Process.Start("http://www.pragyaonline.com")

dksM fMtk;uj esa ;g dksM fp=k 7-44 dh Hkk¡fr gksxkA ➪ F5 nck,¡A rRi'pkr~ ifj.kke fp=k 7-44 dh Hkk¡fr fn[ksxkA More dks fDyd djsaA vki ns[ksaxs fd czkmtj ds ;w- vkj- ,y- ckWDl esa ogh ;w- vkj- ,y- gS tks vkius dksfMax esa fn;k gSA

fp=k 7.44 : iznf'kZr ifj.kke

fp=k 7.45 : czkm”kj esa dksfMax esa fn;k x;k ;w- vkj- ,y-

;fn vkids dEI;wVj ij b.VjusV dusD'ku miyC/ gS rks www.pragyaonline.com lkbV [kqy tk,xkA mijksDr dksfMax esa nks ykbu tksM+k x;k gSA igyk ykbu LinkLabel.LinkVisited = True

fyadyscy ds LinkVisited izkWiVhZ dks lR; lsV djrk gSA bldk ykHk ;g gS fd tc bl fyad dks fDyd fd;k tk; rc ;g yxs fd bls fDyd fd;k tk pqdk gSA blds fy, bldks fDyd djus ij jax ifjofrZr gks tkrk gS rFkk nwljk ykbu Start esFkM dk iz;ksx System.Diagnostics useLisl ds lkFk djrk gSA System.Diagnostics usELisl ,sls Dyklksa dks ,fIyds'ku esa miyC/ djkrk gS ftldh lgk;rk ls vki flLVe izkslsl] bos.V ykWx~l (event logs) rFkk ijiQkWjesu~l dkm.Vj~l (performance counters) ds lkFk baVj,DV djrs gSaA vki bl ykbu ds cnys dsoy ;g Hkh fy[ksaxs rks ifj.kke ogh vk,xk ysfdu csgrj ;g gS fd System.Diagnostics useLisl dks tksM+sa& Process.Start("http://www.pragyaonline.com") 225


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

7.24 Mk;ykWx ckWDl (Dialog Box) Mk;ykWx ckWDl vki ls vifjfpr ughs gksuk pkfg, A vki vDlj tc ekbozQkslkWiQV vkWfiQl esa dke dj jgs gksrs gS a rks cgqr lkjs dke ds fy, ;Fkk VsDLV dk jax cnyus ds fy,] iQkby dks [kksyus ds fy, Mk;ykWx ckWDl dks iz;ksx esa ykrs gSa A Mk;ykWx ckWDl dk mi;ksx ;wt+j ds lkFk laokn djus vkSj mlls lwpuk okil ysus esa gksrk gS A vki MkWV usV esa viuk Mk;ykWx ckWDl Hkh cuk ldrs gSa ftldh ppkZ vkxs gqb gS A ;gk¡ ge ,sls Mk;ykWx ckWDl dh ckr dj jgs gSa tks gesa cus cuk, feyrs gSa A MkWV usV izQseodZ dbZ izdkj ds Mk;ykWx ckWDl miyC/ djkrk gS ftuds dEiksus.V VwyckWDl ij Dialogs ds varxZr miyC/ jgrs gSa A (ns[ksa fp=k 7.46)

fp=k 7.46 : fofHkUu Mk;ykWx dEiksus.V~l VwyckWDl ij 7.25 vksiu iQkby Mk;ykWx ckWDl (OpenFileDialog Box) ekbØkslkWÝV oMZ] ,Dlsy] ikojIokbUV] istesdj] dksjy MªkW] oMZiMS ;k uksVisM fdlh Hkh ,Iyhds'ku esa dk;Z djrs le; vkius vksiu iQkby Mk;ykWx ckWDl dh lgk;rk ls vius igys ls cus gq, iQkbyksa dks vo'; gh [kksyk gksxkA fotqvy csfld MkWV usV ls tc vki fdlh ,Iyhds'ku dks fodflr djrs gSa rks vki ;wtj ds fy, vksiu iQkby Mk;ykWx ckWDl vo'; gh ,d iQhpj nsxa s rkfd ,Iyhds'ku ds fdlh iQkby dks ;wtj vklkuh ls [kksy ysA vki blds fy, oh-ch- MkWV usV esa OpenFileDialog dEiksu.s V dk iz;ksx djrs gSAa OpenFileDialog ds izkWiVhZ ds ekè;e ls vki blds vkpj.k dks dLVekbt dj ldrs gSAa vxys [k.M esa blls lacfa /r izkWiVhZ] esFkM rFkk bos.V ij ppkZ fd;k x;k gSA ckWDl ds vkpj.k dks dLVekbt djus ds fy, blds dbZ izkWiVhZt gS]a ftUgsa vki lsV dj ldrs gSAa 7.25.1 vksiuiQkbyMk;ykWx ds izkWiVhZ (Properties of OpenFileDialog)

226

bl [k.M esa oh-ch- MkWV usV ds vksiuiQkbyMk;ykWx dEiksus.V ds izkWiVhZ ds ckjs esa tkurs gSaA buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt fo.Mks ds ekè;e ls lsV dj ldrs gSaA rFkk dqN tks izkWiVhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSaA ;|fi lHkh izkWiVhZ dks izksxzke ds ekè;e ls dksM fy[k dj lsV fd;k tk ldrk gSA


izkWiVhZ CheckFileExists

MultiSelect ReadOnlyChecked ShowReadOnly

fooj.k Mk;ykWx ckWDl ,d psrkouh iznf'kZr djs ;k u djs ;fn mi;ksxdrkZ ,sls iQkby dks [kksyus dk iz;kl djsa tks fo|eku u gks dks lsV djrk gS ;k fiQj mlds ckjs esa crkrk gSA Mk;ykWx ckWDl esa ,d ls vf/d iQkbyksa dk p;u gksxk ;k ugha ;g lsV djrk gS ;k mlds ckjs esa crkrk gSA jhM vkWuyh psdckWDl psd gS ;k ugha bldks lsV djrk gS ;k blds ckjs esa crkrk gSA Mk;ykWx ckWDl jhM vksuyh psd ckWDl iznf'kZr djrk gS ;k ugha ;g lsV djrk gS ;k mlds ckjs esa crkrk gSA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

vksiu iQkby Mk;ykWx ds esFkM (Methods of OpenFileDialog) bl [k.M esa ge vksiuiQkbyMk;ykWx dEiksus.V ds esFkM ds ckjs esa tkusaxsA esFkM fooj.k OpenFile jhM vkWuyh vuqefr ds lkFk vki }kjk p;fur iQkby dks [kksyrk gSA ;g iQkby FileName izkWiVhZ }kjk Li"V gksrk gSA Reset lHkh fodYiksa dks muds fMiQkWYV ekuksa ds lkFk lsV djrk gSA ShowDialog Mk;ykWx ckWDl iznf'kZr djrk gSA

7.25.2

vksiu iQkby Mk;ykWx ckWDl ds bos.V (Events of OpenFileDialog) bl [k.M esa ge vksiuiQkbyMk;ykWx dEiksus.V ds bos.V ij ppkZ djsaxsA bos.V fooj.k FileOK ;wtj ds }kjk Open ;k Save cVu dks fDyd djus ij ?kfVr gksrk gSA HelpRequest ;wtj ds }kjk gsYi cVu ij fDyd djus ij ?kfVr gksrk gSA

7.25.3

7.25.4

vksiuiQkbyMk;ykWx dEiksus.V dh lgk;rk ls iQkby [kksyuk (Opening a File Using the OpenFileDialog Component)

vksiuiQkbyMk;ykWx dEiksus.V dh lgk;rk ls vkius ,fIyds'ku ls cM+h vklkuh ls iQkby [kksyus dk fodYi miyC/ djk ldrs gSaA bldks le>us ds fy, vki fuEufyf[kr inksa dk vuqlj.k djsa& ➪ fotqvy LVwfM;ks [kksysaA ➪ iQkWeZ fMtk;uj ij ,d esU;wckj cuk,¡A esU;w esa File eq[; esU;w rFkk mi esU;w ds :i esa Open dks tksM+saA bruk djus ds ckn vkidk baVjisQl fp=k 7-47 dh Hkk¡fr fn[kuk pkfg,A

227

fp=k 7.47 : rS;kj esU;wckj iQkWeZ ij


izksxzkfeax fon fotqvy csfld MkWV usV

➪ blds ckn VwyckWDl ij Dialogs ds varxZr OpenFileDialog dEiksus.V dks nks ckj fDyd djsaA rRi'pkr~ OpenFileDialog1d uke ls ;g dEiksus.V iQkWeZ ds uhps dEiksus.V~l Vªs esa fp=k 7-48 dh Hkk¡fr fn[ksxkA

NOTES

fp=k 7.48 : OpenFileDialog1 uked vksiuiQkbyMk;ykWx dEiksus.V~l Vªs esa izdV ➪ mlds ckn ,d VsDLVckWDl tksM+sa rFkk bldk Multiline izkWiVhZ True rFkk Dock dks Fill lsV djsaA bldk VsDLVckWDl dk Name izkWiVhZ ckbZ fMiQkWYV TextBox1 jgus nsaA rRi'pkr~ vkidks baVjisQl fp=k 7-49 dh Hkk¡fr fn[ksxkA

fp=k 7.49 : iQkWeZ ij tksM+s x;s VsDLVckWDl 228

➪ mlds i'pkr~ fMtk;u le; esa File esU;w dk p;u djsa rFkk Open esU;w dks nks ckj fDyd djsaA rnqijkar OpenToolStripMenuItem_Click bos.V gS.Myj fp=k 7-50 dh Hkk¡fr dksM fMtk;uj esa izdV gksxkA


GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

fp=k 7.50 : dksM fMtk;uj ➪ Public Sub rFkk End Sub ds eè; vc ;g dksM fy[ksa& Dim OpenFileDialog1 As New Window.Forms.OpenFileDialog() OpenFileDialog1.Filter = "Text Files1*.txt" OpenFileDialog1.Title = "Select a Text File" If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then TextBox1.Text = MyComputer.FileSystem.ReadAllText(OpenFileDialog1.Filename) End If

➪ F5 nckdj izksxzke dks ju djsaA File esU;w esa Open dks fDyd djsa vkidks fp=k 5-51 dh Hkk¡fr Select a Text File Mk;ykWx ckWDl fn[kkbZ nsxkA

fp=k 7.51 : Select a Text File Mk;ykWx ckWDl iznf'kZr ➪ fdlh VsDLV iQkby dk p;u djus ds ckn Open fDyd djsaA vki ns[ksaxs fd ml iQkby dh oLrq vkids ,fIyds'ku esa [kqy x;kA 7.26 lso iQkby Mk;ykWx ckWDl (SaveFileDialog Box) lso iQkby Mk;ykWx ckWDl ls vki dbZ ckj :c: gq, gksaxsA tc&tc vi fo.Mkst ds uksViSM] oMZiSM] oMZ] ,Dlsy ;k bl rjg ds fdlh Hkh ,Iyhds'ku esa dk;Z djrs gSa rFkk dk;Z dks lqjf{kr djus ds File → Save ;k Save As dk p;u djrs gSa rks ;g Mk;ykWx ckWDl izdV gksrk gSA

229


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

oh-ch- MkWV usV fcYdqy blh rjg dk Mk;ykWx ckWDl vkids ,Iyhds'ku esa Hkh tksM+us dh O;oLFkk cukrk gSA ;g dk;Z oh-ch- MkWV usV fo.Mkst iQkWeZl ds SaveFileDialog dEiksus.V dh lgk;rk ls gksrk gSA SaveFileDialog ,d iwoZ dufiQxjM Mk;ykWx ckWDl gSA bldks tksM+dj vki vius ,Iyhds'ku esa Hkh ;wtj dks muds dk;ks± dks lqjf{kr djus dk fodYi miyC/ djk ldrs gSaA SaveFileDialog ds fofHkUu izkWiVhZ] esFkM rFkk bos.V dks vkxs ds [k.Mks esa fn[kk;k x;k gSA

lso iQkby Mk;ykWx ds izkWiVhZ (Properties of SaveFileDialog) bl [k.M esa oh-ch- MkWV usV ds lso iQkby Mk;ykWx ds izkWiVhZ ds ckjs esa tkurs gSaA buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt fo.Mks ds ekè;e ls lsV dj ldrs gSaA rFkk dqN tks izkWiVhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSaA ;|fi lHkh izkWiVhZ dks izksxzke ds ekè;e ls dksM fy[k dj lsV fd;k tk ldrk gSA

7.26.1

izkWiVhZ AddExtension

CheckPathExists DefaultExt DereferenceLinks

FileName FileNames Filter

FilterIndex InitialDirectory RestoreDirectory ShowHelp Title ValidateNames Create Prompt

230

fooj.k ;wtj ;fn iQkby ds uke dk foLrkjd u ns rks Mk;ykWx ckWDl bls Lor% iQkby ds uke esa tksM+s vFkok ugha blds fy, eku dks lsV djrk gSA ;wtj }kjk ,slk ikFk nsus ij tks fo|eku u gks Mk;ykWx ckWDl dksbZ psrkouh fMLIys djs vFkok u djs blds fy, eku dks lsV djrk gSA iQkby ds uke dk fMiQkWYV foLrkjd lsV djrk gSA ml eku dks lsV djrk gS tks ;g crkrk gS fd Mk;ykWx ckWDl 'kkWVdV ds }kjk jsizsQUl fd;s x;s iQkby ds yksds'ku dks okfil djs ;k fiQj ;g 'kkWVdV ds yksds'ku (.lnk) dks ykSVk,A iQkby Mk;ykWx ckWDl esa p;fur iQkby uke dks lsV djrk gSA Mk;ykWx ckWDl esa lHkh p;fur iQkbyksa ds uke dks ykSVkrk gSA Mk;ykWx ckWDl esa Save as file type vFkok Files of type ckWDl esa izdV gksus okys fodYiksa dks fu/kZfjr djus okys orZeku iQkby uke ds fiQYVj fLVªax dks lsV djrk gSA iQkby Mk;ykWx ckWDl esa p;fur orZeku fiQYVj ds baMsDl dks lsV djrk gSA iQkby Mk;ykWx ckWDl }kjk fMLIys fd;k tkus okyk izkjfEHkd (initial) Mk;jsDVªh dks lsV djrk gSA Mk;ykWx ckWDl can gksus ls igys orZeku Mk;jsDVªh dks fjLVksj djs vFkok u djs blds fy, eku lsV djrk gSA iQkby Mk;ykWx ckWDl esa Help cVu fMLIys gks vFkok u gks blds fy, eku dks lsV djrk gSA iQkby Mk;ykWx ckWDl ds 'kh"kZd dks lsV djrk gSA Mk;ykWx ckWDl dsoy ekU; Win32 iQkby ukeksa dks gh Lohdkj djs vFkok ugha blds fy, eku dks lsV djrk gSA mi;ksxdÙkkZ tc fdlh iQkby dks lso djus ds fy, Save As Mk;ykWx ckWDl ds Save cVu dks fDyd djrk gS rks ,d Mk;ykWx vkSj izdV gksrk gS tks ;wtj dks ml iQkby dks lso djus ds fy, dgrk gSA ;fn vki pkgsa rks No fDyd dj lsfoax dks jí dj ldrs gSa ;k fiQj Yes fDyd dj iQkby dks lqjf{r dj ldrs gSaA bl izkWiVhZ ds ekè;e ls ;g lsV fd;k tkrk gS fd og Mk;ykWx izdV gks vFkok ughaA vxj vki ,slk Mk;ykWx ugha pkgrs gSa rks False lsV djsaA


OverWritePrompt

mi;ksxdÙkkZ }kjk ,slk uke Li"V djus ij tks igys ls fo|eku gks Mk;ykWx psrkouh iznf'kZr djrk gSA bl izkWiVhZ ds ekè;e ls vki ;g lsV dj ldrs gSa fd og Mk;ykWx ckWDl izdV gks vFkok ughaA

7.26.2 lso iQkby Mk;ykWx ds esFkM (Methods of SaveFileDialog)

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

bl [k.M esa ge lso iQkby Mk;ykWx ds eq[; esFkM dh ppkZ dj jgs gSaA esFkM OpenFile Reset

fooj.k ;wtj }kjk p;fur iQkby dks jhM@jkbV vf/dkj ds lkFk [kksyrk gSA Mk;ykWx ckWDl ds lHkh fodYiksa dks muds fMiQkWYV ekuksa ds lkFk nksckjk lsV djrk gSA

7.27 iQkW.V Mk;ykWx ckWDl (FontDialog Box) fo.Mkst ,Iyhds'ku dh rjg gh oh-ch- MkWV usV esa vkids ,fIyds'ku esa iQkW.V Mk;ykWx tksM+us gsrq FontDialog dEiksusUV miyC/ djkrk gSA FontDialog dEiksusUV ,d fiz&dufiQxzM Mk;ykWx ckWDl gS] ftldk mi;ksx flLVe ij baLVkWy fd;s x;s iQkW.V dks ,Dlsl djus ds fy, gksrk gSA iQkW.V Mk;ykWx dks fMLIys djus ds fy, ShowDialog esFkM dk iz;ksx gksrk gSA 7.27.1 iQkW.V Mk;ykWx ds izkWiVhZ (Properties of FontDialog)

bl [k.M esa oh-ch- MkWV usV ds iQkW.V Mk;ykWx ds izkWiVhZ ds ckjs esa tkurs gSaA buesa dqN izkWiVhZ ,sls gSa tks vki fMtk;u le; esa izkWiVhZt fo.Mks ds ekè;e ls lsV dj ldrs gSaA rFkk dqN tks izkWiVhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSaA ;|fi lHkh izkWiVhZ dks izksxzke ds ekè;e ls dksM fy[k dj lsV fd;k tk ldrk gSA izkWiVhZ AllowScriptChange

AllowSimulations

AllowVectorFonts AllowVerticalFonts

Color FixedPitchOnly Font FontMustExist

MaxSize MinSize

fooj.k ;wtj Script dkWEcks ckWDl esa Li"V dSjsDVj lsV dks cnydj dksbZ vU; dSjsDVj lsV fMLIys dj ldrk gS vFkok ugha blds fy, eku dks lsV djrk gSA Mk;ykWx ckWDl xzkfiQDl fMokbl baVjisQl iQkW.V flE;wys'ku~l (graphics device interface font simulations) dh vuqefr ns ;k ugha] dks lsV djrk gS ;k mlds ckjs esa crkrk gSA Mk;ykWx ckWDl osDVj iQkW.V p;u (vector font selections) dh vuqefr ns ;k u] dks lsV djrk gS ;k mlds ckjs esa crkrk gSA Mk;ykWx ckWDl mnxz rFkk {kSfrt nksukas iQkW.V dks iznf'kZr djs ; dsoy {kSfrt iQkW.V~l dks fMLIys djs ;g Li"V djrk gS ;k fiQj mlds ckjs esa crkrk gSA p;fur iQkW.V jax dks lsV djrk gS ;k mlds ckjs esa crkrk gSA Mk;ykWx ckWDl fiQDlM fip (Fixed pitch) iQkW.V ds p;u dh dsoy vuqefr ns ;k u n dks lsV djrk gS ;k fiQj mlds ckjs esa crkrk gSA p;fur iQkW.V dks lsV djrk gS ;k mlds ckjs esa crkrk gSA mi;ksxdÙkkZ }kjk ,sls iQkW.V ;k LVkby dks p;u djus ij tks fo|eku u gks Mk;ykWx ckWDl ,jj dafM'ku Li"V djs ;k u djs bl dks lsV djrk gS ;k mlds ckjs esa crkrk gSA ;wtj }kjk p;u fd;s tkus okys vf/dre Iokb.V lkbt dks lsV djrk gS ;k mlds ckjs esa crkrk gSA ;wtj }kjk p;u fd;s tkus okys U;wure Iokb.V lkbt dks lsV djrk gS ;k mlds ckjs esa crkrk gSA

231


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

ScriptsOnly

ShowApply ShowColor ShowEffects

ShowHelp

Mk;ykWx ckWDl lHkh ukWu vks- b- ,e- (Non-OEM) rFkk LVS.MMZ dSjsDVj lsV ds lkFk ,sulh dSjsDVj lsV (ANSI Character Set) ds fy, iQkW.V ds p;u dh vuqefr ns vFkok ugha blds fy, eku dks lsV djrk gSA Mk;ykWx ckWDl ij Apply cVu gks ;k u gks dks lsV djrk gS ;k mlds ckjs esa crkrk gSA Mk;ykWx ckWDl dyj fodYi dks iznf'kZr djs ;k u djs ;g lsV djrk gS ;k mlds ckjs esa crkrk gSA Mk;ykWx ckWDl ij LVªkbdFkzw (strikethrough)] vaMjykbu rFkk VsDLV jax fodYiksa ds fy, daVªksy gks ;k u gks dks lsV djrk gS] ;k mlds ckjs esa crkrk gSA Mk;ykWx ckWDl lgk;rk cVu iznf'kZr djs ;k u djs dks lsV djrk gS ;k mlds ckjs esa crkrk gSA

7.27.2 iQkW.V Mk;ykWx ds esFkM (Methods of FontDialog)

bl [k.M esa ge iQkW.V Mk;ykWx dEiksus.V ds esFkM dh ppkZ dj jgs gSaA esFkM fooj.k Reset lHkh Mk;ykWx fodYiksa dks muds fMiQkWYV ekuksa ds lkFk lsV djrk gSA ShowDialog Mk;ykWx fn[kkrk gSA 7.27.3 iQkW.VMk;ykWx ds bos.V (Events of FontDialog)

bl [k.M esa ge iQkW.V Mk;ykWx dEiksus.V ds bos.V dh ppkZ djsaxsA bos.V Apply HelpRequest

fooj.k mi;ksxdÙkkZ ds }kjk iQkW.V Mk;ykWx ckWDl ij Apply cVu dks fDyd djus ij ?kfVr gksrk gSA ;wtj ds }kjk Help cVu dks fDyd djus ij ?kfVr gksrk gSA

ySc vH;kl 7.11 (Lab Exercise 7.11) ,d ,Iyhds'ku cuk;sa ftlesa Format esU;w ds vanj Font lc&esU;w gks rFkk jhp VsDLV ckWDl esa fy[ks tkus okys VsDLV ds iQkW.V dk p;u gks ldsA bldk izkWiVhZ rFkk baVjisQl bl izdkj gksxk& vkWCtsDV izkWiVhZ eku iQkWeZ Name Form1 jhp VsDLV ckWDl esU;wfLVªi esU;w-1 esU;w-2 iQkW.V Mk;ykWx 232

Text

Form1

Name

rchTxt

Dock

Fill

Name

MenuStrip1

Name

mnuFormat

Text

Format

Name

mnuFont

Text

Font

Name

dlgFont


GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

fp=k LA7.28 : ySc vH;kl 7.11 dk baVjisQl lek/ku % ➪ File esU;w dks fDyd djsa rFkk New Project dk p;u djsaA ➪ New Project Mk;ykWx ckWDl [kqyus ds i'pkr Templates isu esa Windows Application dks fDyd djsaA ➪ Name VsDLVckWDl esa Lab Exercise 7.11 Vkbi djsa rFkk OK dks fDyd djsa A mlds ckn ,d u;k fo.Mkst iQkWeZl izkstsDV [kqysxkA ➪ lcls igys VwyckWDl ij Menus & Toolbars ds varxZr MenuStrip dEiksus.V dks nks ckj fDyd djsa rFkk blesa Format eq[; esU;w rFkk muds vanj Font mi esU;w tksM+saA Format ds Name izkWiVhZ esa mnuFormat lsV djsa rFkk Font ds Name izkWiVhZ esa mnuFont lsV djsaA ➪ mlds ckn RichTextBox daVªksy dks nks ckj fDyd djsa rFkk blds Name izkWiVhZ dks rchText lsV djsa rFkk Dock izkWiVhZ dks Fill lsV djsaA ➪ mlds ckn VwyckWDl ij Dialogs ds varxZr FontDialog dks nks ckj fDyd dj bls dEiksus.Vl Vªs esa tksM+saA rFkk bldks p;u djds izkWiVhZt fo.Mks esa bldk Name izkWiVhZ dlgFont lsV djsaA ➪ vc fMtk;u iwjk gqvkA blds ckn vkids ,fIyds'ku dk baVjisQl fp=k LA7.28 dh Hkk¡fr fn[kuk pkfg,A ➪ vc Format esU;w ds vanj Font dks nks ckj fDyd djsa rFkk mnuFont_Click bos.V gs.Myj ds fy, ;g dksM fy[ksa& If dlgFont.ShowDialog <> Windows.Forms.DialogResult.Cancel Then rchText.Font = dlgFont.Font End If

➪ F5 nck,¡ rFkk izksxzke dks ju djk,¡A rFkk Format esU;w esa Font dks fDyd djsaA ifj.kkeLo:i Font Mk;ykWx ckWDl fp=k LA7.29 dh Hkk¡fr fn[ksxkA

233


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

fp=k LA7.29 : ifj.kke esa Font Mk;ykWx dks n'kkZrs gq, 7.28 dyj Mk;ykWx ckWDl (Color Dialog Box) vU; Mk;ykWx ckWDl dh rjg gh vki vius ,Iyhds'ku esa dyj Mk;ykWx ckWDl tksM+ ldrs gSaA ;g ,slk gh Mk;ykWx ckWDl gS tks vki fdlh Hkh fo.Mkst vk/kfjr ,Iyhds'ku esa mi;ksx djrs gSaA oh- ch- MkWV usV esa bl Mk;ykWx dks vius ,Iyhds'ku esa tksM+us ds fy, ColorDialog dEiksusUV dk mi;ksx djuk gksrk gSA ColorDialog ,d fiz&duiQhxzM Mk;ykWx ckWDl gS tks mi;ksxdrkZ dks mlds ,Iyhds'ku ds fy, jaxksa ds pquko dh vuqefr nsrk gSA ;g ,d rS;kj dEiksusUV gS ftldh lgk;rk ls vki dqN ykbu ds dksM tksM+dj ,Iyhds'ku esa iQkW.V Mk;ykWx miyC/ djk ldrs gSaA ;fn vki ;gh Mk;ykWx ckWDl Lo;a cukrs gSa rks vkidks cgqr lkjh ykbuksa ds dksM fy[kus iM+saxsA 7.28.1 dyj Mk;ykWx ds izkWiVhZ (Properties of ColorDialog)

bl [k.M esa oh-ch- MkWV usV ds dyj Mk;ykWx ds izkiW VhZ ds ckjs esa tkurs gSAa buesa dqN izkiW VhZ ,sls gSa tks vki fMtk;u le; esa izkiW VhZt fo.Mks ds ekè;e ls lsV dj ldrs gSAa rFkk dqN tks izkiW VhZt fo.Mks esa izdV ugha gksrs gSa mUgsa ju le; esa dksM ds ekè;e ls lsV dj ldrs gSAa ;|fi lHkh izkiW VhZ dks izkxs kz e ds ekè;e ls dksM fy[k dj lsV fd;k tk ldrk gSA izkWiVhZ AllowFullOpen AnyColor Color CustomColors FullOpen ShowHelp SolidColorOnly 234

fooj.k mi;ksxdÙkkZ dLVe jaxkas dks ifjHkkf"kr djus ds fy, Mk;ykWx ckWDl dk mi;ksx djsa ;k u djsa dks lsV djrk gS ;k mlds ckjs esa crkrk gSA cqfu;knh jaxksa ds lsV esa lHkh miyC/ jaxksa dks Mk;ykWx ckWDl iznf'kZr djs ;k u djsa dks lsV djrk gS ;k mlds ckjs esa crkrk gSA mi;ksxdÙkkZ }kjk p;fur jax dks lsV djrk gS ;k mlds ckjs esa crkrk gSA Mk;ykWx ckWDl esa fn[kk;s x;s dLVe jaxksa ds leqPp; dks lsV djrk gS ;k mlds ckjs esa crkrk gSA Mk;ykWx ckWDl ds [kqyus ij dLVe jaxksa ds fuekZ.k esa mi;ksx gksus okys daVªksy n`'; gks ;k u gksa dks lsV djrk gS ;k mlds ckjs esa crkrk gSA dyj Mk;ykWx ckWDl ij gsYi cVu fn[ks ;k u fn[ks dks lsV djrk gS ;k mlds ckjs esa crkrk gSA Mk;ykWx ckWDl ls mi;ksxdÙkkZ dsoy Bksl jaxksa dk gh p;u dj ldrk gS vFkok vU; jaxksa dks Hkh blds eku dks lsV djrk gS ;k mlds ckjs esa crkrk gSA


7.28.2 dyjMk;ykWx ds esFkM (Methods of ColorDialog)

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~

bl [k.M esa ge dyj Mk;ykWx ds eq[; esFkM dh ppkZ djsaxsA esFkM Reset ShowDialog

fooj.k lHkh Mk;ykWx fodYiksa dks muds fMiQkWYV ekuksa ds lkFk lsV djuk gSA Mk;ykWx ckWDl dks fn[kkrk gSA

NOTES

7.28.3 dyjMk;ykWx ds bos.V (Events of ColorDialog)

bl [k.M esa ge dyjMk;ykWx ds eq[; bos.V dh ppkZ djsaxsA HelpRequest

mi;ksxdrkZ }kjk lgk;rk cVu dks fDyd djus ij ?kfVr gksrk gSA

ySc vH;kl 7.12 (Lab Exercise 7.12) ,d ,Iyhds'ku cuk;sa ftlesa Format esU;w ds vanj Font lc&esU;w gks rFkk jhp VsDLV ckWDl esa fy[ks tkus okys VsDLV ds iQkW.V dk p;u gks ldsA bldk izkWiVhZ rFkk baVjisQl bl izdkj gksxk& vkWCtsDV iQkWeZ jhp VsDLV ckWDl esU;wfLVªi esU;w-1 esU;w-2 dyj Mk;ykWx

izkWiVhZ

eku

Name Text Name Dock Name

Form1 Select The Color rchTxt Fill MenuStrip1

Name

mnuFormat

Name

mnuColor

Name

dlgColor

viuh izxfr dks tk¡psa 7. iSuy dUVªksy dk D;k mi;ksx gS\ 8. ListView dUVªksy D;k gS\ fp=k LA7.30 : ySc vH;kl 7.12 dk baVjisQl

235


izksxzkfeax fon fotqvy csfld MkWV usV NOTES

lek/ku % ➪ File esU;w dks fDyd djsa rFkk New Project dk p;u djsaA ➪ New Project Mk;ykWx ckWDl [kqyus ds i'pkr Templates isu esa Windows Application dks fDyd djsaA ➪ Name VsDLVckWDl esa Lab Exercise 7.12 Vkbi djsa rFkk OK dks fDyd djsa A mlds ckn ,d u;k fo.Mkst iQkWeZl izkstsDV [kqysxkA ➪ lcls igys VwyckWDl ij Menus & Toolbars ds varxZr MenuStrip dEiksus.V dks nks ckj fDyd djsa r Fkk blesa Format eq[; esU;w rFkk muds vanj Color miesU;w tksM+saA Format ds Name izkWiVhZ esa mnuFormat lsV djs rFkk Color ds Name izkWiVhZ esa mnuColor lsV djsaA ➪ mlds ckn RichTextBox daVªksy dks nks ckj fDyd djsa rFkk blds Name izkWiVhZ dks rchText lsV djsa rFkk Dock izkWiVhZ dks Fill lsV djsaA ➪ mlds ckn VwyckWDl ij Dialogs ds varxZr ColorDialog dks nks ckj fDyd dj bls dEiksus.Vl Vªs esa tksM+saA rFkk bldks p;u djds izkWiVhZt fo.Mks esa bldk Name izkWiVhZ dlgColor lsV djsaA ➪ vc fMtk;u iwjk gqvkA blds ckn vkids ,fIyds'ku dk baVjisQl fp=k LA7.30 dh Hkk¡fr fn[kuk pkfg,A ➪ vc Format esU;w ds vanj Color dks nks ckj fDyd djsa rFkk mnuColor_Click bos.V gs.Myj ds fy, ;g dksM fy[ksa& If dlgColor.ShowDialog <> Windows.Forms.DialogResult.Cancel Then rchText.ForeColor = dlgColor.Color End If

➪ F5 nck,¡ rFkk izksxzke dks ju djk,¡A rFkk Format esU;w esa Font dks fDyd djsaA ifj.kkeLo:i Color Mk;ykWx ckWDl fp=k LA7.31 dh Hkk¡fr fn[ksxkA

fp=k LA7.31 : ySc vH;kl 7.12 dk ifj.kke

lkjka'k (Summary) 236

fotqvy csfld ds lHkh vkWCtsDV ;Fkk iQkWeZ rFkk daVªksy ds vius izkWiVhZ] esFkM rFkk bos.V gksrs gSaA


● ●

● ●

● ● ●

● ●

izkWiVhZ fdlh vkWCtsDV ds iQhpj gksrs gSa rFkk esFkM muds dk;Z vkSj bos.V muds jsLikWUl gksrs gSaA VsDLVckWDl daVªksy dk mi;ksx iz;ksDrk ls MkVk izfo"V djokus ds vfrfjDr VsDLV fMLIys djokus esa Hkh gks ldrk gSA fjpVsDLVckWDl daVªksy dk mi;ksx iQkWjesfVax ds lkFk VsDLV dks fMLIys djus] izfo"V djus rFkk efuI;wysV djus esa gksrk gSA VsDLVckWDl rFkk fjpVsDLVckWDl ds chp ,d cgqr cM+k varj gksrk gSA VsDLVckWDl esa miyC/ iQkWjesV fodYi dsoy ,d gh iQkWjesV dks iwjs VsDLVckWDl ij ykxwdjrk gS tcfd fjpVsDLVckWDl esa ,d ls vf/d iQkWjesV dk mi;ksx fd;k tk ldrk gSA yscy daVªky s dk lkekU; mi;ksx fdlh daVªky s ds fy, o.kZukRed 'kh"kZd miyC/ djkuk gSA cVu dks lkekU;r% ekml dk iz;ksx djds fDyd fd;k tkrk gS ijUrq ;fn ;g iQksDlM gS rks bls ,.Vj dh nckdj Hkh fDyd fd;k tk ldrk gSA cVu daVªksy dh lgk;rk ls ;wtj fdlh fo'ks"k ,D'ku dks lEiUu djrk gSA fyLVckWDl daVªksy dh lgk;rk ls ge ,d gh rjg ds dbZ vo;oksa dks ,d lwph esa lwphc¼ djrs gSa rkfd mi;ksxdÙkkZ mugha vo;oksa ds lhfer fodYiksa esa ls p;u dj ldsA dkWEcksckWDl daVªksy VsDLVckWDl ds lkFk ,d fyLVckWDl dh Hkk¡fr gksrk gSA psdckWDl daVªksy dksbZ fo'ks"k dafM'ku vkWu ;k vkWiQ gS ;g crkus ds fy, mi;ksx gksrk gSA isuy ,d ,slk daVªksy gS tks vU; daVªksy dks j[krk gSA vki isuy dk mi;ksx djds daVªksy ds ladyu dks ,d txg bdV~Bk dj ldrs gSaA xzqickWDl daVªksy dk mi;ksx iQkWeZ ij daVªksy ds ladyu dks xzqi djus esa gksrk gSA fiDpjckWDl daVªksy dk mi;ksx iQkWeZ ij eupkgs fp=k dks tksM+us esa gksrk gSA LØkWyckj daVªksy dk iz;ksx vkbVeksa dh ,d yEch lwph ;k cM+h ek=kk esa lwpuk dks fdlh ,fIyds'ku ;k daVªksy ;Fkk isuy ds vanj {kSfrt ;k mnxz :i esa vklkuh ls usfoxsV djus esa gksrk gSA Vkbej og dEiksus.V gS tks ,d fu;fer varjky ij bos.V dks tkx`r djrk gSA fyLVO;w daVªksy dk mi;ksx dj vki vkbdu ds lkFk vkbVeksa dh lwph dks fMLIys dj ldrs gSaA fVªO;w daVªksy dh lgk;rk ls vki ;wtj ds fy, uksM dh gk;jSfdZ dks fMLIys dj ldrs gSAa Vwyckj daVªksy dk mi;ksx iQkWeZ ij ,d daVªksy ckj dh rjg gksrk gS tks ,d iafDr ls MªkWi Mkmu esU;w rFkk cVu dks fMLIys djrs gSa ftudk dk;Z lacaf/r dek.M dks ,fDVosV djuk gksrk gSA fotqvy LVwfM;ks MkWV usV 2005 esa LVsVlckj daVªksy ds cnys LVsVlfLVªi daVªksy dks yk;k x;k gS ijUrq LVsVlckj daVªksy dks cSdoMZ dEiSfVfcfyfV ds fy, j[kk x;k gSA bls Hkh vki mi;ksx dj ldrs gSaA fyadyscy daVªksy dk mi;ksx dj vki fo.Mkst iQkWeZ ,fIyds'ku ls gk;ijfyad dks tksM+dj best] vU; iQkWeZ ;k osclkbV fMLIys dj ldrs gSaA Mk;ykWx ckWDl dk mi;ksx ;wtj ds lkFk laokn djus vkSj mlls lwpuk okil ysus esa gksrk gSA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

237


izksxzkfeax fon fotqvy csfld MkWV usV

viuh izxfr ds mÙkj tk¡psa 1-

NOTES

BackgroundImage izkWiVhZ ls vki daVªksy ds cSdxzkm.M vkÑfr dks lsV dj ldrs gSaA cSdxzkm.M vkÑfr lsV djus ds fy, blds bfyifll cVu (...) dks fDyd djsaA rRi'pkr~ Select Resource Mk;ykWx ckWDl iznf'kZr gksxkA

vius gkMZfMLd ;k bl izkstsDV iQksYMj ds Resources iQksYMj ls fdlh iQkby dks tksM+us ds fy, Project resource file: ds vanj Import dks fDyd djsa vkSj vkd`fr iQkby dk p;u djsaA ,slk djus esa ;fn ;g iQkby vkids izkstsDV@lkWY;w'ku ds Resources iQksYMj esa rRdky miyC/ ugha gksxk rks Hkfo"; esa laxzfgr gks tk;sxkA ;g izkWiVhZ lHkh daVªksy ;Fkk TexBox, RichTextBox bR;kfn ds fy, miyC/ ugha gksrkA 2- Enabled izkWiVhZ daVªksy ds lfØ;rk ,oa fuf"Ø;rk dks lsV djrk gSA bldk ckbZ fMiQkWYV lsfVax True gksrk gSA ;fn ,slk gS rks blds lkFk dk;Z fd;k tk ldrk gSA ;fn ;g False gS rks ;g fuf"Ø; gS vkSj blds lkFk dk;Z ugha fd;k tk ldrk gSA 3- Text izkWiVhZ daVªksy ds dSI'ku (Caption) dks lsV djrk gSA mnkgj.kkFkZ yscy ij Nis VsDLV Label1 dks cnyus ds fy, bldk iz;ksx gksrk gSA blesa vki ,Dlsl dh lsV dj ldrs gSa ftlds lkFk ALT dh dks nckus ij og iQksdl gks tk;xkA blds fy, VsDLV izkWiVhZ ds eku ds ml v{kj ds igys & Vkbi djsa A ;g iQhpj vkidks dh&cksMZ ds lkFk dke djus dk foDyi nsrk gS A 4- ekbØkslkWÝV oMZ] uksViSM] oMZiSM ;k vU; fdlh oMZ izkslslj esa vkius dk;Z fd;k gksxkA vki bu lkWÝVos;j ds ftl {ks=k esa dqN fy[krs gSa og oLrqr% VsDLVckWDl gh gksrk gSA VsDLVckWDl dk mi;ksx iz;ksDrk ls MkVk izfo"V djokus ds fy, gksrk gSA blds vfrfjDr bldk iz;ksx VsDLV fMLIys djokus esa Hkh gks ldrk gS] tks fd dsoy iz;ksDrkvksa dks i<+us ds fy, gksrk gSA bl daVªksy ds lkFk Multiline] ScrollBars] ReadOnly ds vfrfjDr dbZ lkjh izkWiVhZ vkrs gSa] tks VsDLVckWDl ls dbZ dk;Z djokus esa mi;ksxh gksrs gSaA VsDLVckWDl esa VsDLV fy[kus ds fy, bldk Text izkWiVhZ gksrk gS ;|fi vki lkekU;r% dksfMax ds ekè;e ls gh rFkk lh/s&lh/s Hkh VsDLV fy[k ldrs gSaA 5-

esFkM BringToFront()

Hide() Show()

fooj.k Z-ozQe ds vkxs daVªksy dks ykrk gSA ;fn d.Vªksy fdlh vU; d.Vªksy dk pkbYM gS] rc og pkbYM dUVªksy Z Øe ds lcls vkxs izdV gksrk gSA BringToFront fdlh daVªksy dks 'kh"kZ Lrjh; daVªksy ugha cukrk gSA bl esFkM dks le>us ds fy;s ySc vH;kl 7.2 ns[ksaA cVu daVªksy dks iQkWeZ ij vn`'; cukrk gSA cVu daVªksy dks iQkWeZ ij n`'; cukrk gS ;fn cVu daVªksy vn`'; gSA

6- dkWEcks ckWDl dks lcls cf<;k rjhds ls ml VsDLVckWDl ds :i esa le>k tk ldrk gS ftlesa ,d lgk;d fyLV ckWDl tqM+k gks vFkkZr~ dkWEcks ckWDl fyLV ckWDl ls tqM+k gqvk ,d VsDLV ckWDl dh rjg gksrk gSA lkekU; VsDLV ckWDl esa ;wtj dks iwjk lwpuk ckWDl esa Vkbi djuk gksrk gSA dkWEcks ckWDl esa ;wtj ds ikl nks fodYi gksrs gSaA og lwpuk dks Vkbi dj ldrk gS ;k fiQj lgh lwpuk dks lwph ls p;u dj ldrk gSA p;u ds ckn og lwpuk dkWEcks ckWDl ds mQij izdV gksrk gSA dkWEcks ckWDl rhu izdkj ds Simple, DropDown rFkk DropDownList ds gksrs gSa tks blds DropDownStyle izkWiVhZ ds }kjk lsV fd;s tkrs gSaA

238

7- isuy ,d ,slk daVªky s gS tks vU; daVªky s dks j[krk gS A vki isuy dk iz;ksx djds daVªky s ds ladyu dks ,d txg bdV~Bk dj ldrs gS A mnkgj.k ds fy, vki dbZ jsfM;kscVu daVªky s dks iSuy dh lgk;rk ls xziq dj ldrs gSa A xziq ckWDl daVªky s dh gh rjg ;fn isuy daVªky s ds Enabled izkWiVhZ dks False lsV dj fn;k tk; rks bl ij j[ks x, lHkh daVªky s fuf"ozQ; gks tkrs gSAa


isuy daVªksy ckb fMiQkWYV cxSj ckWMZj ds fMLIys gksrs gSaA ijUrq blds BorderStyle izkWiVhZ dk iz;ksx djds vki blesa ckWMZj tksM+ ldrs gSa ftlls isuy daVªksy rFkk iQkWeZ ds 'ks"k Hkkx ds chp varj Li"V gks tkrk gS A isuy daVªksy esa vki pkgsa rks AutoScroll izkWiVhZ dk mi;ksx djds LozQkWyckj Hkh tksM+ ldrs gSa A isuy daVªksy dSI'ku fMLIys ugha djrk gS ;fn vki dSI'ku pkgrs gSa rks xzqickWDl daVªksy dk iz;ksx djsaA isuy daVªksy baVjiQsl fMtk;u djus esa Hkh lqfo/ktud gksrk gSA bl ij j[ks gq, lHkh daVªksy dks vki ,d lkFk ewo dj ldrs gSaA

GUI izksxzkfeax fon~

fo.Mks”k iQkWeZl~ NOTES

8- fyLVO;w daVªksy dk mi;ksx dj vki vkbdu ds lkFk vkbVeksa dh lwph dks fMLIys dj ldrs gSaA vki fyLVO;w dk iz;ksx fo.Mkst+ ,DlIyksjj ds nk;sa isu dh rjg ;wt+j baVjiQsl cukus esa dj ldrs gSaA bl daVªksy ds pkj O;w LargeIcon, SmalIIcon, List rFkk Details miyC/ gSaA LargeIcon eksM vkbVe VsDLV ds lkeus cM+s vkbdu dks fMLIys djrs gSaA daVªksy ds cgqr cM+s gksus ij vkbVe nks dkWye esa izdV gksrs gSa A SmallIcon eksM esa lc dqN LargeIcon eksM dh rjg gh gksrk gS dsoy blds vkbdu NksVs gksrs gSaA List eksM NksVs vkbdu gh iznf'kZr djrs gSa ijUrq ;g ges'kk ,d gh dkWye esa izdV gksrs gSaA Details eksM ,d ls vf/d dkWye esa vkbVe

dks izdV djrs gSaA blds vfrfjDr fo.Mkst+ ,Dl ih rFkk fo.Mkst+ lZoj 2003 ij ,d vkSj O;w Tile eksM esa miyC/ gksrk gSA

vH;kl (Exercise) 1- izkWiVhZ] esFkM rFkk bos.V dh O;k[;k dhft,A bldh O;k[;k okLrfod nqfu;k ds fdlh vkWCtsDV ;Fkk eksckby bR;kfn ds lanHkZ esa djsaA 2- VsDLVckWDl daVªksy ds ckjs esa le>k,¡A 3- VsDLVckWDl dks ikloMZ ckWDl esa cnyus ds fy, blds fdl izkWiVhZ dk mi;ksx gksrk gS \ 4- Multiline izkWiVhZ D;k djrk gS \ 5- fjpVsDLVckWDl daVªksy dh O;k[;k djsaA 6- VsDLVckWDl rFkk fjpVsDLVckWDl ds eè; nks lekurkvksa rFkk nks fofHkUurkvksa dk o.kZu djsaA 7- D;k fjpVsDLVckWDl dks ikloMZ ckWDl ds :i esa mi;ksx fd;k tk ldrk gS \ 8- yscy daVªksy dh baVjisQl fMtk;u esa D;k Hkwfedk gS \ 9- yscy daVªksy rFkk VsDLVckWDl esa rqyuk djsaA 10- D;k VsDLVckWDl ds cnys ;wtj buiqV ds fy, yscy dk mi;ksx fd;k tk ldrk gS \ 11- cVu daVªksy dh Hkwfedk dk o.kZu djsaA 12- cVu daVªksy ds fMiQkWYV bos.V dk uke crk,¡A 13- fyLVckWDl daVªksy ds dk;ksZa dk o.kZu djsaA 14- dkWEcksckWDl daVªksy ds dk;ksZa dks le>k,saA 15- fyLVckWDl rFkk dkWEcksckWDl ds chp ds varj dks Li"V djsaA 16- psdckWDl daVªksy ls vki iQkWeZ fMtk;u ls D;k lgk;rk izkIr dj ldrs gSa \ 17- isuy daVªksy D;k gS \ le>kb,A 18- xzqickWDl daVªksy dk o.kZu djsaA

239


izksxzkfeax fon fotqvy csfld MkWV usV

19- isuy rFkk xzqickWDl ds eè; lekurkvksa rFkk fo"kerkvksa dk o.kZu djsaA 20- fiDpjckWDl daVªksy dk o.kZu djsaA 21- LØkWyckj daVªksy dks le>k,¡A

NOTES

22- Vkbej daVªksy dh Hkwfedk dk o.kZu djsaA 23- fyLVO;w rFkk fVªO;w daVªksy dks le>k,¡A 24- Vwyckj daVªksy dh mi;ksfxrkvksa dk o.kZu djsaA 25- LVsVlfLVªi dk o.kZu djsaA 26- Mk;ykWx ckWDl dks le>k,¡A fuEufyf[kr Mk;ykWx ckWDl dks vius iQkWeZ ij esU;w dh lgk;rk ls dSls fMLIys djsaxs bldk o.kZu djsaA (i)

OpenFileDialog

(ii)

SaveFileDialog

(iii) FontDialog (iv) ColorDialog

240


Chapter 7