// ChartDlg.cpp : implementation file // #include "stdafx.h" #include "t02.h" #include "ChartDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CChartDlg dialog CChartDlg::CChartDlg(CWnd* pParent /*=NULL*/) : CDialog(CChartDlg::IDD, pParent) { //{{AFX_DATA_INIT(CChartDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void CChartDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CChartDlg) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CChartDlg, CDialog) //{{AFX_MSG_MAP(CChartDlg) ON_WM_PAINT() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CChartDlg message handlers void CChartDlg::DrawGrid() { } void CChartDlg::InitChart() { MessageBox("initchart"); CPaintDC dc(this); // device context for painting //MessageBox("onpaint"); CPoint p1, p2; CPen lSolidPen(PS_SOLID, 1, 50); CRect lRect; GetClientRect(lRect); lRect.NormalizeRect(); dc.SelectObject(&lSolidPen); p1.x=10; p1.y=10; p2.x=50; p2.y=50; dc.MoveTo(p1); dc.LineTo(p2); } void CChartDlg::OnPaint() { CPaintDC dc(this); // device context for painting this->InitChart(); MessageBox("onpaint"); // Do not call CDialog::OnPaint() for painting messages }