Bitmap behind documents
-
I want to add a logo bitmap, either tiled or centered, behind my document windows so that when they are minimized it displays the logo. I'm not quite sure how to approach this, any ideas? : Dean 'Karnatos' Michaud
-
I want to add a logo bitmap, either tiled or centered, behind my document windows so that when they are minimized it displays the logo. I'm not quite sure how to approach this, any ideas? : Dean 'Karnatos' Michaud
This post of mine shows you how. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
-
This post of mine shows you how. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
What was the date it was written? For some reason the link doesn't forward me onto the post, but I am guessing it has something to do with my job-place's horrible caching server messing things up yet again. If you could repost it, or point me to the date it was published I might be able to work around this caching server's annoyance. Thank you for the help! : Dean 'Karnatos' Michaud
-
What was the date it was written? For some reason the link doesn't forward me onto the post, but I am guessing it has something to do with my job-place's horrible caching server messing things up yet again. If you could repost it, or point me to the date it was published I might be able to work around this caching server's annoyance. Thank you for the help! : Dean 'Karnatos' Michaud
I guess the problem is you're not using DHTML, and the URL changes with this optio on. Anyway, here's the post again. --repost It's simple task, but many steps are required:
-
Create a new
CWnd
-derived class, sayCBackgroundWnd
. -
Add these two members to
CBackgroundWnd
:CBitmap m_bitmap_background;
BITMAP m_bmInfo_background;along with this piece of code in
CBackgroundWnd
ctor:m\_bitmap\_background.LoadBitmap(IDB\_BACKGROUND); // change IDB\_BACKGROUND to whatever your resource-located bitmap is called. ::GetObject(m\_bitmap\_background,sizeof(BITMAP),&m\_bmInfo\_background);
-
Add a handler for
WM_ERASEBKGND
inCBackgroundWnd
and plug this code (which draws the bitmap in tesellation mode)BOOL CBackgroundWnd::OnEraseBkgnd(CDC* pDC)
{
CRect rect;
GetClientRect(rect);CDC dcMem; dcMem.CreateCompatibleDC(pDC); HBITMAP\* pBmpOld=(HBITMAP\*)::SelectObject(dcMem.m\_hDC,m\_bitmap\_background); for(int y=rect.top;y<rect.bottom;y+=m\_bmInfo\_background.bmHeight){ for(int x=rect.left;x<=rect.right;x+=m\_bmInfo\_background.bmWidth){ pDC->BitBlt(x,y,m\_bmInfo\_background.bmWidth,m\_bmInfo\_background.bmHeight, &dcMem,0,0,SRCCOPY); } } ::SelectObject(dcMem.m\_hDC, pBmpOld); return TRUE;
}
-
Add a member of type
CBackgroundWnd
to yourCMainFrame
class, saym_wndClient
. -
Override
CMainFrame::OnCreateClient
with this:BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if(!CMDIFrameWnd::OnCreateClient(lpcs, pContext))return FALSE;
m_wndClient.SubclassWindow(m_hWndMDIClient);
return TRUE;
}
That's it, I think. Good luck. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo --end repost Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
-
-
I guess the problem is you're not using DHTML, and the URL changes with this optio on. Anyway, here's the post again. --repost It's simple task, but many steps are required:
-
Create a new
CWnd
-derived class, sayCBackgroundWnd
. -
Add these two members to
CBackgroundWnd
:CBitmap m_bitmap_background;
BITMAP m_bmInfo_background;along with this piece of code in
CBackgroundWnd
ctor:m\_bitmap\_background.LoadBitmap(IDB\_BACKGROUND); // change IDB\_BACKGROUND to whatever your resource-located bitmap is called. ::GetObject(m\_bitmap\_background,sizeof(BITMAP),&m\_bmInfo\_background);
-
Add a handler for
WM_ERASEBKGND
inCBackgroundWnd
and plug this code (which draws the bitmap in tesellation mode)BOOL CBackgroundWnd::OnEraseBkgnd(CDC* pDC)
{
CRect rect;
GetClientRect(rect);CDC dcMem; dcMem.CreateCompatibleDC(pDC); HBITMAP\* pBmpOld=(HBITMAP\*)::SelectObject(dcMem.m\_hDC,m\_bitmap\_background); for(int y=rect.top;y<rect.bottom;y+=m\_bmInfo\_background.bmHeight){ for(int x=rect.left;x<=rect.right;x+=m\_bmInfo\_background.bmWidth){ pDC->BitBlt(x,y,m\_bmInfo\_background.bmWidth,m\_bmInfo\_background.bmHeight, &dcMem,0,0,SRCCOPY); } } ::SelectObject(dcMem.m\_hDC, pBmpOld); return TRUE;
}
-
Add a member of type
CBackgroundWnd
to yourCMainFrame
class, saym_wndClient
. -
Override
CMainFrame::OnCreateClient
with this:BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if(!CMDIFrameWnd::OnCreateClient(lpcs, pContext))return FALSE;
m_wndClient.SubclassWindow(m_hWndMDIClient);
return TRUE;
}
That's it, I think. Good luck. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo --end repost Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
-
-
Joaquín , what does it mean "tesellation mode" ? Could you explain ? Cheers, Joao Vaz A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
Same as "mosaic mode": the bitmap is repeated horizontally and vertically to cover all the area. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
-
Same as "mosaic mode": the bitmap is repeated horizontally and vertically to cover all the area. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
-
I guess the problem is you're not using DHTML, and the URL changes with this optio on. Anyway, here's the post again. --repost It's simple task, but many steps are required:
-
Create a new
CWnd
-derived class, sayCBackgroundWnd
. -
Add these two members to
CBackgroundWnd
:CBitmap m_bitmap_background;
BITMAP m_bmInfo_background;along with this piece of code in
CBackgroundWnd
ctor:m\_bitmap\_background.LoadBitmap(IDB\_BACKGROUND); // change IDB\_BACKGROUND to whatever your resource-located bitmap is called. ::GetObject(m\_bitmap\_background,sizeof(BITMAP),&m\_bmInfo\_background);
-
Add a handler for
WM_ERASEBKGND
inCBackgroundWnd
and plug this code (which draws the bitmap in tesellation mode)BOOL CBackgroundWnd::OnEraseBkgnd(CDC* pDC)
{
CRect rect;
GetClientRect(rect);CDC dcMem; dcMem.CreateCompatibleDC(pDC); HBITMAP\* pBmpOld=(HBITMAP\*)::SelectObject(dcMem.m\_hDC,m\_bitmap\_background); for(int y=rect.top;y<rect.bottom;y+=m\_bmInfo\_background.bmHeight){ for(int x=rect.left;x<=rect.right;x+=m\_bmInfo\_background.bmWidth){ pDC->BitBlt(x,y,m\_bmInfo\_background.bmWidth,m\_bmInfo\_background.bmHeight, &dcMem,0,0,SRCCOPY); } } ::SelectObject(dcMem.m\_hDC, pBmpOld); return TRUE;
}
-
Add a member of type
CBackgroundWnd
to yourCMainFrame
class, saym_wndClient
. -
Override
CMainFrame::OnCreateClient
with this:BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if(!CMDIFrameWnd::OnCreateClient(lpcs, pContext))return FALSE;
m_wndClient.SubclassWindow(m_hWndMDIClient);
return TRUE;
}
That's it, I think. Good luck. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo --end repost Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
Man, beautiful! I'm glad I asked, I was taking a different approach and it was causing undeserved headache! Thanks again Joaquín : Dean 'Karnatos' Michaud
-