• 大小: 263KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-05-23
  • 语言: 其他
  • 标签: VC  坐标系  

资源简介

本人花了好几天写的VC坐标系的建立,实现World 坐标系(逻辑)和设备坐标系的转换。里面有注释,希望对大家有所帮助。原理都在注释里面。

资源截图

代码片段和文件信息

// 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面 
// (“Fluent UI”)。该示例仅供参考,
// 用以补充《Microsoft 基础类参考》和 
// MFC C++ 库软件随附的相关电子文档。
// 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
// 若要了解有关 Fluent UI 许可计划的详细信息,请访问  
// http://msdn.microsoft.com/officeui。
//
// 版权所有(C) Microsoft Corporation
// 保留所有权利。

#include “stdafx.h“
#include “CalendarBar.h“
#include “CCurve.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

const int nBorderSize = 10;

/////////////////////////////////////////////////////////////////////////////
// CCalendarBar

CCalendarBar::CCalendarBar()
{
m_nMyCalendarsY = 0;
}

CCalendarBar::~CCalendarBar()
{
}

BEGIN_MESSAGE_MAP(CCalendarBar CWnd)
ON_WM_CREATE()
ON_WM_ERASEBKGND()
ON_WM_SIZE()
ON_WM_PAINT()
ON_WM_SETTINGCHANGE()
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCalendarBar 消息处理程序

int CCalendarBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;

CRect rectDummy(0 0 0 0);
m_wndCalendar.Create(WS_CHILD | WS_VISIBLE rectDummy this 1);

CBitmap bmp;
bmp.LoadBitmap(IDB_PAGES_SMALL_HC);

m_Images.Create(16 16 ILC_COLOR24 | ILC_MASK 0 0);
m_Images.Add(&bmp RGB(255 0 255));

return 0;
}

BOOL CCalendarBar::OnEraseBkgnd(CDC* /*pDC*/)
{
return TRUE;
}

void CCalendarBar::OnSize(UINT nType int cx int cy)
{
CWnd::OnSize(nType cx cy);

int nMyCalendarsHeight = 70;

if (m_wndCalendar.GetSafeHwnd() != NULL)
{
m_wndCalendar.SetWindowPos(NULL nBorderSize nBorderSize cx - 2 * nBorderSize cy - 2 * nBorderSize - nMyCalendarsHeight - 10 SWP_NOZORDER | SWP_NOACTIVATE);
}

m_nMyCalendarsY = cy - nMyCalendarsHeight;
}

BOOL CCalendarBar::Create(const RECT& rect CWnd* pParentWnd UINT nID)
{
return CWnd::Create(NULL _T(““) WS_CHILD | WS_VISIBLE rect pParentWnd nID);
}

void CCalendarBar::OnPaint()
{
CPaintDC dc(this); // 用于绘制的设备上下文

CRect rectClient;
GetClientRect(rectClient);

dc.FillRect(rectClient &afxGlobalData.brWindow);

if (rectClient.bottom - m_nMyCalendarsY > 0)
{
CRect rectMyCalendarsCaption = rectClient;
rectMyCalendarsCaption.top = m_nMyCalendarsY;
rectMyCalendarsCaption.bottom = rectMyCalendarsCaption.top + afxGlobalData.GetTextHeight(TRUE) * 3 / 2;

COLORREF clrText = CMFCVisualManager::GetInstance()->OnDrawPaneCaption(&dc NULL FALSE rectMyCalendarsCaption CRect(0 0 0 0));

CPen* pOldPen = dc.Selectobject(&afxGlobalData.penBarShadow);

dc.MoveTo(rectMyCalendarsCaption.left - 1 rectMyCalendarsCaption.top);
dc.LineTo(rectMyCalendarsCaption.right rectMyCalendarsCaption.top);

dc.SelectStockobject(BLACK_PEN);

dc.MoveTo(rectMyCalendarsCaption.left - 1 rectMyCalendarsCaption.bottom);
dc.LineTo(rectMyCalendarsCaption.right rectMyCalendarsCaption.bottom);

dc.Selectobject(pOldPen);

CRect rec

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-08-15 19:17  CCurve\
     目录           0  2015-08-15 17:28  CCurve\CCurve\
     文件      286024  2015-08-15 17:28  CCurve\CCurve\CCurve.aps
     文件        5635  2015-08-13 21:37  CCurve\CCurve\CCurve.cpp
     文件        1055  2015-08-13 21:37  CCurve\CCurve\CCurve.h
     文件       34152  2015-08-15 17:28  CCurve\CCurve\CCurve.rc
     文件         592  2015-08-13 21:37  CCurve\CCurve\CCurve.reg
     文件        7073  2015-08-14 16:32  CCurve\CCurve\CCurve.vcxproj
     文件        4460  2015-08-13 21:42  CCurve\CCurve\CCurve.vcxproj.filters
     文件         143  2015-08-13 21:37  CCurve\CCurve\CCurve.vcxproj.user
     文件        3828  2015-08-14 11:41  CCurve\CCurve\CCurveDoc.cpp
     文件        1668  2015-08-14 11:40  CCurve\CCurve\CCurveDoc.h
     文件       19305  2015-08-15 17:11  CCurve\CCurve\CCurveView.cpp
     文件        2455  2015-08-15 16:39  CCurve\CCurve\CCurveView.h
     文件        4104  2015-08-13 21:37  CCurve\CCurve\CalendarBar.cpp
     文件        1061  2015-08-13 21:37  CCurve\CCurve\CalendarBar.h
     文件        2013  2015-08-13 21:37  CCurve\CCurve\ChildFrm.cpp
     文件        1012  2015-08-13 21:37  CCurve\CCurve\ChildFrm.h
     目录           0  2015-08-15 19:17  CCurve\CCurve\Debug\
     文件       10253  2015-08-13 21:37  CCurve\CCurve\MainFrm.cpp
     文件        2223  2015-08-13 21:37  CCurve\CCurve\MainFrm.h
     文件        4192  2015-08-13 21:37  CCurve\CCurve\ReadMe.txt
     文件         881  2015-08-14 11:28  CCurve\CCurve\Stroke.cpp
     文件         437  2015-08-14 19:58  CCurve\CCurve\Stroke.h
     目录           0  2015-08-15 13:46  CCurve\CCurve\res\
     文件       67777  2009-08-31 02:31  CCurve\CCurve\res\CCurve.ico
     文件         668  2015-08-13 21:37  CCurve\CCurve\res\CCurve.rc2
     文件        4710  2009-08-31 02:31  CCurve\CCurve\res\CCurveDoc.ico
     文件        1078  2009-08-31 02:31  CCurve\CCurve\res\Toolbar.bmp
     文件        5816  2009-08-31 03:59  CCurve\CCurve\res\Toolbar256.bmp
     文件        5176  2009-08-31 03:59  CCurve\CCurve\res\buttons.bmp
............此处省略23个文件信息

评论

共有 条评论