首先头文件 改成#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT#include <COMDEF.H>
#ifndef ULONG_PTR
#define ULONG_PTR unsigned long*
#include "GdiPlus.h"
using namespace Gdiplus;
#endif
#pragma comment(lib,"gdiplus.lib")
这个代码也添加了
GdiplusStartup(&m_pGdiToken,&m_gdiplusStartupInput,NULL);
GdiplusShutdown(m_pGdiToken);然后最终的程序是
Graphics graphics(GetDC()->m_hDC);
Image image(L"111.gif",FALSE);
graphics.DrawImage(&image,10,10);为什么就没有东西呢 ,以前没搞过图形的 ,就想显示gif,求指教
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT#include <COMDEF.H>
#ifndef ULONG_PTR
#define ULONG_PTR unsigned long*
#include "GdiPlus.h"
using namespace Gdiplus;
#endif
#pragma comment(lib,"gdiplus.lib")
这个代码也添加了
GdiplusStartup(&m_pGdiToken,&m_gdiplusStartupInput,NULL);
GdiplusShutdown(m_pGdiToken);然后最终的程序是
Graphics graphics(GetDC()->m_hDC);
Image image(L"111.gif",FALSE);
graphics.DrawImage(&image,10,10);为什么就没有东西呢 ,以前没搞过图形的 ,就想显示gif,求指教
解决方案 »
- c#调用mfc扩展dll 遇到的资源问题
- 关于CPropertySheet创建向导对话框后下一步后,出现多分支时的解决方案。
- 基于ACE的服务调用,帮帮我!!
- 在DEBUG下调用CImageList::Draw()成功!但在RESLELE时调用却不成功(返回 0)
- 谁用过_spawnl()函数来调用vb程序啊?
- ISAPI如何获得回调?
- vc 数据库记录的添加和更新问题
- 在第一次客户端连入时,用Accept()的返回参数来接受ip,why老出错
- 关于 COM Elevation Moniker
- 华为(慧通)核心网内部推荐,个人觉得适合毕业一年左右的兄弟们。
- 一个比较奇怪的问题
- 发愁,函数SetMenuItemBitmaps()无效果
这个之后,你要保证图片加载是成功的,否则是显示不出任何东西的
又找了一个代码
Graphics mygraphics(*pDC); //创建一个Graphics对象
//创建一个笔刷第一项是透明度(0--255)后三项是RGB值
SolidBrush brush( Color(100,0,0,255) );
FontFamily fontFamily(L"Latha"); //选择一种字体
Font font( &fontFamily, 1, FontStyleRegular,UnitInch );
PointF pointF(5,5);
mygraphics.DrawString( L"Hello Word!", -1, &font, pointF, &brush ); 他第一句pdc,怎么获得是正确的啊 ,
绘图操作都整理到OnPaint函数中
然后用CPaintDC