📄 pic1.cpp
字号:
// pic1.cpp : implementation file
//
#include "stdafx.h"
#include "cartest.h"
#include "pic1.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// Cpic
Cpic::Cpic()
{
}
Cpic::~Cpic()
{
}
BEGIN_MESSAGE_MAP(Cpic, CStatic)
//{{AFX_MSG_MAP(Cpic)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Cpic message handlers
CPen newpen,*oldpen;
BOOL Cpic::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Add your specialized code here and/or call the base class
return CStatic::PreCreateWindow(cs);
}
CDC globaldc;
void Cpic::OnPaint()
{
newpen.CreatePen (PS_DASH,2,RGB(255,0,0));
CPaintDC dc(this); // device context for painting
globaldc==dc;
oldpen=dc.SelectObject (&newpen);
//画原点
dc.TextOut (0,300,"原点");
//画坐标轴
dc.MoveTo (2,0);
dc.LineTo (2,300);
dc.LineTo (400,300);
dc.MoveTo (0,4);
dc.LineTo (2,0);
dc.LineTo (4,4);
dc.MoveTo (396,298);
dc.LineTo (400,300);
dc.LineTo(396,302);
//画刻度
int i,j;
for (i=0;i<29;i++)
{
dc.MoveTo (2,300-10*i);
dc.LineTo (4,300-10*i);
}
for (j=0;j<38;j++)
{
dc.MoveTo (2+10*j,300);
dc.LineTo (2+10*j,298);
}
// TODO: Add your message handler code here
// Do not call CStatic::OnPaint() for painting messages
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -