How To Center Align the Title Bar text In Windows Form?

Viewed 46555

I am developing a Windows Form Application. I want to Align the Text to Center or say to Right of Title Bar of Form. How can I do it ??

4 Answers
 Graphics g = this.CreateGraphics();
        double fw = this.Width; // form width
        double tw = g.MeasureString(this.Text.Trim(), this.Font).Width; \\ text width
        double rp = (fw - tw) / 2;
        int tt = Convert.ToInt32(rp); 
        string st = " ";
        st = st.PadRight(tt / 3);
        this.Text = st + this.Text.Trim();
Related