Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - File icons
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

File icons

 Post Reply Post Reply
Author
Message
Francesca View Drop Down
Newbie
Newbie


Joined: 08 June 2006
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote Francesca Quote  Post ReplyReply Direct Link To This Post Topic: File icons
    Posted: 08 June 2006 at 6:22am

I'm trying to add the icon related to the file extension and I'm using:

Public Function GetIcon(ByVal Filename As String, ByVal iSize As IconSize) As System.Drawing.Icon

Dim hImg As IntPtr

Dim shinfo As New SHFileInfo

' Depending on the size, get the icon from the file

If iSize = IconSize.Small Then ' Return small icon

hImg = SHGetFileInfo(Filename, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_ICON Or SHGFI_SMALLICON)

ElseIf iSize = IconSize.Large Then ' Return large icon

hImg = SHGetFileInfo(Filename, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_ICON Or SHGFI_LARGEICON)

End If

'The icon is returned in the hIcon member of the shinfo struct.

GetIcon = System.Drawing.Icon.FromHandle(shinfo.hIcon)

End Function

Add the icon but when add the icon to the report control:

Dim ico As System.Drawing.Icon

...

rpCtrl.Icons.AddIcon(ico.Handle.ToInt32, nImageIndex, XTPImageState.xtpImageNormal)

But I can't see the icon in the report control

Thanks

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 08 June 2006 at 8:45am
What size is the icon you wish to display?  Try setting the width of the column to width of icon + 1.  Also be sure to have muliline True.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.