Search code examples
c#.netwinformscentering

How do I keep a label centered in WinForms?


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.


Solution

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