Пример #1
0
BOOL CGridChartWnd::Create (DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID)
{
	// TODO: 在此添加专用代码和/或调用基类
	m_pParentWnd = pParentWnd;
	m_pGrid = CreateGrid ();
	m_pChart = CreateChart ();

	BOOL bResult = CWnd::Create (globalData.RegisterWindowClass (_T("GridChartCntnr")), _T(""), dwStyle, rect, pParentWnd, nID);
	return bResult && m_pGrid != NULL && m_pChart != NULL;

	//	return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
//*******************************************************************************
int CBCGPChartView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CScrollView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	m_pWndChartCtrl = CreateChart ();
	if (m_pWndChartCtrl == NULL)
	{
		TRACE0("CBCGPChartView::OnCreate: Chart control is not created\n");
		return -1;
	}

	ASSERT_VALID (m_pWndChartCtrl);
	ASSERT (m_pWndChartCtrl->IsKindOf (RUNTIME_CLASS (CBCGPChartCtrl)));
	
	if (!m_pWndChartCtrl->Create (CBCGPRect(), this, ID_CHART_CTRL))
	{
		TRACE0("CBCGPChartView::OnCreate: cannot create Chart control\n");
		return -1;
	}

	return 0;
}