How do I keep a label centered in WinForms? Ask Question

How do I keep a label centered in WinForms? Ask Question

In WinForms I am using a Label to display different messages like success, failure, etc.

I'd like to center that label in the center form. I want a solution that will keep it centered whether there's just one word or a whole sentence in the label.

ベストアンサー1

Set Label's AutoSize property to False, TextAlign property to MiddleCenter and Dock property to Fill.

おすすめ記事