Regards,
Ashutosh Bhawasinka
According to your description, you want to get the file/folder icon in your
.net application, correct? If I misunderstood anything here, please don't
hesitate to correct me.
If this is the case, you may refer to the following article. This document
has detailed sample code about how to get and display file/folder icon in
managed application by SHGetFileInfo (WinAPI).
I have tested sample code in that page. I believe it could works fine in
your application without any change, too. :)
http://www.codeproject.com/KB/files/fileicon.aspx
[Obtaining (and managing) file and folder icons using SHGetFileInfo in C#]
Hope this helps. Please try the above method and let me know if you have
any more concern. We are glad to assist you.
Have a great day,
Best regards,
Wen Yuan
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msd...@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Regards,
Ashutosh
You are welcome. If you need any further assistance, just feel free to let
us know again. :)
We are glad to assist you.
Have a great day,
Best regards,
Wen Yuan
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msd...@microsoft.com.
==================================================
I was looking for this myself..thanks..
How do assigns this icons to ListViews and Tree views.
I got that working by using image keys for the ImageList of the List
view. but now my icons have a weird black border..
I checked the code & it looked fine. Don't know why this is happening.
Is there any way I can remove those black border??
Regards,
Ashutosh
Wen Yuan Wang [MSFT] wrote:
According to the "Notes" part on CodeProject article, we have to include a
manifest file to use icons with alpha channel.
============================================================================
http://www.codeproject.com/KB/files/fileicon.aspx?display=PrintAll&fid=4222&
df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=26&select=305145
Important Notes:
It's taken me a long time to figure this out, but gave me real grief at one
point. Windows XP introduced Visual Styles, enabling you to use icons with
alpha channel blending to produce nice smooth icons. However, to include
support for this you must include a manifest file. Without one, you get a
really ugly black border. For more information on including visual styles
support, you ought to read the MSDN Article "Using Windows XP Visual Styles
With Controls on Windows Forms". As I said, I forgot to include a manifest
and it drove me crazy for weeks.
============================================================================
The link which pointed by Auther has down, but we can get it at
http://msdn.microsoft.com/en-us/library/aa289524(VS.71).aspx
[Using Windows XP Visual Styles with Controls on Windows Forms]
Moreover, if the above method doesn't help, could you let me know which
version of VS you are using?(VS 2002/2003/2005 or 2008). I tried it on VS
2005 & WinXP. Folder icon works fine, even though I haven't included any
manifest file.
Hope this helps. Please try the above method and let me know if this method
works. I will follow up. We are glad to be of assistance.
Have a great day,
Best regards,
Wen Yuan
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msd...@microsoft.com.
==================================================
I don't want to include any other file's dependency on my application.
Is there any way to do it without using the manifest file? I am
currently using VS 2005 with SP1( and plan to use VS 2008 once its free
of some of the bugs I noticed).
I am using small icons in the list view control(detailed view).
Regards,
Ashutosh
Wen Yuan Wang [MSFT] wrote:
Thanks for your reply. But, I still failed to reproduce the issue. Both
folder icon and file icon work fine on my side. I didn't get black border
in the icon. Do you have any screen-shooting of the issue? If it's
possible, we will appreciate if you can send it to us. This could help for
us to understanding the whole picture of the issue. You can get me at
v-wy...@microsoft.com.
Moreover, the following kb article also descripts the way to get file
associated icon by SHGetFileInfo function. Could you please also try the
code posted on this article to check if the issue still persists?
http://support.microsoft.com/kb/319350/en-us
[How to use the SHGetFileInfo function to get the icons that are associated
with files in Visual C# .NET]
Hope this helps. If you have any more concern, please also free to let us
know. We are glad to assist you.
I am following almost the same steps mentioned in the KB.
Regards,
Ashutosh
Wen Yuan Wang [MSFT] wrote:
Thanks for your reply and screen-shooting. It seems like a black shadow. By
default, ColorDepth property of ImageList is 8 Bit. To display tansparent
color, we would have to change it to 32 bit. Have you ever changed the
colorDepth of ImageList to 32 bit in Code or in Designer Mode?
Eg: imageList1.ColorDepth = ColorDepth.Depth32Bit;
On my side, I reproduced the issue after I change ColorDepth of ImageList
back to 8 bit.
Hope this helps, please try the above method and let me know if this works.
I must say that you people are really doing great job :)
Regards,
Ashutosh
Wen Yuan Wang [MSFT] wrote: