【发布时间】:2021-05-05 00:45:56
【问题描述】:
所以我所做的是在变量之间手动插入空格。虽然它有效,但如果变量有点长,它会向右移动。这是我完成的编码。
lstOutput.Items.Add("Items Quantity Prices")
lstOutput.Items.Add("Pizza Slices " & quanPizza & " " & FormatCurrency(pricePizza, 2))
lstOutput.Items.Add("Fries " & quanFries & " " & FormatCurrency(priceFries, 2))
lstOutput.Items.Add("Soft Drinks " & quanSoftDrinks & " " & FormatCurrency(priceSoftDrinks, 2))
lstOutput.Items.Add("")
lstOutput.Items.Add("Total " & FormatCurrency(totalPrice, 2))
这是变量有点长的时候。
我怎样才能让它像在一个列中一样?
【问题讨论】:
-
您会考虑使用 ListView 还是 DataGridView?
-
在使用比例字体的列表框中对齐文本的唯一方法是使用ListBox.CustomTabOffsets 设置物理标签位置(考虑到平均长度 的部分,你可以看到一个例子here)。你可能不想要那个。按照建议,使用 ListView:没有计算,没有奇怪的填充,没有麻烦。
标签: vb.net