📄 codedlg.cpp
字号:
// CodeDlg.cpp : implementation file
//
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCodeDlg dialog
#include "stdafx.h"
#include "resource.h"
#include "CodeDlg.h"
#include "global.h"
CCodeDlg::CCodeDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCodeDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCodeDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
AfxInitRichEdit();
// m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CCodeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCodeDlg)
DDX_Control(pDX, IDC_CODE_TEXT, m_CodeText);
//}}AFX_DATA_MAP
}
HCURSOR CCodeDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
BEGIN_MESSAGE_MAP(CCodeDlg, CDialog)
//{{AFX_MSG_MAP(CCodeDlg)
ON_WM_QUERYDRAGICON()
ON_WM_PAINT()
ON_WM_SHOWWINDOW()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCodeDlg message handlers
void CCodeDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CDialog::OnPaint() for painting messages
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
BOOL CCodeDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CCodeDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
// TODO: Add your message handler code here
CFile* pInputFile = NULL;
try
{
CString SoftWarePath;
SoftWarePath="tt.txt";
pInputFile = new CFile(SoftWarePath, CFile::modeRead | CFile::shareDenyNone);
EDITSTREAM strm;
strm.dwCookie = (DWORD) pInputFile;
strm.pfnCallback = MyStreamingCallback;
long lResult = m_CodeText.StreamIn(SF_TEXT, strm);
pInputFile->Close();
}
catch (CFileException* pEx)
{
pEx->Delete();
}
delete pInputFile;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -