change tab width in ownerdrawn tabcontrol

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
 
M

Mick Doherty

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.
 
A

Andre Nogueira

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"
 
M

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top