六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

VC++之Button控件

[摘要]按鈕窗口(控件)在MFC中使用CButton表示,CButton包含了三種樣式的按鈕,Push Button,Check Box,Radio Box。所以在利用CButton對象生成按鈕窗口時需要指...
按鈕窗口(控件)在MFC中使用CButton表示,CButton包含了三種樣式的按鈕,Push Button,Check Box,Radio Box。所以在利用CButton對象生成按鈕窗口時需要指明按鈕的風格。
創建按鈕:BOOL CButton::Create( LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );其中lpszCaption是按鈕上顯示的文字,dwStyle為按鈕風格,除了Windows風格可以使用外(如WS_CHILD WS_VISUBLE WS_BORDER)還有按鈕專用的一些風格。

BS_AUTOCHECKBOX 檢查框,按鈕的狀態會自動改變   Same as a check box, except that a check mark appears in the check box when the user selects the box; the check mark disappears the next time the user selects the box.

BS_AUTORADIOBUTTON 圓形選擇按鈕,按鈕的狀態會自動改變   Same as a radio button, except that when the user selects it, the button automatically highlights itself and removes the selection from any other radio buttons with the same style in the same group.

BS_AUTO3STATE 允許按鈕有三種狀態即:選中,未選中,未定   Same as a three-state check box, except that the box changes its state when the user selects it.

BS_CHECKBOX 檢查框   Creates a small square that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style).

BS_DEFPUSHBUTTON 默認普通按鈕   Creates a button that has a heavy black border. The user can select this button by pressing the ENTER key. This style enables the user to quickly select the most likely option (the default option).

BS_LEFTTEXT 左對齊文字   When combined with a radio-button or check-box style, the text appears on the left side of the radio button or check box.

BS_OWNERDRAW 自繪按鈕   Creates an owner-drawn button. The framework calls the DrawItem member function when a visual aspect of the button has changed. This style must be set when using the CBitmapButton class.

BS_PUSHBUTTON 普通按鈕   Creates a pushbutton that posts a WM_COMMAND message to the owner window when the user selects the button.

BS_RADIOBUTTON 圓形選擇按鈕   Creates a small circle that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style). Radio buttons are usually used in groups of related but mutually exclusive choices.

BS_3STATE 允許按鈕有三種狀態即:選中,未選中,未定   Same as a check box, except that the box can be dimmed as well as checked. The dimmed state typically is used to show that a check box has been disabled.
rect為窗口所占據的矩形區域,pParentWnd為父窗口指針,nID為該窗口的ID值。

獲取/改變按鈕狀態:對于檢查按鈕和圓形按鈕可能有兩種狀態,選中和未選中,如果設置了BS_3STATE或BS_AUTO3STATE風格就可能出現第三種狀態:未定,這時按鈕顯示灰色。通過調用int CButton::GetCheck( ) 得到當前是否被選中,返回0:未選中,1:選中,2:未定。調用void CButton::SetCheck( int nCheck );設置當前選中狀態。

處理按鈕消息:要處理按鈕消息需要在父窗口中進行消息映射,映射宏為ON_BN_CLICKED( id, memberFxn )id為按鈕的ID值,就是創建時指定的nID值。處理函數原型為afx_msg void memberFxn( );

按鈕窗口(控件)在MFC中使用CButton表示,CButton包含了三種樣式的按鈕,Push Button,Check Box,Radio Box。所以在利用CButton對象生成按鈕窗口時需要指明按鈕的風格。

創建按鈕:BOOL CButton::Create( LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );其中lpszCaption是按鈕上顯示的文字,dwStyle為按鈕風格,除了Windows風格可以使用外(如WS_CHILD WS_VISUBLE WS_BORDER)還有按鈕專用的一些風格。
BS_AUTOCHECKBOX 檢查框,按鈕的狀態會自動改變   Same as a check box, except that a check mark appears in the check box when the user selects the box; the check mark disappears the next time the user selects the box.

