title: Picture Control background is gray and I want it white
body: <p>My application has a picture control, whose background is gray and I want it to be white. I already tried several things, like: derive a class and override <code>OnPaint</code> method; respond to <code>WM_CTLCOLOR</code> message (adding <code>ON_WM_CTLCOLOR()</code>and processing it), but no success.</p>
  
  <p>Entry on Message map:</p>
  
  <pre><code>ON_WM_CTLCOLOR()
  </code></pre>
  
  <p>Implementation:</p>
  
  <pre><code>BOOL CMyDialog::OnInitDialog()
  {
      __super::OnInitDialog();
  
      white.CreateSolidBrush(RGB(255,255,255));
  
      //...
  
      return TRUE;  // return TRUE  unless you set the focus to a control
  }
  
  
  HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  {
      if (pWnd == GetDlgItem(IDC_PICTURE))
      {
          return white;
      }
  
      return __super::OnCtlColor(pDC, pWnd, nCtlColor);
  }
  </code></pre>
  
  <p>Header file class definition:</p>
  
  <pre><code>CBrush white;
  
  HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/jM4db.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jM4db.png" alt="gray back"></a></p>