Setting the Width of a Drop Down, Combo Box, or Edit Box in the Ribbon Designer (Norm Estabrook)

  • Comments 8

Recently, a developer posted a question to the VSTO forum asking us how to set the width of a drop down control by using the Ribbon Designer (

As this person experienced, if you do not set the width of the control, the text that appears in a drop down, combo box, or edit box will truncate. For example, the string “I love Visual Studio Tools for Office!” is truncated in the following drop down:


So how do you fix this? The magic lies in the SizeString property. However, the use of this property is not so obvious. Instead of setting this property to a number such as 20 for 20 characters of space, you must type an actual character for each character’s worth of space you want to allocate for the text width.

For example, to make enough space for the string “I love Visual Studio Tools for Office!”, set the SizeString property of the drop down to “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx” or “jlkjlkjlkjlkjdlslaledfoplklksjjklsfdf” etc.

You can also decrease the size of the text area to show fewer characters than appear by default. For example, just set SizeString to “xx” if you want only two characters to appear.

Norm E.

  • Would you recommend (or not recommend) using "W" as the sizing character, given that it would be the widest en-US character?

  • Great tip - but how can you control the size of the label?

  • The size of the label expands automatically to accomodate the length of the text.

  • Thanks, I couldn't figure out how to do this.

    Is there any specific reason why this approach is required? It just seems really weird to me that you actually have to supply a lengthy string instead of just a number that specifies the width?

  • Thanks for the tips Norm.

    I agree with Dennis, it's so strange and funny when seeing this. Wondering if there's any rationale behind.

  • Here is the process I just took:

    1. Looked through the properties pane in the Ribbon designer when I had my  RibbonDropDown selected and found nothing for setting a size.

    2. Checked to see if the size was based on the data inside it (it wasn't)

    3. Checked through the list of parameters on an instances of the RibbonDropDown, found a .SizeString property.

    4. Pressed F1 which took me to the online help here:

    which not surprised to say was completely useless.

    5. It was also mis-leading because I started trying to set what you may logically thing would represent some sort of unknown size of measurement in a string ?!?

    6. Gave up and typed in SizeString to Google and thankfully found this post that describes the most ridiculous way to set a size that I have possibly ever seen.

    Again I don't think I want to know if or what any of the reasoning was behind this, but I'm already starting to regret even considering using VSTO.

    Thanks anyway to Norm for putting something useful online, but as this is a MSDN blog? couldn't you put a good word in and get them to update the MSDN help page for the property???

  • This is so incredibly moronic.  What's worse than using a string width (of some arbitrary font? Seog) is that not all the controls are sized the same.  Dropdowns use the sizing string but then have the dropdown arrow.  In order to have my textbox the same size as my dropdown, my textbox has the string "large format" while my dropdown has "lergl lLLQ".  Who knows if that'll work if someone changes their system fonts or DPI settings.

    I found that office uses Segoe UI 9pt and wrote this fiddle to help me try to figure out the sizes, but it didn't seem to be perfect ... got me close.

  • GetTextExtentPoint32 (or something similar) is called to calculate the width of the text entered, in the font used by the Ribbon.

    As a result, "xxx..." and "jlk..." will create a different width box because the characters are of slightly different widths.

    The upshot is that if you want "10 em" you type "mmmmmmmmmm", "10 en" becomes "nnnnnnnnnn", etc. If you want "100 px", tough luck. ;-)

Page 1 of 1 (8 items)

Setting the Width of a Drop Down, Combo Box, or Edit Box in the Ribbon Designer (Norm Estabrook)