资源简介
用MFC实现了类似于画图板的简单的图形绘制.
方便大家学习……
代码片段和文件信息
// CntrItem.cpp : implementation of the CDrawItem class
//
#include “stdafx.h“
#include “DrawCli.h“
#include “DrawDoc.h“
#include “DrawVw.h“
#include “DrawObj.h“
#include “CntrItem.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDrawItem implementation
IMPLEMENT_SERIAL(CDrawItem COleClientItem 0)
/*
CDrawItem::CDrawItem(CDrawDoc* pContainer)
: COleClientItem(pContainer)
{
// TODO: add one-time construction code here
}
*/
CDrawItem::CDrawItem(CDrawDoc* pContainer CDrawOleObj* pDrawObj)
: COleClientItem(pContainer)
{
m_pDrawObj = pDrawObj;
}
CDrawItem::~CDrawItem()
{
// TODO: add cleanup code here
}
void CDrawItem::onchange(OLE_NOTIFICATION nCode DWORD dwParam)
{
ASSERT_VALID(this);
COleClientItem::onchange(nCode dwParam);
// When an item is being edited (either in-place or fully open)
// it sends onchange notifications for changes in the state of the
// item or visual appearance of its content.
// TODO: invalidate the item by calling UpdateAllViews
// (with hints appropriate to your application)
GetDocument()->UpdateAllViews(NULL);
// for now just update ALL views/no hints
}
BOOL CDrawItem::onchangeItemPosition(const CRect& rectPos)
{
ASSERT_VALID(this);
// During in-place activation CDrawItem::onchangeItemPosition
// is called by the server to change the position of the in-place
// window. Usually this is a result of the data in the server
// document changing such that the extent has changed or as a result
// of in-place resizing.
//
// The default here is to call the base class which will call
// COleClientItem::SetItemRects to move the item
// to the new position.
if (!COleClientItem::onchangeItemPosition(rectPos))
return FALSE;
// TODO: update any cache you may have of the item‘s rectangle/extent
return TRUE;
}
void CDrawItem::OnGetItemPosition(CRect& rPosition)
{
ASSERT_VALID(this);
// During in-place activation CDrawItem::OnGetItemPosition
// will be called to determine the location of this item. The default
// implementation created from AppWizard simply returns a hard-coded
// rectangle. Usually this rectangle would reflect the current
// position of the item relative to the view used for activation.
// You can obtain the view by calling CDrawItem::GetActiveView.
// TODO: return correct rectangle (in pixels) in rPosition
rPosition.SetRect(10 10 210 210);
}
void CDrawItem::onactivate()
{
// Allow only one inplace activate item per frame
CDrawView* pView = GetActiveView();
ASSERT_VALID(pView);
COleClientItem* pItem = GetDocument()->GetInPlaceActiveItem(pView);
if (pItem != NULL && pItem != this)
pItem->Close();
COleClientItem::onactivate();
}
void CDrawItem::ondeactivateUI(BOOL 属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5095 2000-05-12 13:37 DrawCli\CntrItem.cpp
文件 1895 2000-05-12 13:37 DrawCli\CntrItem.h
文件 38932 2010-11-11 09:26 DrawCli\DrawCli.aps
文件 5596 2010-11-11 09:26 DrawCli\DrawCli.clw
文件 4752 2000-05-07 09:49 DrawCli\DrawCli.cpp
文件 5376 2010-11-11 09:22 DrawCli\DrawCli.dsp
文件 539 2010-11-11 09:26 DrawCli\DrawCli.dsw
文件 1424 2000-05-07 09:37 DrawCli\DrawCli.h
文件 82944 2010-11-11 09:28 DrawCli\DrawCli.ncb
文件 48640 2010-11-11 09:28 DrawCli\DrawCli.opt
文件 248 2010-11-11 09:28 DrawCli\DrawCli.plg
文件 20836 2000-05-12 14:41 DrawCli\DrawCli.rc
文件 4613 2000-05-12 15:01 DrawCli\DrawDoc.cpp
文件 1804 2000-05-12 14:57 DrawCli\DrawDoc.h
文件 18371 2002-04-01 17:49 DrawCli\DrawObj.cpp
文件 3524 2000-05-12 12:27 DrawCli\DrawObj.h
文件 8726 2000-05-12 11:37 DrawCli\DrawTool.cpp
文件 2256 2000-05-12 11:36 DrawCli\DrawTool.h
文件 27291 2010-05-28 23:16 DrawCli\DrawVw.cpp
文件 5374 2000-05-12 15:45 DrawCli\DrawVw.h
文件 3406 2000-05-12 14:47 DrawCli\MainFrm.cpp
文件 1525 2000-05-12 14:44 DrawCli\MainFrm.h
文件 2749 2000-05-12 10:53 DrawCli\RectDlg.cpp
文件 1495 2000-05-12 10:52 DrawCli\RectDlg.h
文件 1078 2000-05-07 09:20 DrawCli\RES\DrawCli.ico
文件 399 2000-05-07 09:20 DrawCli\RES\DrawCli.rc2
文件 1078 2000-05-07 09:20 DrawCli\RES\DrawDoc.ico
文件 1198 2000-05-07 09:20 DrawCli\RES\Toolbar.bmp
文件 1678 2000-05-12 14:20 DrawCli\RES\TOOLBAR1.BMP
文件 2122 2000-05-12 14:41 DrawCli\RESOURCE.H
............此处省略9个文件信息
相关资源
- 基于MFC的TCP调试助手源码95706
- 基于mfc的多线程文件传输
- MFC数字钟(基于VC6.0)
- VC++MFC小游戏实例教程(实例)+MFC类库
- ChartCtrl控件库(可在VS2019中使用)
- 商品库存管理系统 C++ MFC
- mfc 调用redis
- MFC视频播放器源码(支持avi/wma/mp3等格
- mfc绘图大全(画直线、矩形、椭圆)
- MFC控件重绘
- hook,捕获所有案件,查找所有窗口,
- (学习)VS2010之MFC入门到精通教程
- MFC文档_视图_框架_模板结构体系深入
- 简单员工管理系统(适合初学MFC)
- MFC五子棋游戏
- MFC UDP编程
- MFC的异步网络通讯应用程序
- C++MFC模块讲解,黑发程序员课程整理
- 一个简单而强大的基于MFC的web server源
- 基于MFC的VC++仿QQ浏览器源码(雏形)
- MFCaccess.rar
- VC++MFC课程设计的学生成绩管理系统
- MFC 日历控件 万年历 Calendar自绘
- CrystalDiskInfo-HDD/SSD硬盘信息,SMART信息
- MFC自定义界面HUI,高效简单,含详细
- 仿射密码-Affine cipher
- c++MFC车牌自动识别定位,只能定位和
- mfc+sql 酒店客房管理系统
- 基于图割的图像分割OpenCV+MFC实现
- MFC绘制Bezier曲线B样条曲线曲线拟合
川公网安备 51152502000135号
评论
共有 条评论