在VC6.0 坏境下,用mfc 编写的绘制3 次Bezier 曲线的完整代码,其功能为:单击左键绘制控制多边形和坐标点,单击右键绘制曲线。 具体操作步骤如下: (1)新建 mfc,工程名为Bezier。 (2)编辑菜单资源并添加消息处理函数 OnBezier。 (3)在工程主文件中编写代码如下(红色字体为要添加代码)。 // BezierView.cpp : implementation of the CBezierView class // #include "stdafx.h" #include "Bezier.h" #include "BezierDoc.h" #include "BezierView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #define T 20 #endif ///////////////////////////////////////////////////////////////////////////// // CBezierView IMPLEMENT_DYNCREATE(CBezierView, CView) BEGIN_MESSAGE_MAP(CBezierView, CView) //{{AFX_MSG_MAP(CBezierView) // NOTE - the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! ON_WM_RBUTTONDOWN() ON_WM_LBUTTONDOWN() //}}AFX_MSG_MAP // Standard printing commands ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CBezierView construction/destruction CBezierView::CBezierView() { // TODO: add construction code here } CBezierView::~ CBezierView() { } BOOL CBezierView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); } ///////////////////////////////////////////////////////////////////////////// // CBezierView drawing void CBezierView::OnDraw(CDC* pDC) { CBezierDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pDC->TextOut(30,20,"开始绘制3 次Bezier 曲线,单击左键绘制控制多边形,单击右键绘制曲线"); // TODO: add draw code for native data here...