BCGSuite for MFC
virtual BOOL CBCGPCalendarBar::CreateControl ( CWnd *  pParentWnd,
const CRect &  rect,
UINT  nID,
BOOL  enableSelection = FALSE,
DWORD  dwStyle = WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER 
)
virtual

Creates a Windows control and performs additional initializations.

Returns
Nonzero if control has been created successfully; otherwise FALSE.

Call this method to create dialog control.

This method requires definition of the rectangle in dialog client coordinates where the window is to be created. The following manner of designing dialog containing calendar bar is recommended:

  • Add member variable of type CBCGPCalendarBar (for example named m_calendarBar) in the dialog class.
  • In dialog template put static control on the place of calendar bar and set it invisible.
  • In the dialog OnInitDialog () method get static rectangle and call m_calendarBar .CreateControl(..) method.
Parameters
pParentWndThe parent window
rectThe window rectangle in dialog client coordinates.
nIDThe command ID.
enableSelectionEnable/disable multiple selection. If TRUE, the multiple selection is enabled.
dwStyleThe window style.

Example:

Copy
class CPage6 : public CBCGPPropertyPage
{
...
CStatic m_calendarLocation; // assigned as object handling the dialog template static
CBCGPCalendarBar m_wndCalendarCtrl;
};
BOOL CPage6::OnInitDialog()
{
.....
CRect rectCalendar;
m_calendarLocation.GetClientRect (&rectCalendar);
m_calendarLocation.MapWindowPoints (this, &rectCalendar);
m_wndCalendarCtrl.CreateControl(this, rectCalendar, (UINT)-1, true);
....
}