簡體   English   中英

如何使用 Winform C# 在 ListView 中為消息制作多行文本?

[英]How to make multiline text for messages in ListView with Winform C#?

我正在 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 不允許我在這里發布圖片,所以它使用這個鏈接

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

或直接在聊天框屬性的設計器中更改屬性 Alignment

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM