就是怎么调用DrawItem函数?
private void lbox2_DrawItem(object sender, DrawItemEventArgs e)
{
Brush FontBrush = null;
ListBox lbox2 = sender as ListBox;
FontBrush = Brushes.Black;//set overall brush
if (e.Index > -1)
{
if (e.Index % 5 == 0)
{
FontBrush = Brushes.Red;//set local brush
}
e.DrawBackground();
e.Graphics.DrawString(lbox2.Items[e.Index].ToString(), e.Font, FontBrush, e.Bounds);
e.DrawFocusRectangle();
}
} 在线等。
private void lbox2_DrawItem(object sender, DrawItemEventArgs e)
{
Brush FontBrush = null;
ListBox lbox2 = sender as ListBox;
FontBrush = Brushes.Black;//set overall brush
if (e.Index > -1)
{
if (e.Index % 5 == 0)
{
FontBrush = Brushes.Red;//set local brush
}
e.DrawBackground();
e.Graphics.DrawString(lbox2.Items[e.Index].ToString(), e.Font, FontBrush, e.Bounds);
e.DrawFocusRectangle();
}
} 在线等。
<asp:ListBox ID="ListBox1" runat="server" OnLoad="DrawItem"></asp:ListBox>
行么?