Thers is CTabCtrl m_tabMain in my main dialog and another dialog member
CDialogPrinter m_dlgPrinter.
I init m_tabMain as follows:
CSize s(20, 40); m_tabMain.SetItemSize(s);
m_tabMain.InsertItem(0, _T("111")); m_tabMain.InsertItem(1, _T("222"));
m_dlgPrinter.Create(IDD_DIALOG_PRINTER, GetDlgItem(IDC_TAB_MAIN)); CRect rs; m_tabMain.GetClientRect(&rs); rs.top += TAB_SIZE_HEIGHT; rs.bottom -= 2; rs.left += 1; rs.right -= 2;
m_dlgPrinter.MoveWindow(&rs); m_dlgPrinter.ShowWindow(TRUE);
m_tabMain.SetCurSel(0);
And then I add CXTPReportControl m_rcReportPrinters to the class CDialogPrinter with init m_rcReportPrinters as follows:
m_rcReportPrinters.SetGridStyle(TRUE, xtpGridSolid); m_rcReportPrinters.GetReportHeader()->AllowColumnRemove(FALSE); m_rcReportPrinters.GetReportHeader()->SetAutoColumnSizing(TRUE); m_rcReportPrinters.GetReportHeader()->AllowColumnSort(FALSE); m_rcReportPrinters.GetReportHeader()->AllowColumnReorder(FALSE); m_rcReportPrinters.GetPaintManager()->SetColumnStyle(xtpColumnFlat); // // Add sample columns // m_rcReportPrinters.AddColumn(new CXTPReportColumn(0, _T("Column 1"), 50)); m_rcReportPrinters.AddColumn(new CXTPReportColumn(1, _T("Column 2"), 50)); m_rcReportPrinters.AddColumn(new CXTPReportColumn(2, _T("Column 3"), 50));
CString str; for (int i = 0; i < 1000; i++) { CXTPReportRecord* pRecord = m_rcReportPrinters.AddRecord(new CXTPReportRecord()); pRecord->AddItem(new CXTPReportRecordItemNumber(i, _T("Item %2.0f")));
str.Format(_T("Item %i"), i); pRecord->AddItem(new CXTPReportRecordItemText(str));
str.Format(_T("Item %.4i"), i); pRecord->AddItem(new CXTPReportRecordItemText(str));
} m_rcReportPrinters.GetPaintManager()->SetColumnStyle(xtpReportColumnFlat); m_rcReportPrinters.Populate();
But the m_rcReportPrinters always can't be shown.
I want to know how should I do if I want use a CXTPReportControl in a tab control dialog.
Thanks.
|