请问大哥.在对话框中,我要应对相应的计算结果,显示出相应的位图.用CStatic类也好,用CButton按钮也好.
请大哥给我段代码.
谢谢谢谢谢谢

解决方案 »

  1.   

    显示位图,MSDN中不是有许多示例?
    如何动态加载位图资源?LoadImage Function
    The LoadImage function loads an icon, cursor, animated cursor, or bitmap.
      

  2.   

    直接在OnPaint里画
    HBITMAP hBmp = (HBITMAP)::LoadAnImage(NULL, "mybmp.bmp",IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    dc.DrawState(pt, size, hBmp, DST_BITMAP | DSS_NORMAL);
      

  3.   

    1.创建位图:
    CBitmap bitmap;
    Bitmap bmp;
    bitmap.LoadBitmap(IDB_BITMAP);
    bmp.GetBitmap(&bitmap);
    2.创建兼容DC:
    CDC dcCompatible;
    dcCompatible.CreateCompatible(pDC);
    3.将位图选到兼容DC 中去:
    dcCompatible.SelectObject(&bmp);
    4.将兼容DC中的位图贴到当前DC中:
    pDC->BitBlt(...);
      

  4.   

    bg=new CBitmap;
    bg->m_hObject=(HBITMAP)::LoadImage(NULL,
    "bground.bmp",IMAGE_BITMAP,720,540,LR_LOADFROMFILE);
    void XXXX::OnPaint() 
    {
    CPaintDC dc(this); // device context for painting

    pdc->SelectObject(bg);
    mdc->BitBlt(0,0,bwidth,bheight,pdc,0,0,SRCCOPY);
    dc.BitBlt(0,0,bwidth,bheight,mdc,0,0,SRCCOPY);

    // TODO: Add your message handler code here

    // Do not call CFrameWnd::OnPaint() for painting messages
    }
      

  5.   

    CButton::SetBitmap
    HBITMAP SetBitmap( HBITMAP hBitmap );Return ValueThe handle of a bitmap previously associated with the button.
    CStatic::SetBitmap
    HBITMAP SetBitmap( HBITMAP hBitmap );Return ValueThe handle of the bitmap previously associated with the static control, or NULL if no bitmap was associated with the static control.