How to use HIMAGELIST in TreeView?

  • Thread starter Thread starter Anand Choubey
  • Start date Start date
A

Anand Choubey

Hi

I am facing one problem .
I am having HIMAGELIST handle, which I get from SetupDiGetClassImageIndex
and SetupDiGetClassImageList.
How can I use HIMAGELIST in TreeView class?
Please let me know.
 
Anand,
I am facing one problem .
I am having HIMAGELIST handle, which I get from SetupDiGetClassImageIndex
and SetupDiGetClassImageList.
How can I use HIMAGELIST in TreeView class?

Personally I'd stick with a managed ImageList for the TreeView
control. You can always use ImageList_Copy to copy the images you need
from the native HIMAGELIST to the ImageList instance.


Mattias
 
Hi Matthias,

here is a on-the-fly written pinvoke signature for
the ImageList_Copy in the comctl32.dll for Anand:

[Flags]
public enum ImageListCopyFlags : uint
{
ILCF_MOVE = 0x00000000,
ILCF_SWAP = 0x00000001
}

[DllImport("comctl32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static bool ImageList_Copy(HandleRef himlDst,
HandleRef himlSrc,
Int32 iDst,
Int32 iSrc,
ImageListCopyFlags uFlags);

Correct me if am wrong on that signature and
interessting is, that it has no GetLastError
Option, i mean the Original C-Function could
not be asked for that to return the register value
with GetLastError(),...



Regards

Kerem

--
 
Sorry,

i see, i forget the extern modifier keyword. This is the right
signature:

[Flags]
public enum ImageListCopyFlags : uint
{
ILCF_MOVE = 0x00000000,
ILCF_SWAP = 0x00000001
}

[DllImport("comctl32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ImageList_Copy(HandleRef himlDst,
HandleRef himlSrc,
Int32 iDst,
Int32 iSrc,
ImageListCopyFlags uFlags);

Regards

Kerem



--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Getting the System Image List 1
Get Class ImageList 6
Scolling a TreeView 5
Shell problem 2
Treeview and custom user controls problem in asp.net 1
TreeView 1
Unicode String in TreeView 6
Dataset to TreeView 2

Back
Top