📄 barview.cpp
字号:
// BarView.cpp : implementation file
//
#include "stdafx.h"
#include "Ex3_4.h"
#include "Ex3_4Doc.h"
#include "BarView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBarView
IMPLEMENT_DYNCREATE(CBarView, CView)
CBarView::CBarView()
{
}
CBarView::~CBarView()
{
}
BEGIN_MESSAGE_MAP(CBarView, CView)
//{{AFX_MSG_MAP(CBarView)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBarView drawing
void CBarView::OnDraw(CDC* pDC)
{
CEx3_4Doc* pDoc = (CEx3_4Doc*)GetDocument();
// TODO: add draw code here
int cxBar,cxBarSpacing, cxGraph,cyGraph, x,y, i;
RECT rc;
CBrush brush(RGB(0, 0, 255)); // red brush
CBrush* pOldBrush = pDC->SelectObject(&brush);
CPen pen(PS_SOLID, 0, RGB( 0, 0,255)); // red pen
CPen* pOldPen = pDC->SelectObject(&pen);
cxGraph = 100;
cyGraph = DATAMAX; // defined in resource.h
this->GetClientRect(&rc);
pDC->SetMapMode(MM_ANISOTROPIC);
pDC->SetWindowOrg(0, 0);
pDC->SetViewportOrg(30, rc.bottom-10);
pDC->SetWindowExt(cxGraph, cyGraph);
pDC->SetViewportExt(rc.right-20, -(rc.bottom-20));
// ┮
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -