|
-
March 31st, 1999, 04:45 PM
#1
Bitmap in MDI MAINFRAME
How can i display a bitmap in a MDI MainFrame (on the back) not on a child ?
If no possible, is it possible to have a childFrame that doesn't come front when mouse click on?
thanks for your answer.
-
March 31st, 1999, 07:38 PM
#2
Re: Bitmap in MDI MAINFRAME
You can do it usings OnEraseBkgnd and SubclassWindow(m_hWndMDIClient)like this:
.
subclass the MDI client window with a CWnd derived class lets call it
CBackground. use class wizard to add handles for the WM_ERASEBKGND and WM_SIZE
messages.
edit CBackground::OnEraseBkgnd to display your bitmap, you might want to size it to the size of your window client.
dont forget to return TRUE to indicate the background was erased.
Edit Cbackground::OnSize to include Invalidtate(TRUE).
Next step is to Add a member variable of your CBackground type to your main applications window class and use
SubclassWindow() in your mains application OnCreate() like this
class CMainFrame ublic CMDIFrameWnd
(//...
protected:
CBackground m_wndBackground;
//...}
.
int CMainFrame::OnCreate(...) {
//...
if( !m_wndBackground.SubclassWindow(m_hWndMDIClient))
{ return -1;}
//m_hWndMDIClient is an undocumented member of CMDI FrameWnd class.
good luck
-
April 1st, 1999, 04:00 AM
#3
Re: Bitmap in MDI MAINFRAME
Hi,
How to draw the bitmap in OnEraseBkgnd?
Raphael
-
April 1st, 1999, 01:57 PM
#4
Re: Bitmap in MDI MAINFRAME
There are many ways to draw a bitmap. heres one...
.
//declare m_bitmap as a CBitmap in the CBackground constructor
//load it with LoadBitmap()
Bool CBackground::OneraseBkgnd(CDC* pDC) //see other posts for explanation
CDC dcMem;
dcMem.CreateCompatibleDC(pDC);
CBitmap* pOldBitmap=dcMem.SelectObject(&m_bitmap);
BITMAP bmp;
m_bitmap.GetObject(sizeof(bmp),&bmp); //get size
CRect rect;
GetClientRect(&rect); //get size of window
pDC->StretchBlt(rect.left,rect.top,rect.Width(),rect.Height(),&dcMem,
0,0,bmp.bmWidth,bmp.bmHeight,SRCOPY);
dcMem.SelectObject(pOldBitmap);
return TRUE;
)
good luck
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|