Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Dialog Bitmap Backgrounds

Dialog Bitmap Backgrounds

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharpcomgraphicshelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    orcblood
    wrote on last edited by
    #1

    I triend to go through this tutorial: http://www.codeproject.com/dialog/bmpdlg01.asp. However, it is for MSVC++.net. So therefore it will not work with my version of MSVC++. I was wondering how I would change the bg of a dialog either in MFC or in C++. If anyone could help me then it would be greatly appreciated. orcblood

    B 1 Reply Last reply
    0
    • O orcblood

      I triend to go through this tutorial: http://www.codeproject.com/dialog/bmpdlg01.asp. However, it is for MSVC++.net. So therefore it will not work with my version of MSVC++. I was wondering how I would change the bg of a dialog either in MFC or in C++. If anyone could help me then it would be greatly appreciated. orcblood

      B Offline
      B Offline
      Big Art
      wrote on last edited by
      #2

      Do the following... // 1. Add a CBrush member function... CBrush mBrush; ---------- // 2. In OnInitDialog... //Load the bitmap from a file and create patterned brush. RECT rc; GetClientRect(&rc); HBITMAP hBmp=NULL; hBmp=(HBITMAP)::LoadImage(NULL,"c:\\YourImagePath\\TheBitmap.bmp",IMAGE_BITMAP,rc.right,rc.bottom,LR_LOADFROMFILE); CBitmap *pBmp=CBitmap::FromHandle(hBmp); m_brush.CreatePatternBrush(pBmp); ::DeleteObject(hBmp); ---------- // 3. In OnPaint... //Paint the background with the image brush CRect rcClient; GetClientRect(&rcClient); dc.FillRect(&rcClient,&m_brush); --------------- // 4. In OnCtlColor.. // You need to do this to keep any static text controls on your // dialog from painting a default dialog background under the static field. switch(nCtlColor) { case CTLCOLOR_STATIC: pDC->SetTextColor(RGB(....)); //Set your text color. case CTLCOLOR_BTN: pDC->SetBkMode(TRANSPARENT); case CTLCOLOR_DLG: hbr=m_brush; } ---------------- Art

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups