📄 reportdlg.cpp
字号:
// ReportDlg.cpp : implementation file
//
#include "stdafx.h"
#include "heavenmis.h"
#include "ReportDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CReportDlg dialog
CReportDlg::CReportDlg(CWnd* pParent /*=NULL*/)
: CDialog(CReportDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CReportDlg)
m_reportName = _T("");
//}}AFX_DATA_INIT
}
void CReportDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CReportDlg)
DDX_Control(pDX, IDC_CHECK_TOOLBAR, m_btnToolbar);
DDX_Control(pDX, IDC_CHECK_TITLE, m_btnTitle);
DDX_Control(pDX, IDC_CHECK_GROUPTREE, m_btnGroupTree);
DDX_Control(pDX, IDC_ACTIVEXREPORTVIEWER1, m_Viewer);
DDX_Text(pDX, DC_STATIC_REPORTNAME, m_reportName);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CReportDlg, CDialog)
//{{AFX_MSG_MAP(CReportDlg)
ON_BN_CLICKED(IDC_CHECK_TOOLBAR, OnCheckToolbar)
ON_BN_CLICKED(IDC_CHECK_TITLE, OnCheckTitle)
ON_BN_CLICKED(IDC_CHECK_GROUPTREE, OnCheckGrouptree)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CReportDlg message handlers
BOOL CReportDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
InitReport();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CReportDlg::InitReport()
{
m_pApp.CreateInstance("CrystalDesignRuntime.Application");
_bstr_t filename=_bstr_t(m_rptFile);
//打开报表
m_pReport=m_pApp->OpenReport(filename);
//设置报表显示器控件的数据源为上面打开的报表
m_Viewer.SetReportSource(m_pReport);
//不显示“组树”
m_Viewer.SetDisplayGroupTree (FALSE);
//不显示控件边框
m_Viewer.SetDisplayBorder (FALSE);
//不显示控件工具栏
m_Viewer.SetDisplayToolbar (FALSE);
//显示选项卡的标题
m_Viewer.SetDisplayTabs(FALSE);
//更新报表显示器控件
m_Viewer.Refresh();
//显示报表
m_Viewer.ViewReport();
}
void CReportDlg::OnCheckToolbar()
{
// TODO: Add your control notification handler code here
if(m_btnToolbar.GetCheck()==0)
m_Viewer.SetDisplayToolbar(FALSE);
else if(m_btnToolbar.GetCheck()==1)
m_Viewer.SetDisplayToolbar(TRUE);
}
void CReportDlg::OnCheckTitle()
{
// TODO: Add your control notification handler code here
if(m_btnTitle.GetCheck()==0)
m_Viewer.SetDisplayTabs(FALSE);
else if(m_btnTitle.GetCheck()==1)
m_Viewer.SetDisplayTabs(TRUE);
}
void CReportDlg::OnCheckGrouptree()
{
// TODO: Add your control notification handler code here
if(m_btnGroupTree.GetCheck()==0)
{
m_Viewer.SetDisplayGroupTree(FALSE);
}
else if(m_btnGroupTree.GetCheck()==1)
{
m_Viewer.SetDisplayGroupTree(TRUE);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -