www.pudn.com > bmpstudy.rar > ZFT.cpp
// ZFT.cpp : implementation file
//
#include "stdafx.h"
#include "exam7.h"
#include "ZFT.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CZFT dialog
CZFT::CZFT(CWnd* pParent /*=NULL*/)
: CDialog(CZFT::IDD, pParent)
{
//{{AFX_DATA_INIT(CZFT)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CZFT::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CZFT)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CZFT, CDialog)
//{{AFX_MSG_MAP(CZFT)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CZFT message handlers
void CZFT::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CRect rect;
CWnd *pWnd;
pWnd = GetDlgItem(IDC_DRAW);
pWnd->GetClientRect(&rect);
CString str;
CPaintDC mdc(pWnd);
CPen *OldPen , PenRed, PenBlue;
PenRed.CreatePen(PS_SOLID,2,RGB(255,0,0));
PenBlue.CreatePen(PS_SOLID,2,RGB(0,0,255));
OldPen = mdc.SelectObject(&PenRed);
//»×ø±êÖá
mdc.MoveTo(5,rect.Height());
mdc.LineTo(5,0);
mdc.LineTo(2,8);
mdc.MoveTo(5,0);
mdc.LineTo(7,8);
mdc.MoveTo(5,rect.Height());
mdc.LineTo(rect.Width()-10,rect.Height());
mdc.LineTo(rect.Width()-18,rect.Height()-3);
mdc.MoveTo(rect.Width()-10,rect.Height());
mdc.LineTo(rect.Width()-18,rect.Height()+2);
///////////////////
mdc.SelectObject(&PenBlue);
for(int i=0;i<256;i++)
{
mdc.MoveTo(2*i+10,rect.Height());
mdc.LineTo(2*i+10,(int)(rect.Height()-num[i]));
if(!(i%5))
{
mdc.MoveTo(2*i+10,rect.Height());
mdc.LineTo(2*i+10,rect.Height()+4);
}
if(!(i%51))
{
str.Format("%d",i);
mdc.TextOut(2*i+10,rect.Height()+8,str);
}
}
mdc.MoveTo(1,rect.Height()-256);
mdc.LineTo(14,rect.Height()-256);
str.Format("%d",m_MaxCount);
mdc.TextOut(11,30,str);
mdc.SelectObject(OldPen);
// Do not call CDialog::OnPaint() for painting messages
}