Share via


CStatic Class

Provides the functionality of a Windows static control.

class CStatic : public CWnd

Members

Public Constructors

Name

Description

CStatic::CStatic

Constructs a CStatic object.

Public Methods

Name

Description

CStatic::Create

Creates the Windows static control and attaches it to the CStatic object.

CStatic::DrawItem

Override to draw an owner-drawn static control.

CStatic::GetBitmap

Retrieves the handle of the bitmap previously set with SetBitmap.

CStatic::GetCursor

Retrieves the handle of the cursor image previously set with SetCursor.

CStatic::GetEnhMetaFile

Retrieves the handle of the enhanced metafile previously set with SetEnhMetaFile.

CStatic::GetIcon

Retrieves the handle of the icon previously set with SetIcon.

CStatic::SetBitmap

Specifies a bitmap to be displayed in the static control.

CStatic::SetCursor

Specifies a cursor image to be displayed in the static control.

CStatic::SetEnhMetaFile

Specifies an enhanced metafile to be displayed in the static control.

CStatic::SetIcon

Specifies an icon to be displayed in the static control.

Remarks

A static control displays a text string, box, rectangle, icon, cursor, bitmap, or enhanced metafile. It can be used to label, box, or separate other controls. A static control normally takes no input and provides no output; however, it can notify its parent of mouse clicks if it's created with SS_NOTIFY style.

Create a static control in two steps. First, call the constructor to construct the CStatic object, then call the Create member function to create the static control and attach it to the CStatic object.

If you create a CStatic object within a dialog box (through a dialog resource), the CStatic object is automatically destroyed when the user closes the dialog box.

If you create a CStatic object within a window, you may also need to destroy it. A CStatic object created on the stack within a window is automatically destroyed. If you create the CStatic object on the heap by using the new function, you must call delete on the object to destroy it when you are done with it.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CStatic

Requirements

Header: afxwin.h

See Also

Reference

CWnd Class

Hierarchy Chart

CWnd Class

CButton Class

CComboBox Class

CEdit Class

CListBox Class

CScrollBar Class

CDialog Class