BUG: ListView Control Does Not Render Correctly When You Change CheckBox Property to TRUE and the View Property is SmallIcon or List (813561)
The information in this article applies to:
- Microsoft .NET Compact Framework
SYMPTOMSIn Microsoft .NET Compact Framework, when you set the View property to the SmallIcon member, or when you set the View property to the List member, the ListView class control does not correctly draw itself, and the CheckBoxes property changes its value to TRUE. The behavior of the View property varies according to the setting: - If you set the View property to SmallIcon, the item check box is drawn under the text of the preceding
item.
- If you set the View property to List, the text of the items does not display completely.
CAUSEThe problem occurs because the ListView control does not correctly draw itself.STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed at the beginning of this article.
WORKAROUNDTo work around this problem, you must force the ListView control to recalculate and then redraw its content. Change the View property of the control. After you set the Checkboxes property of the ListView control to TRUE, change the View property of the control. For example, if the ListView control is set to TRUE, change it to LargeIcon, and then reset the View property to its original value (for example, SmallIcon). The following code describes the problem:
//The ListView CheckBoxes property is being reset.
listView1.CheckBoxes = !listView1.CheckBoxes;
//Set the ListView View property to LargeIcon.
listView1.View = System.Windows.Forms.View.LargeIcon;
//Set the ListView View property to its original value, that is, SmallIcon, to force the control to redraw.
listView1.View = System.Windows.Forms.View.SmallIcon; Note The workaround introduces additional overhead when you redraw the
ListView control.
| Modification Type: | Major | Last Reviewed: | 5/13/2003 |
|---|
| Keywords: | KbUIDesign kbui kbListView kbListBox kbControl kbBug KB813561 kbAudDeveloper |
|---|
|