Partager via


StaticControlView_t::DrawStaticText (Windows CE 5.0)

Send Feedback

This method draws the text for a static control.

static void DrawStaticText(HWND hwnd,unsigned intStyle,enum StaticControlTypesct,HDC hdc,HBRUSH hbrBk);

Parameters

  • hwnd
    [in] Handle to the window control.
  • Style
    [in] Unsigned integer that specifies the style of the static control. The following table shows the possible values.
    Value Description
    SS_BITMAP Specifies that a bitmap is displayed in the static control. The text is the name of a bitmap that is defined elsewhere in the resource file, not a file name. The style ignores the nWidth and nHeight parameters; the control automatically sizes itself to accommodate the bitmap.
    SS_CENTER Specifies a simple rectangle and centers the error value text in the rectangle. Windows CE formats the text before display. The control automatically wraps words that extend past the end of a line to the beginning of the next centered line.
    SS_CENTERIMAGE Specifies that the midpoint of a static control with the SS_BITMAP or SS_ICON style remains fixed when you resize the control. The four sides are adjusted to accommodate a new bitmap. If the bitmap is smaller than the client area of the control, the rest of the client area is filled with the color of the pixel in the upper-left corner of the bitmap.

    You cannot set the Style parameter to SS_CENTERIMAGE by itself. You must combine SS_CENTERIMAGE, through a bitwise-OR, with the SS_BITMAP style or the SS_ICON style.

    Do not use SS_CENTERIMAGE for a static control that contains text.

    SS_ICON Specifies that an icon is displayed in the static control. The text is the name of an icon defined elsewhere in the resource file, not a file name. The style ignores the nWidth and nHeight parameters; the icon automatically sizes itself.
    SS_LEFT Specifies a rectangle and left-aligns the text in the rectangle. Windows CE formats the text before display. The control automatically wraps words that extend past the end of a line to the beginning of the next left-aligned line.
    SS_LEFTNOWORDWRAP Specifies a rectangle and left-aligns the text in the rectangle. Tabs are expanded, but words are not wrapped. Text that extends past the end of a line is clipped.
    SS_NOPREFIX Prevents interpretation of any ampersand (&) characters in the text of the control as accelerator prefix characters.

    An application can combine SS_NOPREFIX with other styles by using the bitwise-OR (|) operator. This style can be useful when you display file names or other strings that can contain an ampersand (&) within a static control in a dialog box.

    SS_NOTIFY Sends the parent window the STN_CLICKED notification when the user clicks the control.
    SS_RIGHT Specifies a rectangle and right-aligns the specified text in the rectangle. Windows CE formats the text before display. The control automatically wraps words that extend past the end of a line to the beginning of the next right-aligned line.
    WS_BORDER Creates a window that has a thin-line border.
    WS_CAPTION Creates a window that has a title bar (includes the WS_BORDER style). Cannot be used with the WS_DLGFRAME style.
    WS_CHILD Creates a child window. This style cannot be used with the WS_POPUP style.
    WS_CLIPCHILDREN Excludes the area occupied by child windows when drawing occurs within the parent window. Use this style when creating the parent window.
    WS_CLIPSIBLINGS Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message, the WS_CLIPSIBLINGS style clips all other overlapping child windows out of the region of the child window to be updated. If WS_CLIPSIBLINGS is not specified and child windows overlap, an application can, when drawing within the client area of a child window, draw within the client area of a neighboring child window. Use this style in combination with the WS_CHILD style only.
    WS_DISABLED Creates a window that is initially disabled. A disabled window cannot receive input from the user.
    WS_DLGFRAME Creates a window that has a border of a style typically used with dialog boxes. A window with this style cannot have a title bar.
    WS_GROUP Specifies the first control of a group of controls. The group consists of this first control and all controls defined after it, up to the next control with the WS_GROUP style. The first control in each group usually has the WS_TABSTOP style so that the user can move from group to group. The user can subsequently change the keyboard focus from one control in the group to the next control in the group by using the direction keys.
    WS_HSCROLL Creates a window that has a horizontal scroll bar.
    WS_OVERLAPPED Creates an overlapped window. An overlapped window has a title bar and a border.
    WS_OVERLAPPEDWINDOW Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles.
    Note   Although WS_OVERLAPPEDWINDOW is not supported by Windows CE, the functionality can still be achieved by obtaining a bitwise OR of the style flags WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX.
    WS_POPUP Creates a pop-up window. This style cannot be used with the WS_CHILD style.
    WS_SIZEBOX Creates a window that has a sizing border. Same as the WS_THICKFRAME style.
    WS_SYSMENU Creates a window that has a Close (X) button in the nonclient area.
    WS_TABSTOP Specifies a control that can receive the keyboard focus when the user presses the TAB key. Pressing the TAB key changes the keyboard focus to the next control with the WS_TABSTOP style.
    WS_THICKFRAME Creates a window that has a sizing border.
    WS_TILED Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_OVERLAPPED style.
    WS_TILEDWINDOW Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_OVERLAPPEDWINDOW style.
    WS_VISIBLE Creates a window that is initially visible.
    WS_VSCROLL Creates a window that has a vertical scroll bar.
  • sct
    [in] StaticControlType value that specifies the type of the static control. The following table shows the possible values.
    Value Description
    sctLeft Left-aligned text
    sctCenter Center-aligned text
    sctRight Right-aligned text
    sctIcon Icon
    sctLeftNoWordWrap Left-aligned text with no word wrap
    sctBitmap Bitmap
    sctCenterImage A centered image
  • hdc
    [in] Handle to the device context for the window.
  • hbrBk
    [in] Handle to the background brush to use when drawing the static control.

Requirements

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

See Also

StaticControlType | WM_PAINT

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.