一款供学习GDI的绘图软件,软件构架很有学习价值,实现图行对象化,序列化。可对图元进行编辑修改等操作
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4880 2002-09-26 03:50 drawclicntritem.cpp
文件 1772 2002-09-26 03:50 drawclicntritem.h
文件 2244 2014-06-19 10:07 drawcliDebugBscMake.command.1.tlog
文件 1886 2014-06-19 10:07 drawcliDebugscmake.read.1.tlog
文件 1726 2014-06-19 10:07 drawcliDebugscmake.write.1.tlog
文件 11498 2014-06-19 10:07 drawcliDebugcl.command.1.tlog
文件 44396 2014-06-19 10:07 drawcliDebugCL.read.1.tlog
文件 11164 2014-06-19 10:07 drawcliDebugCL.write.1.tlog
文件 31622 2014-06-18 14:04 drawcliDebugcntritem.obj
文件 0 2014-06-18 14:04 drawcliDebugcntritem.sbr
文件 12741632 2014-06-19 10:07 drawcliDebugdrawcli.bsc
文件 311296 2014-06-19 10:07 drawcliDebugdrawcli.exe
文件 667 2014-05-16 09:24 drawcliDebugdrawcli.exe.embed.manifest
文件 732 2014-05-16 09:24 drawcliDebugdrawcli.exe.embed.manifest.res
文件 381 2014-06-19 10:07 drawcliDebugdrawcli.exe.intermediate.manifest
文件 2818532 2014-06-19 10:07 drawcliDebugdrawcli.ilk
文件 66 2014-06-19 10:07 drawcliDebugdrawcli.lastbuildstate
文件 3043 2014-06-19 10:07 drawcliDebugdrawcli.log
文件 41616 2014-06-18 14:04 drawcliDebugdrawcli.obj
文件 25296896 2014-05-16 09:23 drawcliDebugdrawcli.pch
文件 5041152 2014-06-19 10:07 drawcliDebugdrawcli.pdb
文件 17996 2014-06-18 14:04 drawcliDebugdrawcli.res
文件 0 2014-06-18 14:04 drawcliDebugdrawcli.sbr
文件 210 2014-05-16 09:23 drawcliDebugdrawcli_manifest.rc
文件 110644 2014-06-18 14:04 drawcliDebugdrawdoc.obj
文件 0 2014-06-18 14:04 drawcliDebugdrawdoc.sbr
文件 129413 2014-06-18 14:04 drawcliDebugdrawobj.obj
文件 0 2014-06-18 14:04 drawcliDebugdrawobj.sbr
文件 53922 2014-06-18 14:04 drawcliDebugdrawtool.obj
文件 0 2014-06-18 14:04 drawcliDebugdrawtool.sbr
............此处省略85个文件信息
// 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 drawclicntritem.cpp
文件 1772 2002-09-26 03:50 drawclicntritem.h
文件 2244 2014-06-19 10:07 drawcliDebugBscMake.command.1.tlog
文件 1886 2014-06-19 10:07 drawcliDebugscmake.read.1.tlog
文件 1726 2014-06-19 10:07 drawcliDebugscmake.write.1.tlog
文件 11498 2014-06-19 10:07 drawcliDebugcl.command.1.tlog
文件 44396 2014-06-19 10:07 drawcliDebugCL.read.1.tlog
文件 11164 2014-06-19 10:07 drawcliDebugCL.write.1.tlog
文件 31622 2014-06-18 14:04 drawcliDebugcntritem.obj
文件 0 2014-06-18 14:04 drawcliDebugcntritem.sbr
文件 12741632 2014-06-19 10:07 drawcliDebugdrawcli.bsc
文件 311296 2014-06-19 10:07 drawcliDebugdrawcli.exe
文件 667 2014-05-16 09:24 drawcliDebugdrawcli.exe.em
文件 732 2014-05-16 09:24 drawcliDebugdrawcli.exe.em
文件 381 2014-06-19 10:07 drawcliDebugdrawcli.exe.intermediate.manifest
文件 2818532 2014-06-19 10:07 drawcliDebugdrawcli.ilk
文件 66 2014-06-19 10:07 drawcliDebugdrawcli.lastbuildstate
文件 3043 2014-06-19 10:07 drawcliDebugdrawcli.log
文件 41616 2014-06-18 14:04 drawcliDebugdrawcli.obj
文件 25296896 2014-05-16 09:23 drawcliDebugdrawcli.pch
文件 5041152 2014-06-19 10:07 drawcliDebugdrawcli.pdb
文件 17996 2014-06-18 14:04 drawcliDebugdrawcli.res
文件 0 2014-06-18 14:04 drawcliDebugdrawcli.sbr
文件 210 2014-05-16 09:23 drawcliDebugdrawcli_manifest.rc
文件 110644 2014-06-18 14:04 drawcliDebugdrawdoc.obj
文件 0 2014-06-18 14:04 drawcliDebugdrawdoc.sbr
文件 129413 2014-06-18 14:04 drawcliDebugdrawobj.obj
文件 0 2014-06-18 14:04 drawcliDebugdrawobj.sbr
文件 53922 2014-06-18 14:04 drawcliDebugdrawtool.obj
文件 0 2014-06-18 14:04 drawcliDebugdrawtool.sbr
............此处省略85个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)