?? lagview.cpp
字號:
// lagView.cpp : implementation of the CLagView class
//
#include "stdafx.h"
#include "lag.h"
#include "lagDoc.h"
#include "lagView.h"
#include "resource.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLagView
IMPLEMENT_DYNCREATE(CLagView, CView)
BEGIN_MESSAGE_MAP(CLagView, CView)
//{{AFX_MSG_MAP(CLagView)
ON_WM_CREATE()
ON_WM_SIZE()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLagView construction/destruction
CLagView::CLagView()
{
// TODO: add construction code here
}
CLagView::~CLagView()
{
}
BOOL CLagView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CLagView drawing
void CLagView::OnDraw(CDC* pDC)
{
CLagDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// show image bmp
/*
m_dib.Open("code.bmp");
CRect rc;
GetClientRect(&rc);
int h,w;
double k;
h = m_dib.GetHeight();
w = m_dib.GetWidth();
k = (double)h/w;
m_dib.Draw(pDC,(int)(rc.right-rc.left),(int)((rc.right-rc.left)*k));
*/
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CLagView printing
BOOL CLagView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CLagView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CLagView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CLagView diagnostics
#ifdef _DEBUG
void CLagView::AssertValid() const
{
CView::AssertValid();
}
void CLagView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CLagDoc* CLagView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CLagDoc)));
return (CLagDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CLagView message handlers
int CLagView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
pEdit = new CEdit();
if (pEdit->Create(WS_CHILD|WS_VISIBLE|ES_MULTILINE|ES_AUTOHSCROLL,CRect(0,0,0,0),this,IDC_RDCTRL) == NULL)
return 0;
AddText();
pEdit->SetReadOnly(FALSE);
pEdit->ShowWindow(TRUE);
return 0;
}
void CLagView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
CRect rc;
GetClientRect(&rc);
pEdit->MoveWindow(rc,TRUE);
}
void CLagView::AddText()
{
CString text,temp;
FILE *fp;
char buffer[1024];
if ((fp = fopen("Lagrange.cpp","r")) == NULL)
{
MessageBox("讀取文件Lagrange.cpp失敗。");
return;
}
while (fgets(buffer,1024,fp) != NULL)
{
temp = buffer;
text += temp;
}
text.Replace("\n","\r\n");
pEdit->SetWindowText(text);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -