//重新绘制 Invalidate();
//重新设制鼠标状态 mousestate=true;
//标记值,双击时调用相应的函数 m=1; }
void CMy070505129View::OnBUTTONByangtiao()//B样条快捷按钮函数 {
// TODO: Add your command handler code here Invalidate();//重新绘制
mousestate=true;//重新设制鼠标状态 m=2;//标记值,双击时调用相应的函数 }
void CMy070505129View::OnLButtonDblClk(UINT nFlags, CPoint point) //双击 {
// TODO: Add your message handler code here and/or call default //鼠标状态
mousestate=false; //调用画Bezier函数 if(m==1) DrawBezier(); //调用画B样条函数 if(m==2) DrawByangtiao();
CView::OnLButtonDblClk(nFlags, point); }
void CMy070505129View::Oncantor()//Cantor集菜单响应函数 {
// TODO: Add your command handler code here //定义对话框类对象 CCantor cantor; //设备上下文
CClientDC dc(this); //响应
cantor.DoModal(); n=cantor.m_n; //立即重绘屏幕 RedrawWindow();
//获取屏幕最大x,y值
CRect Rect;
GetClientRect(&Rect); MaxX=Rect.right; MaxY=Rect.bottom;
//调用Cantor算法实现函数 Cantor(0,0,MaxX,0,n); }
void CMy070505129View::OnMENUITEMcolor()//颜色菜单响应函数 {
// TODO: Add your command handler code here //定义对颜色对话框类对象 CColorDialog color;
color.m_cc.rgbResult=ccolor; color.DoModal();
//得到用户选择的颜色 ccolor=color.GetColor(); }
四.使用说明
点击相应菜单,弹出提示对话框,单击”ok”键,使用鼠标单击四下取点,双击绘出Bezier曲线或B样条曲线;或者单击选择单击图形按钮随即单击鼠标四下,双击绘出Bezier曲线或B样条曲线。选择cantor集菜单在弹出的对话框中输入n的值,单击”ok”键,随即绘出cantor集图形。
五.结果分析
选择Bezier曲线菜单:
选择ok:
单击四下双击:
点击
:
选择B样条曲线菜单:
选择ok:
单击四下双击以下:
点击
: