资源简介
用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.doc
- 最小生成树MFC
- MFC Tabcontrol 标签控件美化
- 关于MFC对话框与静态HTML交互
- Bresenham画线连成多边形并填充
- 多线程MFCVS2010版本
- 图像融合C++/MFC
- Vc++/MFC下 Json解析
- MFC显示图片的相关文件
- VC2008 MFC 五子棋 源码 人机对弈 游戏
- MFC操作sqlite3需要的库文件
- MFC的HttpClient的Get和Post方法
- 基于MFC的图形编辑器
- 打砖块游戏
- 基于C++MFC-RS485串口通信demo-完整版-代
- 截图工具及源码
- Timer时钟.zip
- 东南大学 MFC 课程设计 图书管理系统
- 篮球赛个人技术统计系统
- VC++ 轨迹运动源码
- mfco42d、msvcrtd、mfc42d三个DLL文件
- 计算机图形学大作业C++代码MFC终极版
- png格式透明MFC自绘按钮
- MFC项目重命名工具
- mfc42d.dll与msvcrtd.dll
- 基于socket通信的,利用MFC实现TCP通信
- mfc链接sql数据库查询、修改、删除
- mfc写的贪吃蛇小游戏
- 坦克大战:(MFC]).zip
- mfc中自绘menu控件的美化
评论
共有 条评论