下面是书上的原代码:首先头文件:
#if !defined(_GRAPHTRANSF_H__)
#define _GRAPHTRANSF_H__#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000#include "GraphTest.h"
#include <afxtempl.h>class CGraphTransf:public CGraphTest
{
struct C2DPoint
{
int x,y,h;
C2DPoint(void)
{
x=0;
y=0;
h=1;
}        C2DPoint(int xx,int yy,int hh)
{
x=xx;
y=yy;
h=hh;
}
}; typedef CArray<C2DPoint,C2DPoint>C2DPointArray;
C2DPointArray m_ptArray;
double     m_fScale; public:
CGraphTransf(CWnd*pWnd);
virtual~CGraphTransf();        virtual void Display(BOOL bAnimateGO=FALSE);        virtual void SetOption(void);
 
private:
void EndScanle(void);
void Show (void);};
#endif 然后:
#include "stdafx.h"
#include "GraphBook.h"
#include "GraphTransf.h"#ifdef _DEBUG#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#define new DEBUG_NEW
#endifCGraphTransf::CGraphTransf(CWnd*pWnd):CGraphTest(pWnd)
{
}
CGraphTransf::~CGraphTransf
{
}void CGraphTransf::Display(BOOL/*bAnimateGO*/)
{
m_canvas.SetWCSOriginType(WINDOW_CENTER);
m_canvas.SetCoordinatesType(COORDINATES_NORMAL,TRUE,FALSE);
m_canvas.StartShowOrAnimate();
m_canvas.SetLinePara(2,PS_SOLID,RGB(255,0,0));
show();
EndScanle();
m_canvas.SetLinePara(2,PS_SOLID,RGB(0,255,0))
    show();
m_canvas.EndShowOrAnimate();
} void CGraphTransf::SetOption(void)
{
m_fScale=1.8;
m_ptArray.Add(C2DPoint(0,0,1));
m_ptArray.Add(C2DPoint(100,80,1));
    m_ptArray.Add(C2DPoint(120,60,1));
    m_ptArray.Add(C2DPoint(30,-40,1));
}void CGraphTransf::EndScanle(void)
{
float Matix[3][3]={{1,0,0},{0,1,0},{0,0,1}};
    Matix[0][0]=Matix[1][1]=m_fScale;
int oldx,oldy,oldh;
int nSize=m_ptArray.GetSize();
for(int i=0;i<nSize;i++)
{
C2DPoint& pt=m_ptArray[i];
oldx=pt.x;
oldy=pt.y;
oldh=pt.h;
pt.x=int(oldx * Matrix[0][0]+oldy * Matrix[1][0]+oldh * Matrix[2][0]+0.5);
        pt.y=int(oldx * Matrix[0][1]+oldy * Matrix[1][1]+oldh * Matrix[2][1]+0.5);
        pt.h=int(oldx * Matrix[0][2]+oldy * Matrix[1][2]+oldh * Matrix[2][2]+0.5);
}
}
void CGraphTransf::Show(void)
{
int nSize=m_ptArray.GetSize(); for(int i=0;i<nSize-1;i++)
{
C2DPoint& pt1=m_ptArry[i];
      C2DPoint& pt2=m_ptArry[i+1];
m_canvas.Line(pt1.x,pt1.y,pt2.x,pt2.y);
} if(nSize>2)
{
       C2DPoint& pt1=m_ptArry[0];
       C2DPoint& pt2=m_ptArry[nSize-1];
       m_canvas.Line(pt1.x,pt1.y,pt2.x,pt2.y);
}
}我又新建了个名字是GraphBook的单文档工程,把上面两个程序 添加进去,结果运行时,说找不到"GrapBook"这个头文件。请问书上的这个 图形转换的源代码怎么用啊?
请高手百忙中指点一二,小弟不胜感激!