是否可以在 WinForms 消息框中左对齐(而不是居中对齐)连续行?

发布于 2024-11-03 00:46:45 字数 359 浏览 3 评论 0原文

希望这个问题说明了一切。我们有一些较长的消息,由 CrLf 字符分隔,并且各行居中对齐。

线条可以左对齐吗?

如果需要的话,我可以创建一个表单并以模态方式显示它,但如果不需要的话那就太好了。


编辑...

抱歉,各位。我的错...我该死的愚蠢问题。

事实证明,我的应用程序中随处显示的消息框是自定义的,并且它继承自表单,而不是继承自 MessageBox。

更糟糕的是,它上面有一个标签来显示消息的文本......而且,您猜对了,它的 TextAlign 属性设置为 MiddleCenter。

我现在要去把我的头撞在钉子上,作为对你们好人添麻烦的忏悔……

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...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

且行且努力 2024-11-10 00:46:45

消息框对我来说是左对齐的:

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

在此处输入图像描述

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文