473,398 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Use icons in shell32.dll for buttons on form?


Any tips on using the icons in shell32.dll as the image on a button in a
form?

Thanks.
Nov 16 '05 #1
2 14771
Try this

[DllImport("Shell32.dll")]
public extern static int ExtractIconEx( string libName, int iconIndex,
IntPtr[] largeIcon, IntPtr[] smallIcon, int nIcons );

int numIcons = 10;//if you want 10 icons for example

IntPtr[] largeIcon = new IntPtr[numIcons ];
IntPtr[] smallIcon = new IntPtr[numIcons ];

usage -

ExtractIconEx( "shell32.dll", 0, largeIcon, smallIcon, numIcons );

//retrieve icon from array
Icon largeIico = Icon.FromHandle( largeIcon[0]);
Icon smallIco = Icon.FromHandle( smallIcon[0]);

The first parameter of ExtractIconEx can be use to get icons for exe or dll.

--
Shak
(Houston)


"emde" <em**@na.com> wrote in message
news:#V**************@TK2MSFTNGP10.phx.gbl...

Any tips on using the icons in shell32.dll as the image on a button in a
form?

Thanks.

Nov 16 '05 #2

Cool this seems to work fairly well. For a standard button I used:

chooseFileButton.Image = iconToUse.ToBitmap();

This works, but the image on the button looks like it needs some type of
alpha channel (black?) to have the correct transparency.

Any ideas on this?

Thanks again.
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mairhtin O'Feannag | last post by:
Hello, Please don't excoriate me, but i have what may be a simple question. I want to make and application that uses icons as buttons, but I cannot find an example of how to do this. Can...
0
by: Shayne H | last post by:
When I use an icon on the control box of a form, it uses the 256 color format of the icon by default. How do I get to use the XP style of the icon? -- Thanks for any help, Shayne H
2
by: Mike | last post by:
Hi, Is it possible to add icon images to Form Buttons and still include text on the button? If so, how is this done? Mike
6
by: Lauren Quantrell | last post by:
The Access form's control box has available an "X" to close and the min/max buttons. Is it possible to customize the control box to include other options and to isnert my own icons/command...
0
by: Ziver | last post by:
Hello, I used the utility "Easy Icon Maker" and created a transparent icon for my Outlook button. When i view it from the windows explorer i see as transparent but if i execute my add-in that...
0
by: Kristian | last post by:
Hi, We have recently added some icons onto buttons for a windows app (VS2005). While we are in the designer they all look ok, but once we run the program some of the icons disappear from the...
1
by: Dmenace | last post by:
Ok I've got a program I'm writing, and I need to be able to swap out the icon on the form. I've got 2 brands of a item and I need to swap the icons out depending on what brand I'm selecting. I know...
3
vdraceil
by: vdraceil | last post by:
Hello everyone... how do i set .gif cursors for a form??The cursor when loaded does not animate itself.. Is it possible to set .gif icon(animated icon) for a form??
6
by: KhoiNguyenDo | last post by:
I am new in vb. Please, help me. I try to display a couple of icons into the fom in vb but I could not find down how? There is only Picturebox to display an image and there is no Iconbox to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.