Trying to display a CImage on a CDialog in OnPaint handler

85 Views Asked by At

I have a JPG resource in my MFC application. I try to load it like this in OnInitDialog:

m_imgSplash.LoadFromResource(AfxGetResourceHandle(), IDR_SPLASHSCREEN);

Then, in the OnPaint handler I do the following:

void CSplashDlg::OnPaint() 
{
    CPaintDC dc(this); // device context for painting

    m_imgSplash.Draw(dc.GetSafeHdc(), m_rctSplash);
}

But I am not seeing my image ...

I saw this question but CResourceStream is unknown.

0

There are 0 best solutions below