简体   繁体   English

C#在列表框中包装文本

[英]C# wrap text inside a listbox

I want to display a list of words in a listbox, wrapped them together. 我想在列表框中显示单词列表,将它们包装在一起。 Below is an example what I want to do. 以下是我想要做的一个例子。 I was able to add words to listbox with a comma and in one line. 我能够用逗号在一行中添加单词到列表框。 Can you please help me to wrap this text. 你能帮我把这篇文章包好吗?

For comma separation I used, ListBox.Items.Add(string.Join(",", myList)); 对于我使用的逗号分隔,ListBox.Items.Add(string.Join(“,”,myList));

Expected output- 预期产量 - 在此输入图像描述

Below is my output 以下是我的输出 在此输入图像描述

I do not think its possible to print multiple text lines per ListBox item with the standard ListBox . 我不认为可以使用标准ListBox每个ListBox项打印multiple文本行。 Try using a TextBox instead, with Multiline = true 尝试使用TextBoxMultiline = true

  this.textBox1.Text = string.Join(",", UniqueWord(myList));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM