📄 ybkdemoview.cpp
字号:
// YbkDemoView.cpp : implementation of the CYbkDemoView class
//
#include "stdafx.h"
#include "YbkDemo.h"
#include "YbkDemoDoc.h"
#include "YbkDemoView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CYbkDemoView
IMPLEMENT_DYNCREATE(CYbkDemoView, CView)
BEGIN_MESSAGE_MAP(CYbkDemoView, CView)
//{{AFX_MSG_MAP(CYbkDemoView)
ON_WM_PAINT()
ON_WM_TIMER()
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CYbkDemoView construction/destruction
CYbkDemoView::CYbkDemoView()
{
// TODO: add construction code here
}
CYbkDemoView::~CYbkDemoView()
{
}
BOOL CYbkDemoView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CYbkDemoView drawing
void CYbkDemoView::OnDraw(CDC* pDC)
{
CYbkDemoDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CYbkDemoView printing
BOOL CYbkDemoView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CYbkDemoView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CYbkDemoView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CYbkDemoView diagnostics
#ifdef _DEBUG
void CYbkDemoView::AssertValid() const
{
CView::AssertValid();
}
void CYbkDemoView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CYbkDemoDoc* CYbkDemoView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CYbkDemoDoc)));
return (CYbkDemoDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CYbkDemoView message handlers
void CYbkDemoView::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rect;
GetClientRect(&rect);
HBITMAP hbitmap;
hbitmap=::LoadBitmap(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_JILIANG));
HDC hMenDC=::CreateCompatibleDC(NULL);
SelectObject(hMenDC,hbitmap);
::StretchBlt(dc.m_hDC,0,0,1024,768,hMenDC,0,0,1024,768,SRCCOPY);
::DeleteDC(hMenDC);
::DeleteObject(hbitmap);
}
void CYbkDemoView::OnInitialUpdate()
{
CView::OnInitialUpdate();
CRect rect = CRect(100,100,1000,701);
this->m_JiLiangWnd.Create("","",WS_CHILD|WS_VISIBLE,rect,this,1003);
this->m_JiLiangWnd.ShowDevice(TRUE);
SetTimer(1,1000,NULL);
// TODO: Add your specialized code here and/or call the base class
}
void CYbkDemoView::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
this->m_JiLiangWnd.RefreshMsg();
CString strData;
CRect RefreshRect;
CTime Tm = CTime::GetCurrentTime();
strData.Format("当前时间是:%.4d年%.2d月%.2d日 %.2d时%.2d分%.2d秒",
Tm.GetYear(),Tm.GetMonth(),Tm.GetDay(),Tm.GetHour(),Tm.GetMinute(),Tm.GetSecond());
CMainFrame *pFrm = (CMainFrame *)AfxGetMainWnd();
pFrm->m_wndStatusBar.SetPaneText(1,strData,TRUE);
CView::OnTimer(nIDEvent);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -