Click to See Complete Forum and Search --> : load a bitmap into a dialog box


doxdici
March 19th, 2005, 04:19 AM
hallo,
i have to load a bitmap from a file into a dialog box, how can i do this?
thanks,Isabella

Elementer
March 19th, 2005, 06:42 AM
Hello,
first import the bitmap to your resource, if vc++ say to you "the bitmap have more that 256 color" it's ok, don't worry about, you can't see it within vc++ image editor, but it works.
After, add a simple "picture" control to your dialog, and select the bitmap through its properties, the bitmap will draw within the control.

Bye

guestgulkan
March 19th, 2005, 01:07 PM
Aha - I thought she meant how to load a bitmap file while a program
was running and display it.

teuf008
March 22nd, 2005, 11:51 AM
Does anyone knows :
"how to load a bitmap file while a program is running and display it" in visual C++ 6.0 ????
i already get the full name and path of the bmp thanks to the commun dialog box "OPEN" but how to display it????
Thanks

Orf
March 23rd, 2005, 10:24 PM
Maybe this can help?

---------------------------------------------


HBITMAP m_hbmpBkgnd;

m_hbmpBkgnd = (HBITMAP) LoadImage( NULL, m_strPathBackground, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE );

{
CDC dcMemory;
dcMemory.CreateCompatibleDC( &dc );


CBitmap* pbmp = CBitmap::FromHandle( m_hbmpBkgnd );

BITMAP bmpInfo;
pbmp->GetBitmap(&bmpInfo);


CBitmap* pOldBitmap = dcMemory.SelectObject( pbmp );

dc.BitBlt( 0, 0, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory, 0, 0, SRCCOPY );
}

teuf008
April 7th, 2005, 08:43 AM
Thank's to all of you !
I managed to do what i wanted to.
TTYS
Teuf008