首先头文件 改成#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,求指教

解决方案 »

  1.   

    你把111.gif换成个BMP的文件试试,另个,把范围放大些,比如:graphics.DrawImage(&image,100,100);免得太小不能显示图片
      

  2.   

    Image image(L"111.gif",FALSE);
    这个之后,你要保证图片加载是成功的,否则是显示不出任何东西的
      

  3.   

    好像是没有成功获得
    又找了一个代码 
    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,怎么获得是正确的啊  ,
      

  4.   

    你在窗口的OnPaint函数或者视图的OnDraw里执行试试,是不是没刷新
      

  5.   

    你这代码写哪了
    绘图操作都整理到OnPaint函数中
    然后用CPaintDC