在ResouceView中插入你的背景图*.bmp;
比如:IDB_BACKGRID
在对话框中画一个CPicture控件,
右键General右面 类型中选Bitmap,
类型下面图像选上你的 IDB_BACKGRID

解决方案 »

  1.   

    映射WM_CTLCOLOR消息,再对应的函数中加入背景
      

  2.   

    在你的对话中加入一个CBitmap成员m_Bitmap,并重载OnEraseBkgnd()
    bool CDlg::SetBkBmp(int nBmpId)
    {
    if(!m_Bitmap.LoadBitmap(nBmpId))
    return false;
    return true;}BOOL CDlg::OnEraseBkgnd (CDC* pDC)
    {
    if(m_Bitmap.GetObjectType())
    {
    CDC dc;
    BITMAP Bmp;
    m_Bitmap.GetBitmap(&Bmp);
    if(!dc.CreateCompatibleDC(pDC))
    return CDialog::OnEraseBkgnd(pDC);
    CBitmap *pOldBmp=dc.SelectObject(&m_Bitmap);
    CRect rect;
    GetWindowRect(&rect);
    int sizex=rect.right-rect.left,sizey=rect.bottom-rect.top;
    int bmpx=Bmp.bmWidth,bmpy=Bmp.bmHeight;
    for(int x=0;x<=sizex;x+=bmpx)
    for(int y=0;y<=sizey;y+=bmpy)
    pDC->BitBlt(x,y,bmpx,bmpy,&dc,0,0,SRCCOPY);
    dc.SelectObject(pOldBmp); return true;
    }
    else
    return CDialog::OnEraseBkgnd(pDC);}
      

  3.   

    No.it's formal method. the only thing hover(翔) (  ) do is not so good
    is:should use a memory cache dc to accelerate speed .