Called by the framework to create a Visual Container custom control.
- Parameters
-
pVisualObject | The visual object which hosts a custom control. |
pWnd | The custom control window. |
rect | The custom control bounding rectangle. |
nID | The custom control identifier specified in Visual Designer (see below). |
pParent | The parent window. |
- Returns
- TRUE if it succeeds, FALSE if it fails.
This method should be implemented in CBCGPVisualContainer - derived classes.
Please make the following steps to add your own custom control to the Visual Container:
- In the Visual Designer application (see https://bcgsoft.com/Support/DevArea/VisualDesigner) add a new "Custom Window" object.
- Specify the object ID in the "Properties" window.
- Specify your window class name in "C++ Class Name" property. Please note that your class should have DECLARE_SERIAL, otherwise the framework is not able to create this object!
- Override OnCreateCustomControl method in your CBCGPVisualContainer - derived class. Please take a look at example below.
The following example demonstrates how to add a custom calendar control to the Visual Designer:
BOOL CMyContainer::OnCreateCustomControl(
CBCGPWndHostVisualObject* pVisualObject, CWnd* pWnd,
const CRect& rect,
int nID, CWnd* pParent)
{
switch (nID)
{
case 101:
{
ASSERT_VALID(pWndCalendar);
return pWndCalendar->Create(WS_VISIBLE | WS_CHILD, rect, pParent, nID);
}
break;
}
return FALSE;
}