я получаю сообщение об ошибке:Параметр не является допустимым
Параметр не является допустимым.
от этой линии:
e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds);
Вот мой рисунок функция:
private int mouseIndex = -1;
private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
{
if (e.Index == -1) return;
Brush textBrush = SystemBrushes.WindowText;
if (e.Index > -1)
{
if (e.Index == mouseIndex)
{
e.Graphics.FillRectangle(SystemBrushes.HotTrack, e.Bounds);
textBrush = SystemBrushes.HighlightText;
}
else
{
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
{
e.Graphics.FillRectangle(SystemBrushes.Highlight, e.Bounds);
textBrush = SystemBrushes.HighlightText;
}
else
{
// This Line:
e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds);
}
}
e.Graphics.DrawString(contact.P_DISPLAYNAME,
e.Font, textBrush, e.Bounds.Left + 20, e.Bounds.Top);
}
}
0 Что вы еще не делаете? Что вы делаете? –
Немного больше контекста увеличит ваши изменения для хорошего решения. –
Я пытаюсь рисоватьItem, но сообщение указывает на эту строку, Я хочу поместить свой код, где я могу задать тот же вопрос. – user1417068