shakir77
asked on
Unable to view Image in picture control
I am trying to load picture in picture control .
But it On running application No image is seen in the Picture control...it shows blank.
Code i have written in InitDialog is:
CBitmap m_bmp;
VERIFY(m_bmp.LoadBitmap(ID B_PICTURE) );
m_pictureToShow.SetBitmap( m_bmp);
m_pictureToShow.UpdateWind ow();
where m_pictureToShow is CStatic defined thru Control Window.
for debugging i just changed to
if( m_pictureToShow.SetBitmap( m_bmp) == NULL)
AfxMessageBox("SetBitMap failed");
& it is showing SetBitMap is returning NULL.
can u pls point out what exactly the problem is ...
or am i doing something wrong .????
But it On running application No image is seen in the Picture control...it shows blank.
Code i have written in InitDialog is:
CBitmap m_bmp;
VERIFY(m_bmp.LoadBitmap(ID
m_pictureToShow.SetBitmap(
m_pictureToShow.UpdateWind
where m_pictureToShow is CStatic defined thru Control Window.
for debugging i just changed to
if( m_pictureToShow.SetBitmap(
AfxMessageBox("SetBitMap failed");
& it is showing SetBitMap is returning NULL.
can u pls point out what exactly the problem is ...
or am i doing something wrong .????
Picture control should have SS_BITMAP style. In the dialog resource editor right-click picture control and select Bitmap type.
ASKER
picture control Type is already set to BitMap.
Still not showing..??????? any reason.
Still not showing..??????? any reason.
SetBitmap function is defined as:
HBITMAP SetBitmap( HBITMAP hBitmap );
So you need:
m_pictureToShow.SetBitmap( (HBITMAP)m _bmp.m_hOb ject);
HBITMAP SetBitmap( HBITMAP hBitmap );
So you need:
m_pictureToShow.SetBitmap(
Hi Shakir77,
Try this.
Add a bitmap in your workspace. Now select the picture control that you have added on the dialog. now go to the property of the picture control, Select Type: as Bitmap, and select the "Image: BITMAP_ID ". This image is the id of the Bitmap that is there in your resource. now close the proerty dialog and you will see the bitmap.
Try it, All the best
Thanks and Regards.
Zfact
Try this.
Add a bitmap in your workspace. Now select the picture control that you have added on the dialog. now go to the property of the picture control, Select Type: as Bitmap, and select the "Image: BITMAP_ID ". This image is the id of the Bitmap that is there in your resource. now close the proerty dialog and you will see the bitmap.
Try it, All the best
Thanks and Regards.
Zfact
ASKER
hi zfact
I cannot set Image value to BITMAP_ID as this ID will be decided on runtime based on some condition from the lot of available Images.
and AlexFM, i tried using your solution still it is failing in VERIFY .
i used VERIFY(m_pictureToShow.Set Bitmap((HB ITMAP)m_bm p.m_hObjec t));
any solution ????????/
I cannot set Image value to BITMAP_ID as this ID will be decided on runtime based on some condition from the lot of available Images.
and AlexFM, i tried using your solution still it is failing in VERIFY .
i used VERIFY(m_pictureToShow.Set
any solution ????????/
ASKER
even without VERIFY ,
m_pictureToShow.SetBitmap( (HBITMAP)m _bmp.m_hOb ject)
no error is coming but no Image seen ...its only blank
m_pictureToShow.SetBitmap(
no error is coming but no Image seen ...its only blank
Try to select image in dialog template, as zfact writes. Do you see it?
ASKER
AlexFm yr solution works....thanx
but one more problem actually BITMAP ID's i have stored in access table.
when i get thru recordset for that index
rs.GetFieldValue(index,csV al);
i'll get BITMAP ID value in CString variable.
how do i change csVal to UINT so that it is accepted by LoadBitmap().
but one more problem actually BITMAP ID's i have stored in access table.
when i get thru recordset for that index
rs.GetFieldValue(index,csV
i'll get BITMAP ID value in CString variable.
how do i change csVal to UINT so that it is accepted by LoadBitmap().
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi shakir77,
Try this, it will work.
//Add The Bitmpm as shown below
CBitmap bm1,bm2;
bm1.LoadBitmap(MAKEINTRESO URCE(IDB_B ITMAP1));
bm2.LoadBitmap(MAKEINTRESO URCE(IDB_B ITMAP2));
//Try changeing the bitmap with respect to your requirements as shown below.
m_ctrlBitMapD.SetBitmap(bm 1);
m_ctrlBitMapD.SetBitmap(bm 2);
Try It, All The Best,
Thanks & Regards
Zfact.
Try this, it will work.
//Add The Bitmpm as shown below
CBitmap bm1,bm2;
bm1.LoadBitmap(MAKEINTRESO
bm2.LoadBitmap(MAKEINTRESO
//Try changeing the bitmap with respect to your requirements as shown below.
m_ctrlBitMapD.SetBitmap(bm
m_ctrlBitMapD.SetBitmap(bm
Try It, All The Best,
Thanks & Regards
Zfact.
Hi shakir77,
Try this, it will work.
//Add The Bitmpm as shown below
CBitmap bm1,bm2;
bm1.LoadBitmap(MAKEINTRESO URCE(IDB_B ITMAP1));
bm2.LoadBitmap(MAKEINTRESO URCE(IDB_B ITMAP2));
//Try changeing the bitmap with respect to your requirements as shown below.
m_ctrlBitMapD.SetBitmap(bm 1);
m_ctrlBitMapD.SetBitmap(bm 2);
Try It, All The Best,
Thanks & Regards
Zfact.
Try this, it will work.
//Add The Bitmpm as shown below
CBitmap bm1,bm2;
bm1.LoadBitmap(MAKEINTRESO
bm2.LoadBitmap(MAKEINTRESO
//Try changeing the bitmap with respect to your requirements as shown below.
m_ctrlBitMapD.SetBitmap(bm
m_ctrlBitMapD.SetBitmap(bm
Try It, All The Best,
Thanks & Regards
Zfact.
ASKER
Thanx AlexFM , your both solution worked very well.