We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

how do I get the ribbonpanel to resize

i have a tab/tabgroup with a panel with a toolstripex with buttons.

my problem is: the names of the buttons on the static area will change according to culture, how do I ensure that the last does not turn into a dropdown if the names are longer than my standardculture?
ie:
i want the toolstripex to resize to fit all its buttons if it can do so within the ribbonpanel.



1 Reply

AD Administrator Syncfusion Team April 8, 2008 11:09 AM UTC


Hi Looksharp,

Thanks for the interest in Syncfusion products.

You can calculate the width of each button and set the size of the toolstripex. Please refer the code

snippet that shows how you can calculate and set the size of the toolstripex.


int width = 0;
int tWidth = 0;
int i,j=0;
foreach (ToolStripPanelItem panel in this.toolStripEx1.Items)
{
foreach (ToolStripButton button in panel.Items)
{
width += button.Size.Width;
}
int w = width/panel.Items.Count;
if(panel.RowCount== panel.Items.Count)
{
tWidth = w;
}
else
{
i = panel.Items.Count/panel.RowCount;
j= panel.Items.Count% panel.RowCount;

if(j==0)
{

tWidth = w*i;
}
else
{
tWidth=w*(i+1);
}
}
}
this.toolStripEx1.Size = new Size(tWidth+15 , toolStripEx1.Size.Height);


Please refer the sample in the below link that illustrates the above.

rel='nofollow' href="http://websamples.syncfusion.com/samples/Tools.Windows/41455_1/main.htm">http://websamples.syncfusion.com/samples/Tools.Windows/41455_1/main.htm

Please let me know if you have any questions.

Regards,
Asem.




Loader.
Live Chat Icon For mobile
Up arrow icon