BS_AUTORADIOBUTTON 圓形選擇按鈕,按鈕的狀態會自動改變   Same as a radio button, except that when the user selects it, the button automatically highlights itself and removes the selection from any other radio buttons with the same style in the same group.

BS_AUTO3STATE 允許按鈕有三種狀態即:選中,未選中,未定   Same as a three-state check box, except that the box changes its state when the user selects it.

BS_CHECKBOX 檢查框   Creates a small square that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style).

BS_DEFPUSHBUTTON 默認普通按鈕   Creates a button that has a heavy black border. The user can select this button by pressing the ENTER key. This style enables the user to quickly select the most likely option (the default option).

BS_LEFTTEXT 左對齊文字   When combined with a radio-button or check-box style, the text appears on the left side of the radio button or check box.

BS_OWNERDRAW 自繪按鈕   Creates an owner-drawn button. The framework calls the DrawItem member function when a visual aspect of the button has changed. This style must be set when using the CBitmapButton class.

BS_PUSHBUTTON 普通按鈕   Creates a pushbutton that posts a WM_COMMAND message to the owner window when the user selects the button.

BS_RADIOBUTTON 圓形選擇按鈕   Creates a small circle that has text displayed to its right (unless this style is combined with the BS_LEFTTEXT style). Radio buttons are usually used in groups of related but mutually exclusive choices.

BS_3STATE 允許按鈕有三種狀態即:選中,未選中,未定   Same as a check box, except that the box can be dimmed as well as checked. The dimmed state typically is used to show that a check box has been disabled.
rect為窗口所占據的矩形區域,pParentWnd為父窗口指針,nID為該窗口的ID值。

獲取/改變按鈕狀態:對于檢查按鈕和圓形按鈕可能有兩種狀態,選中和未選中,如果設置了BS_3STATE或BS_AUTO3STATE風格就可能出現第三種狀態:未定,這時按鈕顯示灰色。通過調用int CButton::GetCheck( ) 得到當前是否被選中,返回0:未選中,1:選中,2:未定。調用void CButton::SetCheck( int nCheck );設置當前選中狀態。

處理按鈕消息:要處理按鈕消息需要在父窗口中進行消息映射,映射宏為ON_BN_CLICKED( id, memberFxn )id為按鈕的ID值,就是創建時指定的nID值。處理函數原型為afx_msg void memberFxn( );


主站蜘蛛池模板: 在线调教 | 欧美视频黄色 | 亚洲最大成人网 色香蕉 | 中文日韩字幕一区在线观看 | 啪啪.com | 日韩美女免费线视频网址 | 亚洲欧美大片 | 最新国产精品精品视频 | 天天操天天射天天舔 | 青娱乐视觉盛宴在线视频 | 亚洲www在线观看 | 热热色国产 | 天天操天天干天天操 | 香港三级理论在线播放1 | 欧美性色欧美a在线播放 | 视频在线观看40分钟免费 | 日本亚洲欧洲高清有码在线播放 | 日日摸夜夜添夜夜添毛片 | 永久免费看的啪啪网站 | 一级做a爱过程免费视频高清 | 欧洲乱码专区一区二区三区四区 | 香港aa三级久久三级不卡 | 日本福利网站 | 性刺激免费视频观看在线观看 | 色小妹综合 | 中文字幕日韩高清 | 日韩欧美系列 | 四虎永久免费在线观看 | 欧美在线免费播放 | 色天天综合网 | 亚洲免费视频一区 | 英国美女一级毛片视频 | 日韩色在线观看 | 日韩我不卡 | 色婷婷5月精品久久久久 | 伊人资源 | 亚洲啪啪免费视频 | 性欧美大战久久久久久久 | 四虎影视免费观看免费观看 | 欧美一级免费 | 小明www永久在线看 小黄鸭b站视频在线 |