Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,
i have one dialog application with a picture control.now i want to create an object of picture control.to do this,which class should be the base class for that object.please help me...please help...

Jijesh.

thank you in advance
Posted
Updated 8-Jun-11 20:47pm
v2

There is no specfic class related to picture control. It normally treated like a static control.you can create an object of CStaic and map your picture control to this object. If you need to do some kind of customization you can have your own class dervide from CStatic.
further solutions can be given on specifying that what you are actually trying to do with your picture control
 
Share this answer
 
v2
Comments
Jijesh Balakrishnan 9-Jun-11 2:56am    
how can i set an image on that through code?
Jijesh Balakrishnan 9-Jun-11 4:20am    
thnak you
As suggested, you may use a the CStatic class.
You have to:
 
Share this answer
 
Comments
Jijesh Balakrishnan 9-Jun-11 4:19am    
Thank You
CPallini 9-Jun-11 4:32am    
You are welcome.
if you are trying to use a bitmap.following code may work
CBitmap* pBitmap;
 pBitmap=new CBitmap();
 pBitmap->LoadBitmap(IDB_BITMAP1);
 CDC* pDC = m_PicCtrl.GetDC();
 CRect rect;
 m_PicCtrl.GetClientRect(rect);
 CDC dc;
 dc.CreateCompatibleDC(pDC);
 dc.SelectObject(pBitmap);
 pDC->BitBlt (0, 0, rect.Width(),rect.Height(), &dc,0, 0, SRCCOPY);
 delete pBitmap;
 pBitmap = 0;

use StretchBlt() instead of BitBlt() to adjust the size of image depending on the size of your picture control
 
Share this answer
 
You can do it like this

CBitmap bitmap;
bitmap.LoadBitmap(IDB_BLACK);
staticControl.SetBitmap(bitmap);



You can put your bitmap name inplace of IDB_BLACK
Hope it helps
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900