MFC Skinning
-
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.
-
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.
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
-
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.
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.