110,502
社区成员
发帖
与我相关
我的任务
分享
private void listBox2_DrawItem(object sender, DrawItemEventArgs e)
{
Brush b;
string str = listBox2.Items[e.Index].ToString();
int z = str.IndexOf(" ");
string sj = str.Substring(z);
if (gettime(sj)==true)//方法,判断用哪种颜色
{
b = new SolidBrush(Color.Black);
}
else
{
b = new SolidBrush(Color.Red);
}
e.Graphics.DrawString(str, this.Font, b, e.Bounds);
}