VC++涔婤utton鎺т欢
鍙戝竷: 2008-6-26 14:28 | 浣滆: admin | 鏌ョ湅: 206娆
鎸夐挳绐楀彛锛堟帶浠讹級鍦∕FC涓娇鐢–Button琛ㄧず锛孋Button鍖呭惈浜嗕笁绉嶆牱寮忕殑鎸夐挳锛孭ush Button锛孋heck Box锛孯adio Box銆傛墍浠ュ湪鍒╃敤CButton瀵硅薄鐢熸垚鎸夐挳绐楀彛鏃堕渶瑕佹寚鏄庢寜閽殑椋庢牸銆
鍒涘缓鎸夐挳锛欱OOL CButton::Create( LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );鍏朵腑lpszCaption鏄寜閽笂鏄剧ず鐨勬枃瀛楋紝dwStyle涓烘寜閽鏍硷紝闄や簡Windows椋庢牸鍙互浣跨敤澶栵紙濡俉S_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涓虹獥鍙f墍鍗犳嵁鐨勭煩褰㈠尯鍩燂紝pParentWnd涓虹埗绐楀彛鎸囬拡锛宯ID涓鸿绐楀彛鐨処D鍊笺
鑾峰彇/鏀瑰彉鎸夐挳鐘舵侊細瀵逛簬妫鏌ユ寜閽拰鍦嗗舰鎸夐挳鍙兘鏈変袱绉嶇姸鎬侊紝閫変腑鍜屾湭閫変腑锛屽鏋滆缃簡BS_3STATE鎴朆S_AUTO3STATE椋庢牸灏卞彲鑳藉嚭鐜扮涓夌鐘舵侊細鏈畾锛岃繖鏃舵寜閽樉绀虹伆鑹层傞氳繃璋冪敤int CButton::GetCheck( ) 寰楀埌褰撳墠鏄惁琚変腑锛岃繑鍥0锛氭湭閫変腑锛1锛氶変腑锛2锛氭湭瀹氥傝皟鐢╲oid CButton::SetCheck( int nCheck );璁剧疆褰撳墠閫変腑鐘舵併
澶勭悊鎸夐挳娑堟伅锛氳澶勭悊鎸夐挳娑堟伅闇瑕佸湪鐖剁獥鍙d腑杩涜娑堟伅鏄犲皠锛屾槧灏勫畯涓篛N_BN_CLICKED( id, memberFxn )id涓烘寜閽殑ID鍊硷紝灏辨槸鍒涘缓鏃舵寚瀹氱殑nID鍊笺傚鐞嗗嚱鏁板師鍨嬩负afx_msg void memberFxn( );
鎸夐挳绐楀彛锛堟帶浠讹級鍦∕FC涓娇鐢–Button琛ㄧず锛孋Button鍖呭惈浜嗕笁绉嶆牱寮忕殑鎸夐挳锛孭ush Button锛孋heck Box锛孯adio Box銆傛墍浠ュ湪鍒╃敤CButton瀵硅薄鐢熸垚鎸夐挳绐楀彛鏃堕渶瑕佹寚鏄庢寜閽殑椋庢牸銆
鍒涘缓鎸夐挳锛欱OOL CButton::Create( LPCTSTR lpszCaption, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );鍏朵腑lpszCaption鏄寜閽笂鏄剧ず鐨勬枃瀛楋紝dwStyle涓烘寜閽鏍硷紝闄や簡Windows椋庢牸鍙互浣跨敤澶栵紙濡俉S_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).




发表于 2009-1-5 19:48
| 











