定义 CStatic m_sttZoneStatus;CBitmap m_bmpZoneInfo;
DDX_Control(pDX,IDC_STATIC_ZONESTATUS,m_sttZoneStatus);oninitdialog()方法中
m_sttZoneStatus.SetWindowText("");
m_sttZoneStatus.ModifyStyle(0,SS_BITMAP|SS_CENTERIMAGE);
m_bmpZoneInfo.DeleteObject();
m_bmpZoneInfo.LoadBitmap(IDB_BITMAP_ZONESTATUS);
m_sttZoneStatus.SetBitmap(m_bmpZoneInfo);
为什么老是不能显示,大家帮帮忙

解决方案 »

  1.   


    UpdateData(False);:)
      

  2.   

    If you're going to display a bitmap, cursor, icon, or metafile in the static control, you'll need to apply one of the following static styles: SS_BITMAP   Use this style for bitmaps.SS_ICON   Use this style for cursors and icons.SS_ENHMETAFILE   Use this style for enhanced metafiles.
      

  3.   

    看Winuser.h中SS_BITMAP的定义#define SS_LEFT             0x00000000L
    #define SS_CENTER           0x00000001L
    #define SS_RIGHT            0x00000002L
    #define SS_ICON             0x00000003L
    #define SS_BLACKRECT        0x00000004L
    #define SS_GRAYRECT         0x00000005L
    #define SS_WHITERECT        0x00000006L
    #define SS_BLACKFRAME       0x00000007L
    #define SS_GRAYFRAME        0x00000008L
    #define SS_WHITEFRAME       0x00000009L
    #define SS_USERITEM         0x0000000AL
    #define SS_SIMPLE           0x0000000BL
    #define SS_LEFTNOWORDWRAP   0x0000000CL
    #if(WINVER >= 0x0400)
    #define SS_OWNERDRAW        0x0000000DL
    #define SS_BITMAP           0x0000000EL
    #define SS_ENHMETAFILE      0x0000000FL
    #define SS_ETCHEDHORZ       0x00000010L
    #define SS_ETCHEDVERT       0x00000011L
    #define SS_ETCHEDFRAME      0x00000012L
    #define SS_TYPEMASK         0x0000001FL它们并不是位的关系
    m_sttZoneStatus.ModifyStyle(SS_TYPEMASK, 
      SS_BITMAP|SS_CENTERIMAGE,
      SWP_FRAMECHANGED|SWP_DRAWFRAME);
      

  4.   

    loadmap后,cbitmap对象的m_hobject还是为0x000000,是什么原因貌似不是楼上的原因
      

  5.   

    If the bitmap identified by lpszResourceName does not exist or if there is insufficient memory to load the bitmap, the function returns 0.
      

  6.   

    先拿着个试试
    CStatic控件 右键->proterties:
    Type设置成Bitmap
    Image设置成IDC_YOUR_BITMAP_ID
      

  7.   

    LOADBITMAP后用GETLASTERROR获取的错误码是1813但是我明明已经定义了该资源,在.rc文件以及resource.h中都能找到
      

  8.   

    LOADBITMAP后用GETLASTERROR获取的错误码是1813但是我明明已经定义了该资源,在.rc文件以及resource.h中都能找到