Share via


ButtonView_t::DrawText

This method draws the text or focus rectangle of a button.

static void DrawText(
  HWND hwnd,
  HDC hdc,
  BOOL dbt,
  BOOL fDepress,
  UINT pbfPush,
  enum ButtonControlRectangleStyle_t bcrs,
  WORD alignment
);

Parameters

  • hwnd
    [in] Handle to a window.

  • hdc
    [in] Handle to a device context.

  • dbt
    [in] Boolean that specifies whether to draw the text or the focus rectangle of the button. DBT_TEXT indicates that ButtonView_t::DrawText should draw the text of the button. DBT_FOCUS indicates that ButtonView_t::DrawText should draw the focus rectangle of the button.

  • fDepress
    [in] Boolean that specifies whether the button should appear pressed. TRUE indicates that the button should appear pressed. FALSE indicates that the button should not appear pressed.

  • pbfPush
    [in] Unsigned integer that describes whether a button can be pressed. The following table shows the possible values.

    Value Description
    PBF_DEFAULT Default push button
    PBF_PUSHABLE Push button
  • bcrs
    [in] ButtonControlRectangleStyle_t value that specifies the style of focus rectangle of the button. The following table shows the possible values.

    Value Description
    CBR_CHECKBOX Calculates the focus rectangle for a check box or radio button, including buttons with the BS_CHECKBOX, BS_RADIOBUTTON, BS_AUTORADIOBUTTON, BS_3STATE, BS_AUTOCHECKBOX, or BS_AUTO3STATE styles.
    CBR_CHECKTEXT Draws the text for a check box or radio button, including buttons with the BS_CHECKBOX, BS_RADIOBUTTON, BS_AUTORADIOBUTTON, BS_3STATE, BS_AUTOCHECKBOX, or BS_AUTO3STATE styles.
    CBR_CLIENTRECT Specifies an owner-drawn button. An owner-drawn button is a button with the BS_OWNERDRAW style.
    CBR_GROUPFRAME Calculates the focus rectangle for a group box. A group box is a button with the BS_GROUPBOX style.
    CBR_GROUPTEXT Draws the text for a group box. A group box is a button with the BS_GROUPBOX style.
    CBR_PUSHBUTTON Specifies a push button or default push button. These buttons have the BS_PUSHBUTTON or BS_DEFPUSHBUTTON style.
  • alignment
    [in] WORD that specifies the alignment of the text. The following table shows the values that you can use, in combination with other values listed later in this parameter description, to specify the horizontal and vertical alignment of the button.

    Value Description
    HOR_ALIGN_MASK Use to determine the horizontal alignment of the text.
    VER_ALIGN_MASK Use to determine the vertical alignment of the text.

    The following table shows the possible values that you can combine with HOR_ALIGN_MASK by using a bitwise-OR operation to set the horizontal alignment.

    Value Description
    BS_LEFT Left alignment
    BS_RIGHT Right alignment
    BS_CENTER Center horizontal alignment

    The following table shows the possible values that you can combine with VER_ALIGN_MASK by using a bitwise-OR operation to set the vertical alignment.

    Value Description
    BS_BOTTOM Bottom alignment
    BS_TOP Top alignment
    BS_VCENTER Center vertical alignment

Remarks

ButtonView_t::DrawText is called when the button receives a WM_SETFOCUS, WM_KILLFOCUS, or BM_SETCHECK message. This method is also called when the state of the button changes, or when the button is painted.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Buttonview.hpp.

See Also

ButtonControlRectangleStyle_t | BM_SETCHECK | WM_KILLFOCUS | WM_SETFOCUS

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.