如何删除列表框中的“红色标记”区域并使“蓝色标记”区域加粗?我想在项目MAT和LBL1之间有两个空项目。我该如何让它成为可能?
I tryed:No idea how..但试着大胆一点
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
ListBox1.DrawMode = DrawMode.OwnerDrawFixed;
}
private void ListBox1_DrawItem(object sender, DrawItemEventArgs e)
{
ListBox lb1 = (ListBox)sender;
var itemText = lb1.Items[e.Index].ToString();
var textBold = FontStyle.Bold;
// Make index bold from Client to MAT(or Client to first empty item)
e.DrawBackground();
e.Graphics.DrawString(ListBox1.Items[e.Index].ToString(), new Font("Arial", 10, FontStyle.Bold), Brushes.Black, e.Bounds);
e.DrawFocusRectangle();
}
}
1条答案
按热度按时间u91tlkcl1#
我其实找到了解决办法。删除一些项目,并作出一些大胆的。它工作正常!