Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Picture display in VC application

Status
Not open for further replies.

alzomor

Advanced Member level 2
Joined
Jun 9, 2005
Messages
678
Helped
39
Reputation
78
Reaction score
8
Trophy points
1,298
Location
Cairo
Activity points
6,417
Hi

How to dispaly a picture in my VC application ?

Salam
Hossam Alzomor
 

Zhasha

Junior Member level 3
Joined
Dec 3, 2005
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Denmark
Activity points
1,643
by display a picture you mean where?
 

alzomor

Advanced Member level 2
Joined
Jun 9, 2005
Messages
678
Helped
39
Reputation
78
Reaction score
8
Trophy points
1,298
Location
Cairo
Activity points
6,417
Hi

anywhere in the application window
and I need to display another picture in the same place after some clicks
Do you know how?

Salam
Hossam Alzomor
 

sshahid47

Advanced Member level 4
Joined
Nov 5, 2004
Messages
101
Helped
15
Reputation
30
Reaction score
2
Trophy points
1,298
Activity points
974
hi,

yes you can display any picture you want in VC++ application window,
it basically depends on what format your picture file is in is it a bmp or a gif ?,
however the basic idea is to load the picture in a device context (CDC) and then bitblt it into the application window's OnPaint method.
please refer to MSDN the api calls such as CDC::BitBlt etc....
let me know if you need a sample program.
 

hoangkhoi

Newbie level 6
Joined
Nov 24, 2005
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,416
void CPaintDlg::ShowBitmap(CPaintDC *pdc, CWnd *pWnd)
{
// Convert the pointer to a pointer to the main dialog class
CGraphicsDlg *lpWnd = (CGraphicsDlg*)pWnd;
BITMAP bm;
// Get the loaded bitmap
lpWnd->m_bmpBitmap.GetBitmap(&bm);
CDC dcMem;
// Create a device context to load the bitmap into
dcMem.CreateCompatibleDC(pdc);
// Select the bitmap into the compatible device context
CBitmap* pOldBitmap = (CBitmap*)dcMem.SelectObject
CRect lRect;
// Get the display area available
GetClientRect(lRect);
lRect.NormalizeRect();
// Copy and resize the bitmap to the dialog window
pdc->StretchBlt(10, 10, (lRect.Width() - 20),
(lRect.Height() - 20), &dcMem, 0, 0,
bm.bmWidth, bm.bmHeight, SRCCOPY);
}
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top