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

后端 未结 4 1357
清歌不尽
清歌不尽 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:55

    Try to create a custom control using Panel as container and draw border around this, you can then have full control of the title's alignment.

    If you would like a simple approach, you can leave the groupbox's title as empty text, and then place a label at the center position of the groupbox. You can also define this as user-control so you wouldn't need to do this repeatedly.

提交回复
热议问题