-
Notifications
You must be signed in to change notification settings - Fork 0
/
TsPrintFrame.cpp
67 lines (52 loc) · 1.33 KB
/
TsPrintFrame.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// TsPrintFrame.cpp : 实现文件
//
#include "stdafx.h"
#include "pm3.h"
#include "TsPrintFrame.h"
// CTsPrintFrame
IMPLEMENT_DYNCREATE(CTsPrintFrame, CFrameWnd)
CTsPrintFrame::CTsPrintFrame()
: m_pCallerDlg(NULL)
, m_pView(NULL)
, m_pMainWnd(NULL)
{
}
CTsPrintFrame::~CTsPrintFrame()
{
}
CTsPrintFrame::CTsPrintFrame(CDialog * pCallerDlg)
{
m_pCallerDlg = pCallerDlg;
m_pMainWnd = AfxGetApp()->m_pMainWnd;
AfxGetApp()->m_pMainWnd = this; //将主窗口更换为本框架类的窗口
}
BEGIN_MESSAGE_MAP(CTsPrintFrame, CFrameWnd)
ON_WM_DESTROY()
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTsPrintFrame message handlers
BOOL CTsPrintFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
m_pView = new CTsPrintView();
m_pView->Create(NULL,NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,AFX_IDW_PANE_FIRST,pContext);
return TRUE;
}
void CTsPrintFrame::OnDestroy()
{
// TODO: Add your message handler code here
if(m_pView!=NULL)
{
m_pView->DestroyWindow(); //此函数可以自动清除由new产生的窗口
}
CFrameWnd::OnDestroy();
AfxGetApp()->m_pMainWnd = this->m_pMainWnd; //主框架窗口还原
}
void CTsPrintFrame::Print()
{
m_pView->OnTsPrint();
}
void CTsPrintFrame::PreviewPrint()
{
m_pView->OnTsPrintPreview();
}