BUG: Subitems in a ListView control are displayed in incorrect colors and incorrect fonts (814734)



The information in this article applies to:

  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual C# .NET (2002)

SYMPTOMS

You have a Microsoft Windows form with a ListView control. The View property of the control is set to Details. You add an item, and then you set the Font property and the ForeColor property of the item. When you add subitems to this item, and then you set the Font and the ForeColor of the subitems to a different font and a different color, all the subitems in the ListView are displayed in the font and in the color that you set the parent item to. Also, when you run the application, and then you select the item in the ListView, all the subitems are displayed in the default font and the default color.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. In Microsoft Visual Studio .NET, start a new Windows application by using Microsoft Visual Basic .NET or Microsoft Visual C# .NET.

    By default, Form1 is created.
  2. From the toolbox, drag a ListView control to Form1.
  3. Right-click ListView1, and then click Properties.
  4. In the Properties window, set the View property to Details.
  5. In the Properties window, click the Columns property, and then click the ellipsis button (...).
  6. In the ColumnHeader Collection Editor, click Add three times to add three columns, and then click OK.
  7. In the Properties window, click the Items property, and then click the ellipsis button.
  8. In the ListViewItem Collection Editor, click Add.
  9. Set the Text property of the ListView item to Item1.
  10. Set the ForeColor property of the ListView item to HotTrack.
  11. Click the SubItems property, and then click the ellipsis button.
  12. In the ListViewSubItem Collection Editor, click Add.
  13. Set the Text property to Item2.
  14. Set the ForeColor property to Menu.
  15. Click Add.
  16. Set the Text property to Item3.
  17. Set the ForeColor property to Info.
  18. Set the Font to Arial Black.
  19. In the ListViewSubItem Collection Editor, click OK.
  20. In the ListViewItem Collection Editor, click OK.

    In ListView1, all the subitems appear in the color and in the font of the parent item. The color and the font that you set for the subitems are not stored.
  21. On the Debug menu, click Start.
  22. On the ListView control, click Item1.

    The color of the subitems is changed to the default color.

REFERENCES

For more information, visit the following MSDN Web site:

Modification Type:MinorLast Reviewed:1/24/2006
Keywords:kbvs2005swept kbvs2005doesnotapply kbvs2002sp1sweep kbdisplay kbListView kbWindowsForms kbFont kbDesigner kbCtrl kbControl kbColor kbbug KB814734 kbAudDeveloper