Making icon for a Windows Form: How to make it show up correctly? - winforms

OK, so I have built a Windows Form application. I now want an icon for it. So I use the Icon Editor built into Visual Studio 2012. Draw it all out to look nice and purdy. Once I am done, I have a .ico file and I make it the default icon for the project, and also the icon for the one WinForm in the application.
Unfortunately, it does not show up as I have created it! It is displayed as the default icon file as it existed before I modified it in the icon editor. It's a 32x32 4 bit icon. If I change the extension to .bmp it shows up as the default.
It looks like the VS icon editor is editing something else, not the appearance of the icon. Can someone tell me what I am doing wrong?
I used to have a progam called IconArt that would create icons that looked like icons when I used them in VS. IconArt is now abandonware and won't run on my 64bit Windows workstation.

Since I didn't get any answers within the time I was hoping, I posted this question also in the MSDN Visual Studio forum, and got a good answer that I thought I should post here. Credit to Reed Copsey, Jr, for the answer!
This is it:
You'll need to put your design in all of the different versions. ICO
files contain multiple versions of the same image, for different
screen resolutions.
My personal preference is to not use VS - there's an ICO plugin for
Paint.Net (all free) which allows you to make a single image
(typically 256x256), and save multiple versions within an ICO file in
one shot. It's very useful for building icons.
See
http://forums.getpaint.net/index.php?/topic/927-icon-cursor-and-animated-cursor-format-v37-may-2010/
for the plugin.
Since I am a Paint.Net user, the plugin sounded like a great idea, and I tried it. Bingo! This works very nicely.

Related

INSTALLSHIELD setup User may search for their personal or business logo and apply

Every windows screen in our WPF application displays the ICON in the upper left corner. Numerous users of this program have the expectation of seeing their company logo.
We made the logo.ico file a "always copy" so that it is copied into the bin location along with every build. ICON is referring to the logo.ico file in this case.
The logo.ico file's icon will be reflected on the Windows screen if we go ahead and replace it with any other image.
We cannot expect the customers to accomplish this, so we must make it easier for them to browse the icon file during installation. InstalledShield software is used to prepare the installation setup. If there is a better way, please describe it here. I seek advice on how to accomplish this.
I would like you to check why the icon is getting reflected if you replace it with any other image, windows has some specification on the image size to display the icon/tile on the screen. See whether your icon is meeting all those specification to reflect it on the screen.
https://docs.revenera.com/installshield26helplib/helplibrary/IHelpMarsShortcutProperties.htm#ref-views_3737199233_1323863
you can also find information regarding the icon specification from the Microsoft documentation pages.
Apart from that, if you want to show up a browse dialog during the installation then you need to modify your InstallShield project:
1- To launch a browse dialog from the Basic MSI project:
https://docs.revenera.com/installshield23helplib/helplibrary/FileOpenDialog-HowTo.htm
2- To launch a browse dialog from an InstallScript project:
https://community.flexera.com/t5/InstallShield-Knowledge-Base/Displaying-a-File-Browse-Dialog-in-an-InstallScript-Project/ta-p/3964
But, my preference to you to check why the icon is getting reflected if its replaced with other image, and fix it.

Toolbar Icons usage in Visual Studio 2010 Express

I am porting a Linux Mono/GTK application to MS.NET/WPF. The application uses a toolbar, which I could have sworn VS had built in support for adding icons to through the WYSIWYG designer.
However, firstly, in the "Items" property, the add button is greyed out. I did some research and found that I could add <Button></Button> tags directly to the XAML, however, I still couldn't figure out how to add icons. I'd like to use the default Windows icons.
I then found that you had to add <Image></Image> tags to create typical icon based toolbar items, however, I didn't know where to find the default windows icons.
I read on a different stack exchange post that they are available in C:\Program Files\Microsoft Visual Studio 10.0\Common7\VS2010ImageLibrary\1033\VS2010ImageLibrary.zip
However, I am stuck with VS Express edition, and according to the MSDN website this archive doesn't exist in VSE.
My question is this: is there any way to use the default Windows icons?
Also, is it possible I've missed something? How do most people handle toolbars?
All the system icons are not saved in the same place. They are spread across multiple dlls.
List of Windows 7 icons stored in imageres.dll is one such place. You can google for other stuff.
One you have the dll from which you want to create the WPF Image you can use Imaging.CreateBitmapSourceFromHIcon function after using LoadIcon

Changing the default file path for icons in Visual Studio

On a WPF project, if I have an image and click on 'Source' and then 'Add' I get the choice to import images into the project. Is there a way of changing this file location?
VS2010 currently defaults to the "Libraries / Pictures" setting. I'd rather not change where this library points to as I don't store icons and pictures together.
After a bit of research I set up a new Windows library (useful article here) for icons but I can't work out how to set VS to default to the icons library I created, does anyone know how to do this?
Using Process Monitor on my machine when doing this, I see the following:
Calls to RegOpenKey, RegQueryKey aimed at:
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32
This seems to be a list of the last projects I've added/opened in Visual Studio. To test this, I added a project from a different location to my solution, then tried to change the source of the image.
Sure enough, the dialog defaulted to that location.
Your mileage my vary, but certainly, on my machine, the behaviour seems tied to what project I opened last. You can use Process Monitor to monitor devenv.exe while you choose an image on your machine to see what happens.
Given this, though, it would seem that you can't change this behaviour, although you can influence it.

How can I make a Windows Explorer file preview screen in WPF?

I'm working on an application that will have attachments, and I would like to create a type of display like in windows Explorer, where you choose a "Details" view, and also show the preview pane.
I would like to be able to show a thumbnail view of the attached file currently selected, based on the file extension.
Does anyone know where I can start to look for examples on how to pull this off?
I know Outlook 2007 can also do something similar using preview handlers. I think that’s going to be the direction I want to go in, but I'm not sure where to start.
Many thanks.
All Hail the Glory of the Hypnotoad!
While you could do it in WPF, you should not do it.
Seriously: don't do it! - you would break many apps (including one of mine).
To do this without .NET, see here for a nice guide.
I think you can start here
http://blogs.microsoft.co.il/blogs/eyal/archive/2007/07/29/Hosting-vista_2F00_office-2007-previewers-in-winform-application.aspx
(the code is partially black on black, at least for me, but you can disable the styles or just copy it)

Using Visual Studio Image Library PNGs in a Windows Form app

My question is about the Visual Studio Image Library that comes with VS2008. In the _Common Elements\Annotations folder, there are PNGs with multiple sizes and I was wondering what the intended use of these is. Is there an standard way to implement these images, e.g. in a Windows Forms status bar?
Here are three of the PNGs as an example:
The suggested usage is to basically copy/paste the sized image you want into a new image file. Then simply use that as an icon or image in your controls as you see fit. All of the PNGs already have a transparent background, so it should be really easy to copy/paste.

Resources