C++MFC使用GDI+
来源:互联网 发布:软件培训班学费 编辑:程序博客网 时间:2024/06/11 02:13
using namespace Gdiplus;
#pragma comment(lib, "gdiplus.lib")
GdiplusStartupInput m_gdiplusStartupInput;
Pen myPen(Color::Red,50);
myPen.SetWidth(20);
g.DrawLine(&myPen,50, 50, 145, 365);
Pen* myPen = newPen(Color::Red,50);
g.DrawLine(myPen,50, 50, 145, 365);
PRB:Microsoft Foundation Classes DEBUG_NEW Does Not Work withGDI+
ArticleID
Last Review
Revision
This article was previously published underQ317799
SYMPTOMS
When you build a debug version of a Microsoft Foundation Classes(MFC) application that uses GDI+, you may receive an error messagethat resembles the following:
error C2660: 'Gdiplus::GdiplusBase::operatornew' : function does not take 3 parameters
CAUSE
In debugbuilds, MFC defines a preprocessor macro that expands the newoperator to an overloaded new operator that takes two extraparameters. The extra parameters are the source file name and codeline number. MFC can use this information to report memory leaks tothe programmer when in debug mode. This works for MFC classesbecause MFC provides overloads for new that accept the extraparameters.
However, because this expansion is done by thepreprocessor, it affects all usage of the new operator. If anynon-MFC classes are used in the project, their new operator is alsoexpanded, even if no suitable overload of new is available in thatclass. This is what happens in GDI+, and as a result, you receive acompile-time error message.
WORKAROUND
To workaround this problem, choose one of the followingmethods:
"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
NOTE: This method has the disadvantage of notusing features in MFC that help you track memory allocations andleaks.
"
//// Ensure that GdiPlus header files workproperly with MFC DEBUG_NEW and STL header files.
#define iterator _iterator
#ifdef _DEBUG
namespace Gdiplus
{
}
#endif // #ifdef _DEBUG
#include <gdiplus.h>
#undef iterator
//// Ensure that Gdiplus.lib is linked.
#pragma comment(lib, "gdiplus.lib")
- C++MFC使用GDI+
- C++/MFC-GDI绘图
- MFC 使用 GDI+
- mfc GDI+ 使用 一
- MFC中使用GDI+
- MFC或原生C/C++中使用GDI+
- MFC使用GDI+编程基础
- MFC使用GDI+编程设置
- MFC使用GDI+编程设置
- VC2008中MFC使用GDI+
- MFC使用GDI+编程基础
- MFC使用GDI+编程基础
- 在MFC里使用GDI+
- 在MFC里使用GDI+
- 在MFC里使用GDI+
- MFC使用GDI+编程基础
- C#: GDI+使用示例
- C++/MFC-GDI绘图之CBrush画刷
- java 获得某月的第一天和最后一天
- PHP网页超时
- struts 2的文件上传
- android 点九PNG技术 适应不同分辨率 完美显示效果
- 单片机编译器中局部变量和全局变量的深入解析
- C++MFC使用GDI+
- 从Cinder volume启动虚拟机
- 使用Spring CommonsMultipartResolver 上传文件
- Tornado编译vxworks本质及过程
- 最便捷、最强大、速度最快的C++序列化框架
- Citrus Engine简单Demo
- VBA宏:覆盖文件时关闭提示信息
- 深入学习makefile,用makefile编译动态库
- How to see the Master Page option Under Look and Feel in site settings?