Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 增加列表框中的行距_C#_Listbox - Fatal编程技术网

C# 增加列表框中的行距

C# 增加列表框中的行距,c#,listbox,C#,Listbox,如何增加listbox1中的行距? ; 以及水平缩进每个字符串。以及listbox1中所选项目的颜色为红色。 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ) 这有你要求的三件事 间距: listBox1

如何增加listbox1中的行距? ;

以及水平缩进每个字符串。以及listbox1中所选项目的颜色为红色。 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

)

这有你要求的三件事

间距:

listBox1.ItemSpacing = 10;
水平缩进每个字符串:

listBox1.ItemFormatStyle.Margin = new Padding(5, 10, 2, 2);

listBox1.ItemFormatStyle.Padding = new Padding(7);
以下是如何更改颜色:


请将所有代码以文本形式发布,而不是图像,还请阅读如何创建一个文件。事实上,您已经扔掉了,它使用了库,我不需要库Mark Hollis检查我的屏幕。错误-ItemFormatStyle太小,抱歉…:(你能把它作为文本发布吗?ItemFormatStyle-缺少构建引用你能描述另一种方式吗?这种方式对我来说不合适
public class Account
{
    public string Name { get; set; }

    public string Login { get; set; }

    public string Password { get; set; }

    public override string ToString()
    {
        return $"{Name}";
    }
}
listBox1.ItemSpacing = 10;
listBox1.ItemFormatStyle.Margin = new Padding(5, 10, 2, 2);

listBox1.ItemFormatStyle.Padding = new Padding(7);