how to add an image in the form in vc++??
-
hi Experts, i am again asking u all to one more problem. in the i add picture box but i didnt know how to add the image and what code should i add to show image when i execute that program thanku one and all, regards, savitri, :)
In visual C project (MFC type) go to insert menu and select bitmap option. Browse for your picture file and add it.Under resources tab in the project navigator check the ID of the bitmap file. Then under OnPaint() function add this piece of code. CPaintDC dc(this); CBitmap bmp , *poldBmp; CDC memdc; bmp.LoadBitmap(IDB_BITMAP1); // IDB_BITMAP1 is the ID of the bitmap loaded mdmdc.CreateCOmpatibleDC(&dc); poldBmp= memdc.SelectObject(&bmp); dc.BitBlt(10,10,47,47,&memdc,0,0,SRCCOPY); memdc.SelectObject(poldBmp); //Do not call CDialog::Onpaint() for painting
-
hi Experts, i am again asking u all to one more problem. in the i add picture box but i didnt know how to add the image and what code should i add to show image when i execute that program thanku one and all, regards, savitri, :)
savitri wrote:
in the i add picture box but i didnt know how to add the image and what code should i add to show image when i execute that program
I think you are looking for Win forms help. Then I think this is not the message board, you have dedicated message board for WF. Anyway, right click the picture box you have "Choose Image" option in the context menu. Or go to the property View and Image Option has the field to set the Image. And if you looking for Picture Control in win32/MFC, in the property view, set the type of picture control to Bitmap, and specify the ID of the bitmap resource in the Image field
modified on Tuesday, March 4, 2008 7:47 AM
-
hi Experts, i am again asking u all to one more problem. in the i add picture box but i didnt know how to add the image and what code should i add to show image when i execute that program thanku one and all, regards, savitri, :)
You can use of this code for insert image to your control. #include AtlImage.h CImage m; m.Load(_T("c:\\1.jpg")); m_Control.SetBitmap(m_.detach());
-
In visual C project (MFC type) go to insert menu and select bitmap option. Browse for your picture file and add it.Under resources tab in the project navigator check the ID of the bitmap file. Then under OnPaint() function add this piece of code. CPaintDC dc(this); CBitmap bmp , *poldBmp; CDC memdc; bmp.LoadBitmap(IDB_BITMAP1); // IDB_BITMAP1 is the ID of the bitmap loaded mdmdc.CreateCOmpatibleDC(&dc); poldBmp= memdc.SelectObject(&bmp); dc.BitBlt(10,10,47,47,&memdc,0,0,SRCCOPY); memdc.SelectObject(poldBmp); //Do not call CDialog::Onpaint() for painting
I think he wants to insert a image to a control(maybe static control or no).