提交 | 用户 | age
|
418cb3
|
1 |
// CMTerm1BnlView.cpp: 实现文件
|
Q |
2 |
//
|
|
3 |
|
|
4 |
#include "pch.h"
|
|
5 |
#include "MTerm1.h"
|
|
6 |
#include "MTerm1BnlView.h"
|
|
7 |
#include "MTerm1Doc.h"
|
61deef
|
8 |
#include "ChildFrm.h"
|
418cb3
|
9 |
|
Q |
10 |
// CMTerm1BnlView
|
|
11 |
|
61deef
|
12 |
IMPLEMENT_DYNCREATE(CMTerm1BnlView, CFormView)
|
418cb3
|
13 |
|
Q |
14 |
CMTerm1BnlView::CMTerm1BnlView()
|
61deef
|
15 |
: CFormView(IDD_MTerm1BnlView)
|
418cb3
|
16 |
{
|
Q |
17 |
|
|
18 |
}
|
|
19 |
|
|
20 |
CMTerm1BnlView::~CMTerm1BnlView()
|
|
21 |
{
|
|
22 |
}
|
|
23 |
|
61deef
|
24 |
void CMTerm1BnlView::DoDataExchange(CDataExchange* pDX)
|
Q |
25 |
{
|
|
26 |
CFormView::DoDataExchange(pDX);
|
|
27 |
}
|
418cb3
|
28 |
|
61deef
|
29 |
BEGIN_MESSAGE_MAP(CMTerm1BnlView, CFormView)
|
Q |
30 |
ON_BN_CLICKED(IDC_BUTTON_LOAD, &CMTerm1BnlView::OnBnClickedButtonLoad)
|
|
31 |
ON_BN_CLICKED(IDC_BUTTON_SAVE, &CMTerm1BnlView::OnBnClickedButtonSave)
|
|
32 |
ON_BN_CLICKED(ID_PROG_CONVERT, &CMTerm1BnlView::OnBnClickedButtonConvert)
|
|
33 |
ON_BN_CLICKED(IDC_BUTTON_CONVERT, &CMTerm1BnlView::OnBnClickedButtonConvert)
|
|
34 |
ON_BN_CLICKED(IDC_BUTTON_TRNS_TOTXT, &CMTerm1BnlView::OnBnClickedButtonTrnsTotxt)
|
|
35 |
ON_BN_CLICKED(IDC_BUTTON_TRNS_PRG, &CMTerm1BnlView::OnBnClickedButtonTrnsPrg)
|
|
36 |
ON_BN_CLICKED(IDC_BUTTON4, &CMTerm1BnlView::OnBnClickedButton4)
|
|
37 |
ON_WM_SIZE()
|
|
38 |
|
418cb3
|
39 |
END_MESSAGE_MAP()
|
61deef
|
40 |
|
Q |
41 |
// CMTerm1BnlView 诊断
|
|
42 |
|
|
43 |
#ifdef _DEBUG
|
|
44 |
void CMTerm1BnlView::AssertValid() const
|
|
45 |
{
|
|
46 |
CFormView::AssertValid();
|
|
47 |
}
|
|
48 |
|
|
49 |
#ifndef _WIN32_WCE
|
|
50 |
void CMTerm1BnlView::Dump(CDumpContext& dc) const
|
|
51 |
{
|
|
52 |
CFormView::Dump(dc);
|
|
53 |
}
|
|
54 |
#endif
|
|
55 |
#endif //_DEBUG
|
418cb3
|
56 |
|
Q |
57 |
|
|
58 |
// CMTerm1BnlView 绘图
|
|
59 |
void CMTerm1BnlView::OnDraw(CDC* pDC)
|
|
60 |
{
|
|
61 |
CDocument* pDoc = GetDocument();
|
|
62 |
// TODO: 在此添加绘制代码
|
|
63 |
}
|
|
64 |
|
|
65 |
|
|
66 |
// CMTerm1BnlView 消息处理程序
|
61deef
|
67 |
|
Q |
68 |
void CMTerm1BnlView::OnInitialUpdate()
|
|
69 |
{
|
|
70 |
CFormView::OnInitialUpdate();
|
|
71 |
// TODO: 在此添加专用代码和/或调用基类
|
|
72 |
m_pStatusBar = ((CChildFrame*)GetParentFrame())->GetStatusBar();
|
|
73 |
ResizeParentToFit();
|
|
74 |
CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
|
|
75 |
this->GetParentFrame()->SetWindowText(pDoc->GetTitle());
|
|
76 |
CString s1;
|
|
77 |
CStringA s1A;
|
|
78 |
pDoc->TransToTxt(s1A);
|
|
79 |
s1 = s1A;
|
|
80 |
SetDlgItemText(IDC_EDIT1, s1);
|
|
81 |
}
|
|
82 |
|
|
83 |
|
|
84 |
void CMTerm1BnlView::OnUpdate(CView* /*pSender*/, LPARAM lHint, CObject* /*pHint*/)
|
|
85 |
{
|
|
86 |
// TODO: 在此添加专用代码和/或调用基类
|
|
87 |
CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
|
|
88 |
CStringA s1A;
|
|
89 |
pDoc->TransToTxt(s1A);
|
|
90 |
CString s1;
|
|
91 |
s1 = s1A;
|
|
92 |
SetDlgItemText(IDC_EDIT1, s1);
|
|
93 |
((CEdit*)GetDlgItem(IDC_EDIT1))->SetSel((int)lHint, (int)lHint + 1);
|
|
94 |
}
|
|
95 |
|
|
96 |
|
|
97 |
void CMTerm1BnlView::OnBnClickedButtonLoad()
|
|
98 |
{
|
|
99 |
// TODO: 在此添加控件通知处理程序代码
|
|
100 |
CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
|
|
101 |
CFileDialog dialog1(true);
|
|
102 |
INT_PTR r = dialog1.DoModal();
|
|
103 |
if (r == IDOK)
|
|
104 |
{
|
|
105 |
CString sFilePathName = dialog1.GetFileName();
|
|
106 |
pDoc->LoadFromFile(sFilePathName);
|
|
107 |
// pDoc->UpdateAllViews(NULL);
|
|
108 |
}
|
|
109 |
}
|
|
110 |
|
|
111 |
|
|
112 |
void CMTerm1BnlView::OnBnClickedButtonSave()
|
|
113 |
{
|
|
114 |
// TODO: 在此添加控件通知处理程序代码
|
|
115 |
CString s1;
|
|
116 |
CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
|
|
117 |
// pDoc->DoFileSave();
|
|
118 |
}
|
|
119 |
|
|
120 |
|
|
121 |
void CMTerm1BnlView::OnBnClickedButtonConvert()
|
|
122 |
{
|
|
123 |
// TODO: 在此添加控件通知处理程序代码
|
|
124 |
CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
|
|
125 |
CString s1;
|
|
126 |
CStringA s1A;
|
|
127 |
GetDlgItemText(IDC_EDIT1, s1);
|
|
128 |
s1A = s1;
|
|
129 |
pDoc->TransTxtToProg(s1A);
|
|
130 |
pDoc->TransToTxt(s1A);
|
|
131 |
s1 = s1A;
|
|
132 |
SetDlgItemText(IDC_EDIT1, s1);
|
|
133 |
pDoc->UpdateAllViews(this);
|
|
134 |
}
|
|
135 |
|
|
136 |
|
|
137 |
void CMTerm1BnlView::OnBnClickedButtonTrnsTotxt()
|
|
138 |
{
|
|
139 |
// TODO: 在此添加控件通知处理程序代码
|
|
140 |
CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
|
|
141 |
CStringA s1A;
|
|
142 |
pDoc->TransToTxt(s1A);
|
|
143 |
CString s1;
|
|
144 |
s1 = s1A;
|
|
145 |
// AnsiToT(s1A, s1);
|
|
146 |
SetDlgItemText(IDC_EDIT1, s1);
|
|
147 |
|
|
148 |
}
|
|
149 |
|
|
150 |
|
|
151 |
void CMTerm1BnlView::OnBnClickedButtonTrnsPrg()
|
|
152 |
{
|
|
153 |
// TODO: 在此添加控件通知处理程序代码
|
|
154 |
CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
|
|
155 |
CString s1;
|
|
156 |
CStringA s1A;
|
|
157 |
GetDlgItemText(IDC_EDIT1, s1);
|
|
158 |
s1A = s1;
|
|
159 |
pDoc->TransFileToProg(s1A);
|
|
160 |
pDoc->UpdateAllViews(this);
|
|
161 |
// AnsiToT(s1A, s1);
|
|
162 |
|
|
163 |
}
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
void CMTerm1BnlView::OnBnClickedButton4()
|
|
168 |
{
|
|
169 |
// TODO: 在此添加控件通知处理程序代码
|
|
170 |
CMTerm1Doc* pDoc = (CMTerm1Doc*)GetDocument();
|
|
171 |
theApp.MyKLink1.fnTest1(2);
|
|
172 |
|
|
173 |
CRect rect1;
|
|
174 |
this->GetClientRect(&rect1);
|
|
175 |
// this->GetParentFrame()->SetWindowPos(NULL, rect1.left, rect1.top, 100, 200, SWP_NOZORDER);
|
|
176 |
|
|
177 |
}
|
|
178 |
|
|
179 |
|
|
180 |
void CMTerm1BnlView::OnSize(UINT nType, int cx, int cy)
|
|
181 |
{
|
|
182 |
CFormView::OnSize(nType, cx, cy);
|
|
183 |
CString s1;
|
|
184 |
CWnd* pwnd;
|
|
185 |
///*
|
|
186 |
pwnd = GetDlgItem(IDC_EDIT1);
|
|
187 |
if (pwnd != NULL)
|
|
188 |
{
|
|
189 |
CRect rect1;
|
|
190 |
pwnd->GetWindowRect(rect1);
|
|
191 |
ScreenToClient(rect1);
|
|
192 |
|
|
193 |
pwnd->SetWindowPos(NULL, 0, 0, rect1.Width(), cy - 20, NULL);
|
|
194 |
// s1.Format(_T("OnSize %d %d %d \r\n"), nType, cx, cy);
|
|
195 |
//((CEdit*)GetDlgItem(IDC_EDIT1))->ReplaceSel(s1);
|
|
196 |
|
|
197 |
}
|
|
198 |
// */
|
|
199 |
//
|
|
200 |
// TODO: 在此处添加消息处理程序代码
|
|
201 |
|
|
202 |
}
|