ListView cannot display content normally if ListView.View = View.SmallIcon
See original GitHub issue.NET version
7.0.5 and 6.0
Issue description
ListView cannot display content normally if View = View.SmallIcon.
As shown in the picture below, in this test code, if you scroll your mouse or click the scroll bar to move down, the ListView will display a white area, which will not display any data normally.

Steps to reproduce
Full C# Code with .net 7.0 and Visual Studio 2022
namespace ListViewTest6
{
internal static class Program
{
[STAThread]
static void Main()
{
ApplicationConfiguration.Initialize();
Application.Run(CreateForm());
}
private static Form CreateForm()
{
var form = new Form()
{
Width = 800,
Height = 600,
StartPosition = FormStartPosition.CenterScreen,
};
var imgList = new ImageList()
{
ColorDepth = ColorDepth.Depth32Bit,
ImageSize = new Size(32, 32),
};
var listView = new ListView()
{
Dock = DockStyle.Fill,
View = View.SmallIcon,
SmallImageList = imgList,
OwnerDraw = true,
};
listView.DrawColumnHeader += ListView_DrawColumnHeader;
listView.DrawItem += ListView_DrawItem;
listView.DrawSubItem += ListView_DrawSubItem;
var group1 = new ListViewGroup("Group 1");
var group2 = new ListViewGroup("Group 2");
listView.Groups.Add(group1);
listView.Groups.Add(group2);
for (int n = 0; n < 100; n++)
{
var item1 = listView.Items.Add(new ListViewItem("Item 123456789 1-" + n));
item1.Group = group1;
var item2 = listView.Items.Add(new ListViewItem("Item 123456789 2-" + n));
item2.Group = group2;
}
form.Controls.Add(listView);
return form;
}
private static void ListView_DrawItem(object sender, DrawListViewItemEventArgs e)
{
e.DrawDefault = true;
}
private static void ListView_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
{
e.DrawDefault = true;
}
private static void ListView_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
{
e.DrawDefault = true;
}
}
}
Issue Analytics
- State:
- Created 5 months ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Why does my listview keep drawing in LargeIcon View?
I have a inherited Listview which standard has to be in Tile Mode. When using this control, the DrawItem gives e.bounds which are...
Read more >About List-View Controls - Win32 apps
List-view controls can display items in five different views. The control's window style specifies the default view. Additional window styles ...
Read more >The ListView Control - SAPIEN Information Center
Represents a Windows list view control, which displays a collection of items that can be displayed using one of four different views. ListView...
Read more >Working with List View Controls
List view controls in Natural can display their data in one of four view modes: icon, small icon, list or report. In icon...
Read more >ListView (GUI) - Syntax & Usage
List: Shows a small-icon view in list format, which displays the icons in columns. The number of columns depends on the width of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I have tested the code, it does not work with .net version 6.0
.net version 7.0 and 6.0 test result:
View = View.SmallIcon => error View = View.LargeIcon=> OK View = View.List=> OK View = View.Details=> OK
@KlausLoeffelmann This issue also repro in .Net 6.0 & 7.0 on win8.1 machine and win10 rs1 machine.