CStatic::Create

BOOL Create( LPCTSTR lpszText, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID = 0xffff );

Return Value

Nonzero if successful; otherwise 0.

Parameters

lpszText

Specifies the text to place in the control. If NULL, no text will be visible.

dwStyle

Specifies the static control’s window style. Apply any combination of static control styles to the control. 

rect

Specifies the position and size of the static control. It can be either a RECT structure or a CRect object.

pParentWnd

Specifies the CStatic parent window, usually a CDialog object. It must not be NULL.

nID

Specifies the static control’s control ID.

Remarks

Construct a CStatic object in two steps. First call the constructor CStatic, then call Create, which creates the Windows static control and attaches it to the CStatic object.

Apply the following window styles to a static control:

If you're going to display a bitmap, cursor, icon, or metafile in the static control, you'll need to apply one of the following styles:

For cursors, bitmaps, or icons, you may also want to use the following style:

Example

CStatic myStatic;

// Create a child static control that centers its text horizontally.
myStatic.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER, 
   CRect(10,10,150,50), pParentWnd);

CStatic OverviewClass MembersHierarchy Chart

See Also   CStatic::CStatic