我目前正在使用C#中的列表框,我想在添加它们时对齐一些项目。请任何人可以帮忙吗? 感谢
这是代码:
private void btnSend_Click(object sender, EventArgs e)
{ lstMsg.BackColor = Color.AliceBlue;
lstMsg.ForeColor = Color.Blue;
lstMsg.Items.Add("You:" + txtMsg.Text);
}
答案 0 :(得分:0)
使用RightToLeft属性
private void btnSend_Click(object sender, EventArgs e)
{
lstMsg.BackColor = Color.AliceBlue;
lstMsg.ForeColor = Color.Blue;
lstMsg.Items.Add("You:" + txtMsg.Text);
lstMsg.RightToLeft = RightToLeft.Yes; //Check this
//To align to left, use RightToLeft.No
}