Print Page | Close Window

File icons

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=4374
Printed Date: 19 May 2024 at 12:49am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: File icons
Posted By: Francesca
Subject: File icons
Date 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




Replies:
Posted By: SuperMario
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net