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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC Skinning

MFC Skinning

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++graphicslearning
3 Posts 3 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.
  • G Offline
    G Offline
    Greven
    wrote on last edited by
    #1

    Been reading up on doing a win32 skin, and I can do it great in a standard win32 app. But now I try to do it in an MFC doc/view app and it doesn't quite work the same. I have a bitmap in my resource file, and I create a CBitmap from it. I can BitBlt it from the OnDraw function, but it will only draw in the view area... Not the whole app. How can I get it to draw over the entire application? Here is my current code that I'm using: void CSkinTestView::OnDraw(CDC* pDC) { CSkinTestDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); CDC memdc; memdc.CreateCompatibleDC(pDC); memdc.SelectObject((HBITMAP)m_Skin); pDC->BitBlt(0, 0, 200, 75, &memdc, 0, 0, SRCCOPY); } m_Skin is a CBitmap variable that is created and grabs the bitmap from the resource in PreCreateWindow(). What can I change? I tried putting this type of thing in the Mainframe's paint call, but get all kinds of fun errors... Any sugggestions? Programming in binary is as easy as 01 10 11.

    A J 2 Replies Last reply
    0
    • G Greven

      Been reading up on doing a win32 skin, and I can do it great in a standard win32 app. But now I try to do it in an MFC doc/view app and it doesn't quite work the same. I have a bitmap in my resource file, and I create a CBitmap from it. I can BitBlt it from the OnDraw function, but it will only draw in the view area... Not the whole app. How can I get it to draw over the entire application? Here is my current code that I'm using: void CSkinTestView::OnDraw(CDC* pDC) { CSkinTestDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); CDC memdc; memdc.CreateCompatibleDC(pDC); memdc.SelectObject((HBITMAP)m_Skin); pDC->BitBlt(0, 0, 200, 75, &memdc, 0, 0, SRCCOPY); } m_Skin is a CBitmap variable that is created and grabs the bitmap from the resource in PreCreateWindow(). What can I change? I tried putting this type of thing in the Mainframe's paint call, but get all kinds of fun errors... Any sugggestions? Programming in binary is as easy as 01 10 11.

      A Offline
      A Offline
      alex barylski
      wrote on last edited by
      #2

      Perhaps GetWindowDC is what your looking for...? The returned device context will let you draw on the entire window, not just client area. Cheers! "An expert is someone who has made all the mistakes in his or her field" - Niels Bohr

      1 Reply Last reply
      0
      • G Greven

        Been reading up on doing a win32 skin, and I can do it great in a standard win32 app. But now I try to do it in an MFC doc/view app and it doesn't quite work the same. I have a bitmap in my resource file, and I create a CBitmap from it. I can BitBlt it from the OnDraw function, but it will only draw in the view area... Not the whole app. How can I get it to draw over the entire application? Here is my current code that I'm using: void CSkinTestView::OnDraw(CDC* pDC) { CSkinTestDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); CDC memdc; memdc.CreateCompatibleDC(pDC); memdc.SelectObject((HBITMAP)m_Skin); pDC->BitBlt(0, 0, 200, 75, &memdc, 0, 0, SRCCOPY); } m_Skin is a CBitmap variable that is created and grabs the bitmap from the resource in PreCreateWindow(). What can I change? I tried putting this type of thing in the Mainframe's paint call, but get all kinds of fun errors... Any sugggestions? Programming in binary is as easy as 01 10 11.

        J Offline
        J Offline
        Jon Hulatt
        wrote on last edited by
        #3

        OnPaint and OnDraw are intended for drawing client windows only, and as such the DC's provided clip to the client window. If you're skinning an app, you'll want to use a combination of handlers for the following messages: WM_ERASEBACKGND WM_NCPAINT WM_NCSIZE etc. Sorry to dissapoint you all with my lack of a witty or poignant signature.

        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