I changed the Function listView1_DrawItem as below. There is problem when scrolling Horizontal Scroll bar (Even I set doublebuffered = true)
private void listView1_DrawItem(object sender,
DrawListViewItemEventArgs e)
{
if (e.Item.Checked)
ControlPaint.DrawCheckBox(e.Graphics, 0, e.Bounds.Top + 1, 15, 15,
ButtonState.Flat | ButtonState.Checked);
else
ControlPaint.DrawCheckBox(e.Graphics, 0, e.Bounds.Top + 1, 15, 15, ButtonState.Flat);
Rectangle rect = new Rectangle(e.Bounds.X + 23, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height);
if ((e.State & ListViewItemStates.Selected) != 0)
{
// Draw the background and focus rectangle for a selected item.
e.Graphics.FillRectangle(Brushes.AliceBlue, rect);
e.DrawFocusRectangle();
}
else
{
// Draw the background for an unselected item.
using (LinearGradientBrush brush =
new LinearGradientBrush(rect, Color.Silver,
Color.White, LinearGradientMode.Horizontal))
{
e.Graphics.FillRectangle(brush, rect);
}
}
// Draw the item text for views other than the Details view.
if (listView1.View != View.Details)
{
e.DrawText();
}
}