Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
have written following code,I am able to see tabs but with only text not images
IDB_BITMAP is image of size 96*32;

C++
CImageList ci;
ci.Create(IDB_BITMAP1,32,1,RGB(255,0,0));
m_tab.SetImageList(&ci);
m_tab.InsertItem(1,_T("one"),0);
m_tab.InsertItem(2,_T("two"),1);
m_tab.InsertItem(3,_T("three"),2);


Please help on this issue.
One More Question ,how I can use this tabbed pages,Can I place other controls like button listbox etc on tab,if yes how ?
Posted
Updated 17-Mar-12 23:59pm
v2

1 solution

You are creating the image list on the stack and the list is destroyed when leaving the scope. Use a CImageList member variable.

You may have a look at the CPropertySheet and CPropertyPage classes to create tabbed pages based on dialog resources that may contain all kinds of controls. See CPropertyPage::GetTabControl() to access the tab control of a property sheet.
 
Share this answer
 
Comments
adityarao31 19-Mar-12 0:27am    
Yes you were absolutely right,local declaration of CImageList was causing a problem.That problem is resolved ,but I am still thinking how to use TabControl,do you have any sample or example?
Jochen Arndt 19-Mar-12 4:00am    
See here [^] and here [^] for examples.
adityarao31 20-Mar-12 5:16am    
Thanks for your reply?only question How did you found these articles ?
Jochen Arndt 20-Mar-12 5:19am    
First two hits when searching for 'ctabctrl example' with Google.

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