VC-CButton控件

来源:互联网 发布:apache 加载php 7 编辑:程序博客网 时间:2024/06/05 19:03

Button的样式

  • BS_3STATE   像一个 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.

  • BS_AUTO3STATE   有三种状态的check box, 除非用户去选择他改变他的状态

  • BS_AUTOCHECKBOX   像一个check box,他会根据用户的点击自动选中

  • BS_AUTORADIOBUTTON   自动RADIO BUTTON,用户点击它,将会改变其状态,他也会改变同属于一个组的其他RADIO的状态。

  • BS_BITMAP   可以显示位图的按钮

  • BS_BOTTOM   文本按钮

  • BS_CENTER   创建一个水平方向文本的按钮到一个矩形区域

  • BS_CHECKBOX  创建一个小的四方在文字的左边(好像 BS_LEFTTEXT 样式).

  • BS_DEFPUSHBUTTON   创建一个按钮即有深黑色的边框.

  • BS_FLAT   Specifies that the button is two-dimensional; it does not use the default shading to create a 3-D image.

  • BS_GROUPBOX   按钮组

  • BS_ICON   显示一个图标的按钮

  • BS_LEFT   文本右对齐的按钮

  • 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_MULTILINE   Wraps the button text to multiple lines if the text string is too long to fit on a single line in the button rectangle.

  • BS_NOTIFY   Enables a button to send BN_DBLCLKBN_KILLFOCUS, and BN_SETFOCUS notification messages to its parent window. Note that buttons send the BN_CLICKED notification message regardless of whether it has this style.

  • BS_OWNERDRAW  创建一个自动绘画的按钮

  • BS_PUSHBUTTON   Creates a pushbutton that posts a WM_COMMAND message to the owner window when the user selects the button.

  • BS_PUSHLIKE   Makes a button (such as a check box, three-state check box, or radio button) look and act like a push button. The button looks raised when it isn't pushed or checked, and sunken when it is pushed or checked.

  • BS_RADIOBUTTON   创建一个文本在右边的RADIO.

  • BS_RIGHT  文本向右对齐的按钮

  • BS_RIGHTBUTTON   定义RADIO/CHECK在文本的右边

  • BS_TEXT   一个文本按钮

  • BS_TOP   定义一个文本在顶端的按钮

  • BS_USERBUTTON   Obsolete, but provided for compatibility with 16-bit versions of Windows. Win32-based applications should useBS_OWNERDRAW instead.

  • BS_VCENTER   Places text in the middle (vertically) of the button rectangle.

  • BS_SPLITBUTTON   Creates a split button. A split button has a main area and a drop-down arrow. The button performs a default action when you click the main area. By default, the button displays a menu of options when you click the drop-down arrow.

  • BS_DEFSPLITBUTTON    Creates a default split button that behaves like a BS_PUSHBUTTON style split button. If the split button is in a dialog box, the user can select the split button by pressing the ENTER key, even when the split button does not have the input focus. This style is useful for enabling the user to quickly select the most likely (default) option.

  • BS_COMMANDLINK   Creates a command link button.

  • BS_DEFCOMMANDLINK   Creates a default command link button that behaves like a BS_PUSHBUTTON style command link button. If the button is in a dialog box, the user can select the command link button by pressing the ENTER key, even when the command link button does not have the input focus. This style is useful for enabling the user to quickly select the most likely (default) option.

2、

virtual BOOL Create(   LPCTSTR lpszCaption,   DWORD dwStyle,   const RECT& rect,   CWnd* pParentWnd,   UINT nID );

 

lpszCaption

按钮显示的文本

dwStyle

按钮显示的样式,看(1)

rect

按钮显示的区域. 它是一个 CRect 、 RECT 结构.

pParentWnd

显示按钮的窗体的 引用

nID

指出这个按钮的 ID

3、主要方法

  • HBITMAP GetBitmap( ) const; 获取按钮被setBitmap指定的图形的句柄,假如没有指定,它返回NULL
  • UINT GetButtonStyle( ) const;返回按钮的样式信息
  • int GetCheck( ) const;返回按钮是否被选中
  • HCURSOR GetCursor( );/HCURSOR SetCursor(HCURSOR hCursor );设置鼠标显示

原创粉丝点击