19 December 2007

Adding Icons to your custom IIS 7.0 Manager UI Modules

There is a lot of enthusiasm around building IIS UI modules that show up in the IIS Manager. The extensibility model that IIS 7.0 ships with is great and provides a lot of opportunity for developers to come up with nifty modules.

One thing that developers miss out is to add an icon for the UI module. If you register a UI module without an icon IIS Manager shows the default icon of a gear wheel.

Default

Its pretty simple to add an Icon to your module so that it looks neat in IIS Manager. One of the constructors of the ModulePageInfo class takes in icons in the form of image objects.

ModulePageInfo(Module, Type, String, String, Object, Object, String)

The two Object variables are for the smallImage and largeImage that IIS manager can use as icons for your module.

To use this constructor you have to embed the image files in your assembly. To do that add the image to your Visual Studio solution. In the Solution Explorer right click on the image and go to its properties. Change the Build Action to Embedded Resource.

ImageProperties

You can then create a Bitmap object from the embedded resource and pass it to the constructor of the ModulePageInfo.

Something like this.

//Create a module description System.IO.Stream icoStream = this.GetType().Assembly.GetManifestResourceStream("FindDebugModules.Debug.jpg"); System.Drawing.Bitmap ico = new System.Drawing.Bitmap(icoStream); icoStream.Close(); ModulePageInfo modulePage = new ModulePageInfo(this, typeof(FindDebugModulesPage), "Find Debug Modules", "Find Debug Modules", ico, ico);

 

Note that the string you pass for GetManifestResourceStream is case sensitive. I had to struggle a bit to get the proper string and finally ended up listing all the resource names with Assembly.GetManifestResourceNames to find the right one.

Once you register the module in administration.config you will see that the image is shown as the icon of your module. The above code snippet is from the FindDebugModules UI module that I posted here.

Reference :

Bookmark and Share
Filed under: , ,
 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Geek Lectures - Things geeks should know about » Blog Archive » Adding Icons to your custom IIS 7.0 Manager UI Modules said:

PingBack from http://geeklectures.info/2007/12/19/adding-icons-to-your-custom-iis-70-manager-ui-modules/

19 December 07 at 3:53 PM
# If broken it is, fix it you should said:

A while back I posted about Failed Request Tracing in IIS 7 and I mentioned the command appcmd list requests

28 August 08 at 10:18 AM

Leave a Comment

Comment Policy: No HTML allowed. URIs and line breaks are converted automatically. Your e–mail address will not show up on any public page.

(required) 
(optional)
(required) 
Page view tracker