views:

13

answers:

1

The problem is, once the SmallImageList is set to imgList1, it never "releases" the icon spacing, even when the SmallImageList is set to null. The item is always indented the same whether there is an icon or not.

any solution?

A: 

This is an unusual thing to do, the .NET ListView wrapper wouldn't handle it. You could try recreating the native Windows control to reset it. Not sure it this will have side-effects, you'd have to try. Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox, replacing your original.

using System;
using System.Windows.Forms;

class MyListView : ListView {
    public new ImageList SmallImageList {
        get { return base.SmallImageList; }
        set {
            base.SmallImageList = value;
            if (value == null && base.IsHandleCreated) this.RecreateHandle();
        }
    }
}
Hans Passant
thx, i didn't find any other way
silly_dg