ChrisA
ChrisA

Reputation: 4193

Is it possible to left-justify (rather than centre-justify) successive lines in a WinForms message box?

Hopefully the question says it all. We have some longish messages, separated by CrLf characters, and the lines come out centre-justified.

Can the lines be left-justified?

I can create a form and show it modally if I have to, but it would be nice not to have to.


Edit...

Apologies, people. My bad... my damn fool question.

Turns out that the message box shown everywhere in my application is a custom one, and it inherits from a form, not from MessageBox.

Worse still, it was built with a label on it to display the text of the message... and, you guessed it, its TextAlign property was set to MiddleCenter.

I shall now go and bang my head on a spike as penance for troubling you good people...

Upvotes: 0

Views: 122

Answers (1)

Chris Haas
Chris Haas

Reputation: 55417

The message box is left-aligned for me:

Option Strict On
Option Explicit On

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MessageBox.Show("It was the best of times, it was the worst of times." & vbNewLine & "The end.")
    End Sub
End Class

enter image description here

Upvotes: 2

Related Questions