I'm using a c# winform TabControl
. I've created an ImageList
, associated it with the TabControl
and populated it with a few images. The problem is, when I set the ImageIndex
or ImageKey
for a particular tab the image shows up on the tab, but it covers the text that is on the tab. To add to my confusion, one TabPage
in particular renders the image in the correct location (image followed by text). The page that has the image in the correct location is whatever TabPage
I set the ImageIndex
property on first...
I've googled around and found a post on another forum where someone described this problem and everyone said they couldn't recreate the problem. Any ideas what the problem could be? I really don't know what to try.
Edit
Sorry for the confusion. I have a TabControl
object with it's ImageList
property associated with an ImageList
that has two images. When I set the ImageIndex
property on a TabPage
in the TabControl
(from what I read) it is supposed to render the actual tab on the TabControl
as image followed by text. This is what happens when I set the image for the first TabPage
in my TabControl
but every tab following that will be rendered with the image covering the text that is on the tab. So the text appears behind the image. I use a for loop to set the image for each Tab
:
for (int i = 0; i < tabControl.TabPages.Count; i++) {
tabControl.TabPages[i].ImageIndex = SOME_IMG_INDEX;
}
The TabPage
at index 0 of the TabControl.TabPages
collection will look normal (image followed by text). The others will have the image over top of the text. Even if I were to start the for loop iteration at index 2, index 2 would render correctly but any after that would have the image over the text. I hope this helped make the question clearer.