.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

32x32/16x16 Form.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath)

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :WPF

I want a template Form which would be using my App icon. The problem is that using Icon.ExtractAssociatedIcon does not work with multiple resolution icons. I did .NET Reflector survey and found, that ExtractAssociatedIcon is using P/Invoke to create Icon through a handle and Form.Icon calls Icon.ctor(Icon,int,int) to get the smaller version, which fails to find 16x16 icon, because the constructor is looking for Icon data stream, does not find it and thus stretches 32x32 to 16x16.

Form.Icon is working fine with embedded resource, because Icon.ctor(Icon,int,int) works fine with this (as Icons from resource carry the data stream).

I'd like to know, how to get Icon with full data stream from my app executable (to make Form.Icon working as I want it to work).

I have a solution, but it's not nice - it is using Reflection:


    private static FieldInfo fiSmallIcon;
    private static FieldInfo FiSmallIcon { get {
      if(fiSmallIcon == null) fiSmallIcon = typeof(Form).GetField("smallIcon"<

View Complete Post

More Related Resource Links

display icon or colum for inserted file in infopath form

i have a list with infopath form and in this form i have insert file now i need naythin in the view say there is attached or insert file in this record like the icon for attachment or column display file name or his path ,somthink can i know in this record there is attachmentThanks for any help :) my blog is: http://www.waelk.com

code to run visual basic application in between desktop icon and wallpaper

Plex can anyone of you tell me the visual basic net code to make the application run between desktop icon and background wallpaper . it mean if that application is running in background the icon in the desktop should be selectable...  pleax send you code to me ....    

How to make my application to be minimized directly to the tray icon area ?

I know its a problem . my program most of the time working in the background so most of the time its going to be in the tray icon area. The thing is i can minimize now my application reagulary and it will drop to the left bottom corner and i see only the top of the window of the application so i can resize it. Or i can turn the taskbar property to true and then it will be minimized to the taskbar in the middle . I tried using hid on the taskbar but then i cant resize it from the tray icon cuz its only hiding it in the taskbar not realy moving it to the tray icon . Is there any way or something to make the application move directly to the tray icon area when im pressing the minimize button "-" on my application ? I know there some programs not many but some that when you press the minimize button its going directly to the tray icon. I wonder how they did it.   Thanks for the help .  danieli

Define "show icon and notifications" as default for an application (.NET VB)

Hello,   I am looking for a way that my application when "minimized to tray" has its icon with the property "“show icon and notifications". The default property in Windows 7 is "Only show notifications"   Thanks,   Kalos

Define "show icon and notifications" as default for an application (.NET VB)

Hello,   I am looking for a way that my application when "minimized to tray" has its icon with the property "“show icon and notifications". The default property in Windows 7 is "Only show notifications"   Thanks,   Kalos

Setting form icon from embedded resource in layout

I have no trouble embedding resources into my project into the resx file and using them for things like ImageLists. For example selecting a background image for a control, I simply click on the [...] button in the properties window for background image and a popup window allows me to select "Project resource file: Resources.resx" and lists the selectable images I've already embedded to choose from.
Yet how come when I select a Form and click [...] to select its icon it forces me to browse on my hard disk for a file instead of linking directly to the already-embedded resource? I don't want to have to keep adding copies of the same icon for every form I want to apply it to. Is there a reason for this or a way around getting this to work properly using the layout manager? I've found some pages that talk about how to code it into the source and force it to work that way but I'd like to know how to do it in the designer.

C# Having trouble setting the form icon!


Hi i ma developing one application in C# for desktop system.
here i am applying icon for one form . I have applied it from properties window , but its not showing me the newly selected icon when i run the application for taskbar.

Also, i have tried applying icon from Resources path(Resource.resx) file still its not giving me the result.

This is happening for only one form in my application. Other forms are working perfectly well. These all forms are derived from one base class(Windows form)..
Can u pls suggest some solution for achieving this .?


Thank in advance
Jicky ...


Drag a file into windows form automatically i icon will be droped into winform with its shortcut fuc


Hi all

i have to make   a functionality in vb.net in which i just drag any file  from my desktop or from any location of system into my form on runtime and the icon will automatically drop to my application with its shortcut.

when i juct click that icon it will automatically open that file....

Just like the functionality done in bubble dock or star dock etc.


Kindly help me.

I am making a project on it for my final year examinations.


how to find the location of application icon on system tray of windows 7?


I would like to build a wpf application for windows 7 so the application window is always aligned with (above) the application icon on system tray.

So I need to know the location of the application icon.

Is it possible?


Can't get an Icon to show for Desktop shortcut and Program Menu



I've created a SetupWizard, but can't get it to show the Icon for the shortcut on desktop and program menu. The installation goes fine without any errors, the only problem is the icon.

I've made a shortcut of my exe file in the Application Folder and dragged the shortcut to the Desktop folder, then on the shortcut properties, I assigned it an icon picture located in Application Folder.

Any suggestions will be very much appreciated.


Windows 2000 UI Innovations: Enhance Your User's Experience with New Infotip and Icon Overlay Shell


Windows 2000 includes some helpful new UI features you can customize and implement in your own applications. In this article you'll see how to provide infotips for files, after making the appropriate registry entries. Then create a custom column handler extension, resulting in a new column for the Explorer's Details view. In order to further extend the shell, additional UI goodies will also be examined and implemented including: search handlers, cleanup handlers, folder customizations using property sheet handlers and icon overlays, and context menu shell extensions. All the code samples are rolled up into a handy package which we've named, by tradition, ShellToys.

Dino Esposito

MSDN Magazine March 2000

display an icon in gridview - selectively


I've created an ExpenseReport application which allows users to attach receipts to Expense Report Lineitems. These are contained in a gridview using a template field:

<asp:TemplateField HeaderText="File" InsertVisible="False">
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                <asp:HyperLink ID="HyperLink" ImageUrl='<%# Eval("filename", "~/workflow/Images/attachment.jpg") %>'
                runat="server" NavigateUrl='<%# Eval("filename", "http://workflowserver/AtWork/workflow/ExpenseReport/retrieveattachment.aspx?attachment={0}") %>' Text="" />  

The trouble I have is that the 'attachment.jpg' icon shows for every lineitem (even one that does not contain an attachment).

I would like to be able to selectively display this icon or show a different icon if there is NO attachment.

Any suggestions would be greatly appreciated. I'm kind of stuck... ;-)

Thank You.

Where is Format Document icon to add to toolbar in VS2010


For years now, I always added the "Format Document" icon to my HTML Editing toolbar.  It always was difficult to find this in VS2008 and VS2005.  It seem it has been completely eliminated in VS2010.

Does anyone have any idea where is might be in the Customize toolbar myriad of commands?

I realize it is available under the Edit drop down menu as well as keyboard command Ctrl K, Ctrl D.  But is is just so much more helpful to put it on the toolbar.

Thanks in advance for your help!

Open a windows application form names in another

Hi, Now i am in a horrible situation. I want to create an application for open another application(exe) and display all the form names in newly opened application in a compobox.If we selected a compobox item,ie;a form name in new application opened,i want to display all the control names in that form... is it possible? we can do it in same application.but how can i do it in another application? thanks in advance   Anoop

TreeView (icon+check+label+textbox) binded to a recursive dataset

Hello dudes, I have a DataSet with a DataTable and I want to populate a TreeView with it's contents:Id, IntParentId, IntName,StringIcon, ???Checked, IntValue, Intthe nodes must look like:   (icon) [checked] - Name |Value|there are 2 fields updatable, checked and value, and changes made by user in the tree must update the datatable/rowI was the last 2 day looking for how to build a tree like this and have no ideas..... tks :)
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend