How do I keep a label centered in WinForms?

haansi picture haansi · Dec 3, 2010 · Viewed 133.7k times · Source

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.

Answer

decyclone picture decyclone · Dec 3, 2010

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