Tabpages Image

rockronie

Member
Joined
Aug 8, 2006
Messages
12
Programming Experience
Beginner
Hello there,

I have a tabcontrol and resource image. I want to put an image on my tabpages in program code dynamically.

Hoping somebody can help.

thanks
 
Hi

You can use the "My" namespace to access the image from your resource file and set it to the BackgroundImage property of each tab page:
VB.NET:
TabPage1.BackgroundImage[SIZE=1] = [/SIZE][COLOR=#0000ff]My[/COLOR].Resources.ResourceName


HTH
 
djjeavons

sorry if I my queries is not clear. What I mean from the tabpage to put icon. Under the tabpages collection I need my tabpage with icon and put dynamically using my resource file that will assign in the imageindex property and not to put background image per tabpage.

+-------+
| ICON |
+-------+------------+
| |
| |
+--------------------+
 
Add an ImageList control to the form and assign it to the Tabcontrol. Either add images directly in Designer to the ImageList or dynamically in code (accessing the image resource as djjeavons example). When the Tabcontrol has got an ImageList with images you can set the imageindex/key for each Tabpage. Note that if this is the only use of these images you don't need them in application resources, just add them directly to the ImageList.
 
OK, so be sure to provide incomplete or meaningless tab labels if you want to include icons also.. ;)
 
Back
Top