change tab width in ownerdrawn tabcontrol

  • Thread starter Thread starter Andre Nogueira
  • Start date Start date
A

Andre Nogueira

hi there.
I am creating a tabcontrol where the drawing of the tabs is controlled by
me.
However, i cannot find a way to change the lenght of the tab.
For instance, "String" needs a smaller tab than a tab which text is "this is
a tab with a really really long text".
How can this be done, the changing of the width of the tab?
Thanks!

André Nogueira
 
If you've inherited from TabControl, then the length of the tab
automatically sizes depending upon the length of the associated Tabpages
Text property. So the answer would be to set the tabpages text property to
the desired string. I am not aware of a way to set the size of individual
tab items.
You can however, set the size of all tabitems by setting the Tabcontrols
SizeMode property to Fixed and then setting the TabControls ItemSize
property.
 
Hum...
The thing is that I wanted to add an icon to each tab page. as such, the
lenght of the icon + the space between text and icon + the lenght of the
text exceeds the width of the tab page...
I'll look into your tip.
Thanks.

André nogueira

"Mick Doherty"
 
Assign an Imagelist to the TabControl. Add the Icon to the Imagelist control
and give the TabPage the relevant ImageIndex. The Tabitem will size itself
accordingly.
 
Back
Top