title: Displaying image in MFC method that is not ONPaint
body: <p>I am trying to display an image in a dialog dynamically, it works no problem if I put the code in the on paint method and use the dc from there, I can't do this though I need to display after the window is shown, the code I am using is as follows, I am getting the dc of the client window creating the bitmap from a resource and "trying" to display it in the window but nothing displays, Any suggestions what might be wrong?</p>
  
  <pre><code>void CProcessSteps::OnShowWindow(BOOL bShow, UINT nStatus) 
  {
      CDialog::OnShowWindow(bShow, nStatus);  
  
      SetupInstructions();&lt;-----------------Call To Method
  }
  
  
  
  
  void CProcessSteps::OnPaint() 
  {   
      CPaintDC dc(this);
  }
  
  void CProcessSteps::SetupInstructions()
  {
      CDC *pDC = new CDC();&lt;------------------------------Problem starts here
      CFontUtil cfu;
      cfu.SetFont(&amp;LineFont,30);
  
      CDC memDC;
      memDC.CreateCompatibleDC(pDC);
  
      int stepTop = 10;
      int stepEnd = 230;
      int imageLeft = 30;
      STEP_STRUCT* step;
  
      CBitmap iconImage;
      iconImage.LoadBitmap ( IDB_TID_CHECK );
  
      memDC.SelectObject(&amp;iconImage);
  
      CRect iconRect;
      BITMAP bmInfo;
      iconImage.GetObject ( sizeof ( bmInfo ), &amp;bmInfo );
      iconRect.SetRect ( imageLeft, stepTop, imageLeft+bmInfo.bmWidth, stepTop+bmInfo.bmHeight );
  
      pDC = this-&gt;GetDC();
      pDC-&gt;BitBlt(imageLeft, stepTop, imageLeft+bmInfo.bmWidth, stepTop+bmInfo.bmHeight, &amp;memDC, 0, 0, SRCCOPY);
  
      //RedrawWindow();&lt;-------- tried this here no luck
  
      int stepCount = m_pageStructure-&gt;PageSteps.GetCount();&lt;----------------------------Bellow this works correctly
  
      POSITION pos = m_pageStructure-&gt;PageSteps.GetHeadPosition();
      while (pos)
      {
          step = m_pageStructure-&gt;PageSteps.GetNext(pos);
  
          CStatic *label = new CStatic;
          label-&gt;Create(_T( step-&gt;StepInstruction ),WS_CHILD | WS_VISIBLE, CRect(80, stepTop, 480, stepEnd), this);
          label-&gt;SetFont(&amp;LineFont, true);
  
  
          label-&gt;GetWindowRect(rect);
          ScreenToClient(rect);
  
          pDC = label-&gt;GetDC();
          pDC-&gt;SelectObject(&amp;LineFont);
          pDC-&gt;DrawText(step-&gt;StepInstruction, &amp;rect, DT_CALCRECT|DT_WORDBREAK); 
          label-&gt;ReleaseDC(pDC);
          label-&gt;MoveWindow(rect);    
  
          stepTop += rect.Height();
          stepTop += 30;
          stepEnd += rect.Height();
      }
  }
  </code></pre>