Search code examples
c#winformscontrolstoolstrip

Reduce Padding in ToolStripTextBox


How do I reduce the padding (or "internal margin") of a textbox in a toolstrip? With the padding set to 0 on all sides, there is still a substantial amount of white space above and below the text within the box. How do I get rid of this, or why is there seemingly so much extra?

I thought that the unit for padding was pixels, so a setting of 0 should have the edge of the textbox touching the tops and bottoms of the largest letters, no?

For example, why is there so much space above the "N" and "S" pictured below (and why is that space larger than the space to the left of the "N" since the top and left padding are both 0)?

enter image description here

I have tried changing AutoSize to False, changing the height of the control, and changing the Margin settings (all in different combinations), but the control actually seems to remain the same size (with the unwanted white space as well) no matter what I do.


Solution

  • Even today TOLLSTRIPTEXTBOX still has that annoying lean-on-top appearance (maybe the reason is in the comments). The only solution to this right now is to choose a FONT with a different justification format, which is the following font, the text will be centered:

    Control.Font = new Font("Quicksand Medium", 8F, FontStyle.Regular, GraphicsUnit.Point, Convert.ToByte(162));