How to make group box text alignment center in win forms?

后端 未结 4 1362
清歌不尽
清歌不尽 2021-01-02 15:22

I am using a group box and there are several controls inside this.

My requirement is to set the group box title to the middle of the group box instead of Left.

4条回答
  •  暖寄归人
    2021-01-02 15:39

    Not an eloquent solution, but if you have a simple GroupBox, that stays the( same size, you can just pad the beginning, and the end with spaces.

    example : GroupBox.Text = " This is the groupbox text ";

    The amount of padding of space's will depend on the length of the box. Of course you'll lose some of the GroupBox's beginning and end lines on top, and if that's important, then Answer 3 seems like a good solution.

提交回复
热议问题