📄 mydraw.cpp
字号:
// MyDraw.cpp : implementation file
//
#include "stdafx.h"
#include "MyTest.h"
#include "MyDraw.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// MyDraw dialog
int Arr[1000];
int ih=0;
MyDraw::MyDraw(CWnd* pParent /*=NULL*/)
: CDialog(MyDraw::IDD, pParent)
{
//{{AFX_DATA_INIT(MyDraw)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void MyDraw::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(MyDraw)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(MyDraw, CDialog)
//{{AFX_MSG_MAP(MyDraw)
ON_BN_CLICKED(IDC_BUTTON1, OnMyClose)
ON_BN_CLICKED(IDC_BUTTON2, OnDraw)
ON_BN_CLICKED(IDC_BUTTON3, OnLoadArr)
ON_BN_CLICKED(IDC_BUTTON4, OnLoadPic)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// MyDraw message handlers
void MyDraw::OnMyClose()
{
// TODO: Add your control notification handler code here
OnOK();
}
void MyDraw::OnDraw()
{
int i;
char str[30];
char AA[10];
CDC *pDC=GetDC();
for(i=1;i<1000;i+=30)
{
strcpy(str,_itoa(i,AA,10));
pDC->TextOut(i,250,str);
pDC->LineTo(i+10,Arr[i]);
//pDC->SetPixel(100,1000,RGB(255,0,0));
}
}
BOOL MyDraw::OnInitDialog()
{
//初始化DrawPoin窗体对话框,并指定IDR_ICON1图标资源
//CDialog::OnInitDialog();
My_hIcon = AfxGetApp()->LoadIcon(IDR_ICON1);
SetIcon(My_hIcon, TRUE);
SetIcon(My_hIcon, FALSE);
return TRUE;
}
void MyDraw::OnLoadArr()
{
//int Arr[1000];
for(ih=1;ih<1000;ih+=4)
{
Arr[ih]=ih;
}
return;
}
void MyDraw::OnLoadPic()
{
// TODO: Add your control notification handler code here
MyPicNewA.DoModal();
//MyPicNewA
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -