Thursday, October 21, 2010

C + + Builder Beginners Questions and Answers 9



9. Multi-page component

68) Q: I think C + + Builder component template management well, in the template by clicking the page you can switch between the various pages in C + + Builder in to achieve what should I do ?
A: We can be achieved with multi-page components, its benefits is that you can in a limited space to store as much information, and facilitate the information classified. Take for instance the template components, then the small screen in place of the hundreds of components, and does not look messy, which are multi-page component of the credit.
If the form you want to place a large number of components, and grouping these components is used, then consider using multi-page components. This would allow a more concise form.澶氶〉缁勪欢鏃㈡湁澶氶〉鐨勭壒鎬э紝鍙堟槸涓?釜瀹瑰櫒缁勪欢锛屽畠灏卞儚绐椾綋涓?牱鍙互鍖呭惈鍏朵粬鐨勭粍浠躲?

C + + Builder provides several features similar to multi-page components, which are: Win32 page in the TabControl, PageControl components, Win31 page TabSet and TabbedNoteBook components. From their different page where you can know that the first two components are used in 32-bit system components, in terms of performance and style, the two components are more suitable for Windows 95 and above board in this used. Last two components is the favorite Windows 3.1-style user reservations, in fact, we can only use the first two components.

69) Q: TabControl component and PageControl components they simply look exactly the same?
A: At first glance, these two components almost certainly, we can operate below illustrates this point.
(1) in the form to place these two components, by modifying the Height and Width properties set them the same size.
锛?锛夊湪瀵硅薄缂栬緫鍣ㄤ腑锛屽崟鍑籘abControl鐨勫睘鎬abs涓殑鐪佺暐鍙锋寜閽紝杩欐椂浼氬脊鍑轰竴涓瓧绗︿覆缂栬緫鍣ㄣ?鍦ㄨ繖涓紪杈戝櫒涓垎涓夎杈撳叆绗竴椤碉紝绗簩椤靛拰绗笁椤点? Then click the OK button.
锛?锛夊湪绐椾綋涓?鍙朠ageControl缁勪欢锛岀敤榧犳爣鍙抽敭鍗曞嚮璇ョ粍浠讹紝鍦ㄥ脊鍑虹殑蹇嵎鑿滃崟涓?鎷㎞ewPage鍛戒护锛孭ageControl缁勪欢灏嗙敓鎴愪竴涓己鐪佸悕涓衡?TabSheetN鈥濈殑椤碉紝鍏朵腑N鏄粠1寮?鐨勬暣鏁般? New Page command to run the first time the page generated named TabSheet1, called the second generation TabSheet2, and so on. We use this command to generate three pages.
The difference is that with the TabControl component, you can click the page to switch between pages. Click the page to switch pages as well as in selected components of the PageControl. If you want to select a page, you can first click the page to switch to the page, then click the page on it.

锛?锛夊湪瀵硅薄缂栬緫鍣ㄤ腑锛岄?鎷㏕abSheet1锛孴abSheet2鍜孴abSheet3鐨凜aption灞炴?锛屾妸瀹冨垎鍒慨鏀逛负绗竴椤碉紝绗簩椤靛拰绗笁椤点?
They look exactly the same way.




70锛?闂細浣嗚鏄竴鏍凤紝涓轰粈涔堟湁涓や釜涓嶅悓鐨勭粍浠跺憿锛岀敤涓?釜涓嶅氨琛屼簡锛屽ソ璞′粬浠苟涓嶇湡鐨勫畬鍏ㄤ竴鏍凤紵
绛旓細浣犺鐨勫锛屽崈涓囦笉瑕佽浠栦滑鐨勫琛ㄥ亣璞℃墍钂欒斀锛屽疄闄呬笂瀹冧滑骞朵笉涓?牱銆俆abControl鏄竴绉嶁?鍋団?澶氶〉缁勪欢锛岃?PageControl鎵嶆槸鈥滅湡鈥濆椤电粍浠躲?
鎴戜滑鐭ラ亾澶氶〉缁勪欢鎶婃墍瑕佹樉绀虹殑淇℃伅鏀惧湪涓嶅悓鐨勯〉涓紝瀹為檯涓婃瘡涓〉閮芥槸涓?釜绐椾綋锛屽苟鍙互閫氳繃椤垫潵杩涜椤电殑鍒囨崲銆?TabControl component although there are multiple pages, but in reality there is only one page template, that is, every time the user click the page, the page of repetitive page template updated, in order to respond to the user's choice.
Obviously, if you need to display each page different components, then certainly not qualified for such work TabControl. Because every time you change page, you must update the page with the code template, which in C + + Builder is not a good idea.濡傛灉姣忎釜椤垫墍鏄剧ず鐨勭粍浠剁浉鍚屽彧鏄唴瀹规湁鍙樺寲锛岄偅涔堜娇鐢═abControl浼氭洿鍔犲悎閫傦紝鍥犱负瀹冩秷鑰楃殑绯荤粺璧勬簮姣旇緝灏戙?
鑰孭ageControl鍒欐槸姣忛〉瀵瑰簲涓?釜椤垫ā鏉裤? Therefore, it is appropriate to different situations in each page.

71) Q: TabControl component which common property?
绛旓細HotTrack灞炴?鐢ㄦ潵纭畾褰撻紶鏍囨寚鍚戦〉鏃讹紝椤典笂鐨勬爣绛炬槸鍚﹁嚜鍔ㄨ鍔犱寒鏄剧ず銆?The default is False.
MultiLine property to determine when the page is displayed when the line shows no less than to the next line.缂虹渷鍊糉alse琛ㄧず鍦ㄤ竴琛屾棤娉曟樉绀哄畬鏃讹紝鍦ㄨ鐨勫彸杈硅嚜鍔ㄥ嚭鐜颁竴涓弻鍚戠澶达紝鍙互鐢ㄦ潵绉诲姩椤点?
TabHeight property used to set the page height. The default value of 0 indicates a high degree of page will automatically adapt to the height of the text page.
TabWidth灞炴?鐢ㄦ潵璁剧疆椤电殑瀹藉害銆?The default value of 0 indicates the width of the page will automatically adapt to the width of the text page.
TabPosition灞炴?涓簍pTop鏃讹紝琛ㄧず灏嗛〉鏀惧湪TabControl缁勪欢鐨勪笂闈紝涓簍pBottom鏃跺垯琛ㄧず鏀惧湪涓嬮潰銆?br />TabControl缁勪欢涓婄殑姣忎竴涓〉閮芥湁鑷繁鐨勭储寮曪紝鏈?乏杈圭殑椤电殑绱㈠紩涓?锛岀揣鎺ョ潃鐨勯〉鐨勭储寮曚负1锛屼互姝ょ被鎺ㄣ?TabIndex灞炴?杩斿洖褰撳墠琚寜涓嬬殑椤点?
Tabs property used to set the page number and title, in the design is to use a string editor to achieve.

72) Q: TabControl control which of the more important events?
A: TabControl has two more important events OnChange and OnChanging. Whenever the page is selected OnChange event occurs after this time can determine which pages TabIndex property is selected, and then respond to the action taken.
OnChanging incident occurred just before the page is selected, that is just a page before switching to another page. This event allows us to switch the page to take certain actions before, for example, not set in until certain conditions are not allowed to leave this page.
In fact, before these two events we have studied in detail, not illustrated here.

73) Q: PageControl component seems more powerful than the TabControl component, which is how to use it?
A: Compared with the TabControl, PageControl indeed more powerful component features, but not complicated. PageControl涓殑姣忎竴涓〉閮芥槸涓?釜TTabSheet缁勪欢锛岃繖涓粍浠跺疄闄呬笂鏄竴涓鍣紝浣犲彲浠ュ湪涓婇潰鏀剧疆鍚勭鎺т欢銆?Each TTabSheet component has its own attributes.
瀹為檯涓婅繖閲屾湁涓ゅ眰鍏崇郴銆傛渶椤跺眰鐨勬槸PageControl缁勪欢锛屽畠璐熻矗绠$悊澶氫釜TTabSheet缁勪欢锛岃?姣忎釜TTabSheet缁勪欢涔熺鐞嗙潃鏀惧湪瀹冧笂闈㈢殑缁勪欢銆?br />
74) Q: PageControl more important components of the property which it?
A: ActivePage This attribute displays the current page is selected, it can also be used to switch the page.
MultiLine property to determine when the page is displayed when the line shows no less than to the next line.缂虹渷鍊糉alse琛ㄧず鍦ㄤ竴琛屾棤娉曟樉绀哄畬鏃讹紝鍦ㄨ鐨勫彸杈硅嚜鍔ㄥ嚭鐜颁竴涓弻鍚戠澶达紝鍙互鐢ㄦ潵绉诲姩椤点? The default is False.
TabHeight property used to set the page height. The default value of 0 indicates a high degree of page will automatically adapt to the height of the text page.
TabWidth灞炴?鐢ㄦ潵璁剧疆椤电殑瀹藉害銆?The default value of 0 indicates the width of the page will automatically adapt to the width of the text page.
TabPosition this property is tpTop, the page will be placed on top of TabControl component, while for the tpBottom will be shown below.
In addition, run-time state property:
Pages杩欎釜鍙灞炴?鏄疨ageControl缁勪欢涓婃墍鏈夌殑椤电粍鎴愮殑鏁扮粍銆?br />PageCount杩欎釜灞炴?杩斿洖PageControl缁勪欢涓婄殑椤垫暟銆?br />
75锛?闂細 PageControl鐨勬瘡涓?〉閮芥槸涓?釜TTabSheet缁勪欢锛岄偅TTabSheet鏈変簺浠?箞灞炴?鍛紵
绛旓細TabVisible 杩欎釜灞炴?鐢ㄦ潵灞忚斀鏌愪竴椤电殑鏄剧ず銆備篃璇存槸璇达紝瀹冪殑鍊间负False鐨勬椂鍊橮ageControl缁勪欢灏嗕笉鏄剧ず杩欎釜椤典簡锛屼絾鏄繖涓〉杩樺瓨鍦紝浣犺繕鍙互鎶婅繖涓睘鎬ц缃负True鏉ユ仮澶嶅畠鐨勬樉绀恒?鍦ㄧ▼搴忚繍琛屾湡闂翠笉鑳藉垹闄ら〉锛屽彧鑳藉睆钄介〉鐨勬樉绀恒?
PageIndex鏄〉鐨勭储寮曞彿锛?br />姝ゅ锛岃繕鏈夎繍琛屾椂鎬佸睘鎬с?
PageControl灞炴?杩斿洖璇ラ〉鎵?湪鐨凱ageControl缁勪欢銆?br />TabIndex灞炴?杩斿洖璇ラ〉鍦ㄦ墍鏈夊彲瑙侀〉涓殑绱㈠紩鍙枫?
鍥犱负鍦ㄧ▼搴忚繍琛屾椂鏄笉鑳藉垹闄ら〉鐨勶紝鎵?互PageIndex绱㈠紩鍙锋槸鍥哄畾涓嶅彉鐨勩?浣嗘槸椤靛彲浠ヨ灞忚斀锛屽綋娌℃湁椤佃灞忚斀鏃讹紝TabIndex涓嶱ageIndex瀹屽叏鐩稿悓锛涘綋鏈夐〉琚睆钄芥椂锛孴abIndex灏变笌PageIndex灏变笉鍚屼簡銆俆abIndex鏄繖涓?〉鍦ㄦ墍鏈夊彲瑙侀〉涓殑绱㈠紩鍙凤紝涔熷氨鏄锛岀涓?釜鍙椤电殑TabIndex鏄?锛岀浜屼釜鍙椤电殑TabIndex鏄?锛屼互姝ょ被鎺ㄣ?

76锛?闂細鑳借璁′竴涓緥瀛愯鎴戞洿濂界殑鐞嗚В涓?笅瀹冧滑鍚楋紵
绛旓細濂界殑 锛岄鍏堝湪TabControl缁勪欢鐨勯〉闈笂鏀剧疆涓?釜缂栬緫妗嗙粍浠躲?
鐒跺悗鍦≒ageControl缁勪欢鐨凾ab1椤典腑鏀剧疆涓?釜缂栬緫妗嗙粍浠躲?
鎺ョ潃灏哖ageControl缁勪欢鍒囨崲鍒癟ab2椤碉紝鏀剧疆涓?釜鏂囨湰缂栬緫妗嗙粍浠躲?
鏈?悗锛岀紪璇戝苟杩愯杩欎釜绋嬪簭銆?br />鐐瑰嚮tabControl缁勪欢鐨則ab1鍒皌ab3鏍囩锛屽彲浠ョ湅鍑猴紝缂栬緫妗嗗嚭鐜板湪缁勪欢鐨勬瘡涓?〉涓?
鐐瑰嚮PageControl缁勪欢鐨則ab1鍒皌ab3鏍囩锛屽彲浠ョ湅鍑猴紝姣忎竴椤电粍浠堕兘涓嶇浉鍚屻?







相关链接:



Shinco GPS Navigation Map Of Hong Kong And Macao Version Available



Customer is not his wife is a lover of God is



Environmental Regeneration Of Computer Donations To Needy Students



M2TS to MOV



Picked Flash TOOLS



EVALUATION System Utilities



Comment E-Mail Clients



Yuan Meng: Ubuntu 9.10 new version of the debut



Shorewall simply SET the single-user



ASF To MPEG



Symantec said the new storm worm detected



Photoshop Save Format



creating a user Defined function in excel using



MKV To DivX



No comments:

Post a Comment