This print for content only-size & color not accurate 7" X 9-1/4" / casebound / malloy


Populating the Controls Collection



Download 21,46 Mb.
Pdf ko'rish
bet1808/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   1804   1805   1806   1807   1808   1809   1810   1811   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

Populating the Controls Collection

The System.Windows.Forms.Control base class (which is the inheritance chain of the Form type)

defines a property named Controls. This property wraps a custom collection nested in the Control

class named ControlsCollection. This collection (as the name suggests) references each UI element

maintained by the derived type. Like other containers, this type supports a number of methods to

insert, remove, and find a given UI widget (see Table 27-1).



Table 27-1. ControlCollection Members

Member

Meaning in Life

Add()


Used to insert a new Control-derived type (or array of types) in the collection

AddRange()

Clear()

Removes all entries in the collection

Count

Returns the number of items in the collection



GetEnumerator()

Returns the IEnumerator interface for this collection

Remove()

Used to remove a control from the collection

RemoveAt()

When you wish to populate the UI of a Form-derived type, you will typically follow a very pre-

dictable series of steps:

C H A P T E R   2 7  



P R O G R A M M I N G   W I T H   W I N D O W S   F O R M S



958

8849CH27.qxd  10/16/07  11:59 AM  Page 958




• Define a member variable of a given UI element within the Form derived class.

• Configure the look and feel of the UI element.

• Add the UI element to the form’s ControlsCollection container via a call to Controls.Add().

Assume you wish to update your MainWindow class to support a File ➤ Exit menu system. Here

are the relevant updates, with code analysis to follow:

class MainWindow : Form

{


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   1804   1805   1806   1807   1808   1809   1810   1811   ...   1830




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

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish