MFC一个窗体设置是全屏,当切换出来再切回去背景图片就消失了,怎么才能解决这个问题

解决方案 »

  1.   

    void COpenGLDialogDlg::OnPaint() 
    {
    Login loginDlg;
    CDC* pDC = GetDC();
    CString m_strPath = "res\\2.jpg";
    loginDlg.ShowJpgGif(pDC,m_strPath,0,0); if (IsIconic())
    {
    CPaintDC dc(this); // Ger鋞ekontext f黵 Zeichnen SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Symbol in Client-Rechteck zentrieren
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2; // Symbol zeichnen
    dc.DrawIcon(x, y, m_hIcon);
    }
    else
    {
    CDialog::OnPaint();
    }
    }
    我本来是想监测键盘,但是不知道怎么实现
      

  2.   

    else
    {
    CDialog::OnPaint();
    }
    把这段代码去掉看看
      

  3.   

    可能需要重新触发WM_PAINT消息,Onsize里边加InvalidateRect(NULL, TRUE)试试