资源简介
编写应用程序,利用鼠标在视图区内绘制圆和椭圆。要求在工具
条上创建两个按钮,分别代表绘制圆和绘制椭圆。实现代码中仅允许
使用 SetPixel 一种绘图函数,不可以使用其他绘图函数。
绘制图形的鼠标操作方式可自行决定,此处给出一种方式作为参
考:类似于绘制直线段,按下鼠标左键时的点假设为 P,按住鼠标左
键不放,移动鼠标到另一点处抬起鼠标左键,该点假设为 Q。绘制圆
的时候,以 P 为圆心,PQ 为圆的半径。绘制椭圆时,将 PQ 作为一个
矩形的对角线,绘制该矩形的内切椭圆。

代码片段和文件信息
// MainFrm.cpp : implementation of the CMainframe class
//
#include “stdafx.h“
#include “text.h“
#include “MainFrm.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainframe
IMPLEMENT_DYNCREATE(CMainframe CframeWnd)
BEGIN_MESSAGE_MAP(CMainframe CframeWnd)
//{{AFX_MSG_MAP(CMainframe)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code !
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR // status line indicator
ID_INDICATOR_CAPS
ID_INDICATOR_NUM
ID_INDICATOR_SCRL
};
/////////////////////////////////////////////////////////////////////////////
// CMainframe construction/destruction
CMainframe::CMainframe()
{
// TODO: add member initialization code here
}
CMainframe::~CMainframe()
{
}
int CMainframe::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CframeWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this TBstyle_FLAT WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINframe))
{
TRACE0(“Failed to create toolbar\n“);
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators
sizeof(indicators)/sizeof(UINT)))
{
TRACE0(“Failed to create status bar\n“);
return -1; // fail to create
}
// TODO: Delete these three lines if you don‘t want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
BOOL CMainframe::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CframeWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainframe diagnostics
#ifdef _DEBUG
void CMainframe::AssertValid() const
{
CframeWnd::AssertValid();
}
void CMainframe::Dump(CDumpContext& dc) const
{
CframeWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainframe message handlers
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-12-03 09:48 text1\
目录 0 2017-12-03 09:48 text1\.vs\
目录 0 2017-12-03 09:48 text1\.vs\text\
目录 0 2017-12-03 09:48 text1\.vs\text\v15\
文件 3584 2017-11-17 16:10 text1\.vs\text\v15\.suo
目录 0 2017-12-03 09:48 text1\Debug\
文件 20076 2017-10-23 15:43 text1\Debug\MainFrm.obj
文件 105832 2017-10-23 15:43 text1\Debug\StdAfx.obj
文件 122965 2017-10-23 15:43 text1\Debug\text.exe
文件 313516 2017-10-23 15:43 text1\Debug\text.ilk
文件 22998 2017-10-23 15:43 text1\Debug\text.obj
文件 5633800 2017-10-23 15:43 text1\Debug\text.pch
文件 336896 2017-10-23 15:43 text1\Debug\text.pdb
文件 7552 2017-10-23 15:43 text1\Debug\text.res
文件 14778 2017-10-23 15:43 text1\Debug\textDoc.obj
文件 30322 2017-10-23 15:43 text1\Debug\textView.obj
文件 214016 2017-11-13 13:24 text1\Debug\vc60.idb
文件 364544 2017-10-23 15:43 text1\Debug\vc60.pdb
文件 2505 2017-10-23 14:25 text1\MainFrm.cpp
文件 1581 2017-10-23 14:25 text1\MainFrm.h
文件 4263 2017-10-23 14:25 text1\ReadMe.txt
文件 206 2017-10-23 14:25 text1\StdAfx.cpp
文件 1054 2017-10-23 14:25 text1\StdAfx.h
目录 0 2017-12-03 09:48 text1\res\
文件 1318 2017-10-23 15:02 text1\res\Toolbar.bmp
文件 1078 2017-10-23 14:25 text1\res\text.ico
文件 396 2017-10-23 14:25 text1\res\text.rc2
文件 1078 2017-10-23 14:25 text1\res\textDoc.ico
文件 685 2017-10-23 15:02 text1\resource.h
文件 29076 2017-11-13 13:24 text1\text.aps
文件 2293 2017-11-13 13:25 text1\text.clw
............此处省略12个文件信息
- 上一篇:大数据能力提升大赛.docx
- 下一篇:BC20硬件设计手册以及PCB
相关资源
- 计算机图形学 边填充算法实现代码
- 虚拟鼠标
-
Actionsc
ript 1.0实现能跟随鼠标运动的 - 多窗口后台鼠标连点器
- 基于MFC扩展CListCtrl子项显示图片并叠
- 黑白棋(带简单AI)
- 计算机图形学课设 画板
- MFC程序-碰撞的小球
-
Cme
taFileDC的使用示例 - js鼠标经过选项卡
- ado数据库MFC图书管理系统vs2010
- mfc单文档窗体画线与写字
- Qt Creator opengl实现四元数鼠标控制轨迹
- [免费]MFC制作目录树
- MFC读三维模型obj文件
- 画图程序MFC/VC/VC CRectTracker 串行化
- MFC网络编程实例
- 会变色的鼠标指针,颜色随时在变哦
- c 程序判断离散数学中命题公式
- MFC控件动态拖动
- MFC中OpenGL面和体的绘制以及动画效果
- c MFC 画多边形
- RSA AES DES ECC加密算法源码
- Microsoft基本类库 (MFC)(C 库)
- vc利用MFC底层开发的二维GIS管理软件,
- (MFC) 时钟日期程序
- 一个基于MFC的GridCtrl,提供类似Excel的
- 用MFC实现简单的画图功能
- MFC绘图小软件源代码(可当VC大作业用
- 基于MFC的文件目录树的对话框实现代
评论
共有 条评论