资源简介
一款供学习GDI的绘图软件,软件构架很有学习价值,实现图行对象化,序列化。可对图元进行编辑修改等操作
代码片段和文件信息
// cntritem.h : interface of the CDrawItem class
//
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#include “stdafx.h“
#include “drawcli.h“
#include “drawdoc.h“
#include “drawobj.h“
#include “drawvw.h“
#include “cntritem.h“
#ifdef _DEBUG
#undef THIS_FILE
static char baseD_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDrawItem implementation
IMPLEMENT_SERIAL(CDrawItem COleClientItem 0)
CDrawItem::CDrawItem(CDrawDoc* pContainer CDrawOleObj* pDrawObj)
: COleClientItem(pContainer)
{
m_pDrawObj = pDrawObj;
}
CDrawItem::~CDrawItem()
{
if (m_pDrawObj != NULL)
m_pDrawObj->m_pClientItem = NULL;
}
void CDrawItem::onchange(OLE_NOTIFICATION nCode DWORD dwParam)
{
ASSERT_VALID(this);
COleClientItem::onchange(nCode dwParam);
switch(nCode)
{
case OLE_CHANGED_STATE:
case OLE_CHANGED_ASPECT:
m_pDrawObj->Invalidate();
break;
case OLE_CHANGED:
UpdateExtent(); // extent may have changed
m_pDrawObj->Invalidate();
break;
}
}
BOOL CDrawItem::onchangeItemPosition(const CRect& rectPos)
{
ASSERT_VALID(this);
CDrawView* pView = GetActiveView();
ASSERT_VALID(pView);
CRect rect = rectPos;
pView->ClientToDoc(rect);
if (rect != m_pDrawObj->m_position)
{
// invalidate old rectangle
m_pDrawObj->Invalidate();
// update to new rectangle
m_pDrawObj->m_position = rect;
GetExtent(&m_pDrawObj->m_extent);
// and invalidate new rectangle
m_pDrawObj->Invalidate();
// mark document as dirty
GetDocument()->SetModifiedFlag();
}
return COleClientItem::onchangeItemPosition(rectPos);
}
void CDrawItem::OnGetItemPosition(CRect& rPosition)
{
ASSERT_VALID(this);
// update to extent of item if m_position is not initialized
if (m_pDrawObj->m_position.IsRectEmpty())
UpdateExtent();
// copy m_position which is in document coordinates
CDrawView* pView = GetActiveView();
ASSERT_VALID(pView);
rPosition = m_pDrawObj->m_position;
pView->DocToClient(rPosition);
}
void CDrawItem::Serialize(CArchive& ar)
{
ASSERT_VALID(this);
// Call base class first to read in COleClientItem data.
// Note: this sets up the m_pDocument pointer returned from
// CDrawItem::GetDocument therefore it is a good idea
// to call the base class Serialize first.
COleClientItem::Serialize(ar);
// now store/retrieve data specific to CDrawItem
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
BOOL CDrawItem::UpdateExtent()
{
CSize size;
if (
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4880 2002-09-26 03:50 drawcli\cntritem.cpp
文件 1772 2002-09-26 03:50 drawcli\cntritem.h
文件 2244 2014-06-19 10:07 drawcli\Debug\BscMake.command.1.tlog
文件 1886 2014-06-19 10:07 drawcli\Debug\bscmake.read.1.tlog
文件 1726 2014-06-19 10:07 drawcli\Debug\bscmake.write.1.tlog
文件 11498 2014-06-19 10:07 drawcli\Debug\cl.command.1.tlog
文件 44396 2014-06-19 10:07 drawcli\Debug\CL.read.1.tlog
文件 11164 2014-06-19 10:07 drawcli\Debug\CL.write.1.tlog
文件 31622 2014-06-18 14:04 drawcli\Debug\cntritem.obj
文件 0 2014-06-18 14:04 drawcli\Debug\cntritem.sbr
文件 12741632 2014-06-19 10:07 drawcli\Debug\drawcli.bsc
文件 311296 2014-06-19 10:07 drawcli\Debug\drawcli.exe
文件 667 2014-05-16 09:24 drawcli\Debug\drawcli.exe.em
文件 732 2014-05-16 09:24 drawcli\Debug\drawcli.exe.em
文件 381 2014-06-19 10:07 drawcli\Debug\drawcli.exe.intermediate.manifest
文件 2818532 2014-06-19 10:07 drawcli\Debug\drawcli.ilk
文件 66 2014-06-19 10:07 drawcli\Debug\drawcli.lastbuildstate
文件 3043 2014-06-19 10:07 drawcli\Debug\drawcli.log
文件 41616 2014-06-18 14:04 drawcli\Debug\drawcli.obj
文件 25296896 2014-05-16 09:23 drawcli\Debug\drawcli.pch
文件 5041152 2014-06-19 10:07 drawcli\Debug\drawcli.pdb
文件 17996 2014-06-18 14:04 drawcli\Debug\drawcli.res
文件 0 2014-06-18 14:04 drawcli\Debug\drawcli.sbr
文件 210 2014-05-16 09:23 drawcli\Debug\drawcli_manifest.rc
文件 110644 2014-06-18 14:04 drawcli\Debug\drawdoc.obj
文件 0 2014-06-18 14:04 drawcli\Debug\drawdoc.sbr
文件 129413 2014-06-18 14:04 drawcli\Debug\drawobj.obj
文件 0 2014-06-18 14:04 drawcli\Debug\drawobj.sbr
文件 53922 2014-06-18 14:04 drawcli\Debug\drawtool.obj
文件 0 2014-06-18 14:04 drawcli\Debug\drawtool.sbr
............此处省略85个文件信息
相关资源
- DWGdirect.Net_and_ActiveX_3.3.0.rar
- DWGdirectX4.0
- DWGdirect_NET_3_02帮助文件
- 绘制哆啦A梦.zip
- 数学建模用到的绘图软件
- resform地质绘图软件破解版
- 中文版uml绘图软件,可用
- GDI+图形程序设计.zip
- smartdraw 7.7 含汉化补丁
- 专业的函数绘图软件:origin-8.0绿色破
- Arduino面包板连线绘图软件
- GDI+图形程序设计.7z
- 进程所占物理内存、句柄数、线程数
- GDI+双缓冲绘制碰撞小球
- GDI+使用PNG图片打造异型窗口
- 拼图程序_通过GDI实现图片切割、位移
- GDI+三维图形类
- GDI三维图形类.rar
- GDI+柱状图
- GDI+绘图功能软件
- VC绘图(曲线-清除显示-块复制-播放动
- basGDIPlus.bas
- 用GDI+绘制极坐标图
- trainingDigits/testDigits
- 用GDI+绘制的一个强大可移动坐标,已
- ScreenCaptor组件
- PB+GDI截屏保存JPG图片
- 用win32GDI函数编程推箱子
- 一个用GDI+画的仪表盘.zip
- VC GDI+ 窗口截图内存BMP转JPG压缩、JP
评论
共有 条评论