BOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );
BOOL Create( DWORD dwStyle, const POINT& pt, CWnd* pParentWnd, UINT nID );
Return Value
Nonzero if initialization was successful; otherwise 0.
Parameters
dwStyle
Specifies the combination of Windows styles applied to the month calendar control. See Month Calendar Control Styles in the Platform SDK for more information about the styles.
rect
A reference to a RECT structure. Contains the position and size of the month calendar control.
pt
A reference to a POINT structure that identifies the location of the month calendar control.
pParentWnd
A pointer to a CWnd object that is the parent window of the month calendar control. It must not be NULL.
nID
Specifies the month calendar control’s control ID.
Remarks
Create a month calendar control in two steps:
When you call Create, the common controls are initialized. The version of Create you call determines how it is sized:
Example
void CMyDialog::OnCreateControls()
{
// Given two member objects m_calCtrl1 and m_calCtrl2, we can
// create them in one of two ways.
// Providing a point has the control with its top-left corner
// at that point and sized automatically to show one month
// page.
CPoint pt(10, 10);
VERIFY(m_calCtrl1.Create(WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_BORDER,
pt, this, 1005));
// Providing a rectangle lets us completely control the size.
// The control will paint as many complete month pages in the
// control's area as possible.
CRect rect(10, 100, 170, 200);
VERIFY(m_calCtrl2.Create(WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_BORDER,
rect, this, 1006));
}
CMonthCalCtrl Overview | Class Members | Hierarchy Chart
See Also CMonthCalCtrl::CMonthCalCtrl