如何使用Winform C#在ListView中为邮件制作多行文本?

问题描述 投票:0回答:1

我正在Visual Studio 2019中使用C#进行客户端-服务器多方聊天。但是,当我添加新消息时,它与旧消息位于同一行,并且不在新行中。我该如何解决?

我曾尝试使用environment.newline,但不像预期的那样

非常感谢

#here is my code for adding new message in client/server file
void addMessage(string s)
        {
            chatBox.Items.Add(new ListViewItem() { Text = s });
        }

stackoverflow doesn't allow me to post image here so it use this link

c# winforms multiline
1个回答
0
投票

解决方案:chatBox.Alignment = ListViewAlignment.Left;

或直接在chatBox属性中的设计器中更改属性对齐方式>

© www.soinside.com 2019 - 2024. All rights reserved.