Skip to content

Instantly share code, notes, and snippets.

@zett42
Last active June 25, 2019 20:20
Show Gist options
  • Save zett42/56c89105bca6848cc9622ca6a452cb80 to your computer and use it in GitHub Desktop.
Save zett42/56c89105bca6848cc9622ca6a452cb80 to your computer and use it in GitHub Desktop.
CStatic transparent color 0xF0F0F0
// In OnInitDialog()
CRect rc; GetClientRect( rc );
CDC* winDC = GetDC();
CDC memDC; memDC.CreateCompatibleDC( winDC );
int const savedDC = memDC.SaveDC();
m_bitmap.CreateCompatibleBitmap( winDC, rc.Width(), rc.Height() );
memDC.SelectObject( m_bitmap );
memDC.FillSolidRect( rc, RGB( 255, 220, 128 ) );
rc.DeflateRect( 50, 50 );
CBrush brush; brush.CreateSolidBrush( 0xF0F0F0 );
memDC.SelectObject( brush );
memDC.Ellipse( rc );
memDC.RestoreDC( savedDC );
memDC.DeleteDC();
ReleaseDC( winDC );
// This is a CStatic member of the dialog
m_pictureCtrl.SetBitmap( m_bitmap );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment