帖BitMap

 

 

 

void CEx_14View::OnDraw(CDC* pDC)
{
    CEx_14Doc
* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
////////////////////////////////////////////////////////////画bitmap图   
    CBitmap bitmap;
    bitmap.LoadBitmap(IDB_BITMAP1);
    CDC MemDC;
    MemDC.CreateCompatibleDC(pDC);
//创建兼容的内存设备描述表
    CBitmap *pOldBitmap=MemDC.SelectObject(&bitmap);
    BITMAP bm;
    bitmap.GetBitmap(
&bm);
    pDC
->BitBlt(0,0,bm.bmWidth,bm.bmHeight,&MemDC,0,0,SRCCOPY);
    MemDC.SelectObject(pOldBitmap);

////////////////////////////////////////////////////////////////
    // TODO: add draw code for native data here
}

 

 

 

修改item

LV_ITEM lvi;
  lvi.mask = LVIF_PARAM|LVIF_TEXT;
  lvi.iItem = index;
  lvi.iSubItem = 0;
  lvi.pszText = (LPTSTR)(LPCTSTR)itemData->className;
  lvi.lParam = (LPARAM)itemData;
  listQuestion->SetItem(&lvi);

 

//insert a bitmap to the headerColumn
   for(int i=0; i<headerCount; i++){
    HD_ITEM hditem;
    hditem.mask = HDI_BITMAP | HDI_FORMAT;
    VERIFY(m_Lvn_Question.GetHeaderCtrl()->GetItem(i,&hditem));
    if (hditem.fmt & HDF_BITMAP && hditem.fmt & HDF_BITMAP_ON_RIGHT)
    {
     if (hditem.hbm)
     {
      VERIFY( DeleteObject(hditem.hbm) );
      hditem.hbm = NULL;
     }
     hditem.fmt &= ~(HDF_BITMAP|HDF_BITMAP_ON_RIGHT);
      VERIFY( m_Lvn_Question.GetHeaderCtrl()->SetItem(i, &hditem) );
    }
    
    if(i == 0 || i == 1){
     hditem.fmt |= HDF_BITMAP|HDF_RIGHT|HDF_BITMAP_ON_RIGHT;
     hditem.hbm = LoadBitmapW(AfxGetInstanceHandle(),MAKEINTRESOURCEW(IDB_BITMAP_DropDown));
     VERIFY( hditem.hbm!=NULL );
     VERIFY( m_Lvn_Question.GetHeaderCtrl()->SetItem( i, &hditem ) );
    }
   }

你可能感兴趣的:(bitmap)