• <label id="pxtpz"><meter id="pxtpz"></meter></label>
      1. <span id="pxtpz"><optgroup id="pxtpz"></optgroup></span>

        當前位置:雨林木風下載站 > 技術開發教程 > 詳細頁面

        VC++之Button控件

        VC++之Button控件

        更新時間:2019-05-18 文章作者:未知 信息來源:網絡 閱讀次數:

        按鈕窗口(控件)在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( );

        溫馨提示:喜歡本站的話,請收藏一下本站!

        本類教程下載

        系統下載排行

        主站蜘蛛池模板: 亚洲av成人无码久久精品 | 美女又黄又免费的视频| 亚洲精品无码成人片久久不卡| 嫩草成人永久免费观看| 亚洲一级Av无码毛片久久精品| 亚洲成在人线aⅴ免费毛片| 黑人粗长大战亚洲女2021国产精品成人免费视频 | 亚洲国产精品久久久久秋霞小| 最近中文字幕mv手机免费高清| 中文字幕亚洲一区二区三区| 亚洲同性男gay网站在线观看| 亚洲A∨精品一区二区三区下载 | 日韩大片免费观看视频播放| 97在线视频免费| 亚洲激情视频在线观看| 黄色毛片免费网站| 亚洲а∨天堂久久精品| 一级做a爱过程免费视| 亚洲成色在线综合网站| 午夜不卡AV免费| 成人免费在线视频| 亚洲AV无码一区二区大桥未久| 免费中文字幕在线| 亚洲6080yy久久无码产自国产 | 亚洲人成色777777精品| 免费中文字幕在线| 国产婷婷成人久久Av免费高清| 国产美女无遮挡免费视频网站| 国产亚洲日韩在线a不卡| 国产gv天堂亚洲国产gv刚刚碰| 色窝窝亚洲AV网在线观看| 亚洲国产日韩在线观频| 国产 亚洲 中文在线 字幕| 国产成人免费ā片在线观看| 一区二区三区免费看| 18gay台湾男同亚洲男同| 久久这里只精品国产免费10| 亚洲人成毛片线播放| 免费在线观看黄网站| 久久精品无码专区免费青青| 亚洲精品女同中文字幕|