Quantcast LiveSide - Windows Live news and interviews
LiveSide on the Windows Live Network LiveSide on Facebook LiveSide on Twitter LiveSide RSS  
Translate this page
MoFuse
LiveSide - Developer Blog

Writing Plugins For Windows Live Writer - Adding An Icon

Ok, so now that we have the basis for our Live Writer plugin, we need to start adding things to it to make it look and feel better. The best way is to add an image to the plugin that will appear in the Insert section of Writer.
This is actually very easy, but there are things that you need to remember other wise you will get runtime errors when Live Writer starts up. So first of all, we need to create our little icon, which is what the end user will see in the options and on the right in the Insert field. The thing you have to remember when making this, is its size: it has to be exactly 20x18 pixels. For this demo, I'm going to be using this image: .
The image that I am using I have called icon.gif, and to put it into our project, we can just drag and drop into Visual Studio Express:
This next part is very important otherwise you will be getting an error saying that the image can't be found and you will be wondering why as you can see it in your project. Right click on the image in the solution explorer, select properties; in the properties, you have a section called Build Action, and you want to set it to Embedded Resource:
So going back to the code from the previous article, we need to add in an extra attribute to the plugin, with the resulting code looking like this:
[WriterPlugin("8638eda4-6533-4d19-9da7-ff92ff5a7590","My First Plugin",
        Description="This is my first plugin",
        HasEditableOptions=false,
        Name="My First Plugin",
        PublisherUrl="http://scottisafool.spaces.live.com",
        ImagePath="icon.gif")]   // This line is where we put the image in the code
The part that we are looking at here is the ImagePath="icon.gif" part. This filename has to correspond to what you have put into the project; now, if that file is in a folder, for example "images", then the ImagePath would be "images.icon.gif". Notice we use a full stop instead of a slash. Once you have put that in, you're ready to rock and roll; so hit F6 in Visual Studio and let it compile.
Now when we load Live Writer up, we have our link as before, but now it has the image we have assigned to it:
As before, the source code is available here.
SL

Comments

Nick wrote re: Writing Plugins For Windows Live Writer - Adding An Icon
on 10-11-2006 4:17 PM

Just so u know, if u import it as a ICO file, like favicon.ico is on this site, then you wont get that white background around the LS icon.

ScottIsAFool wrote re: Writing Plugins For Windows Live Writer - Adding An Icon
on 10-11-2006 5:17 PM

This is true, but unfortunately, the favicon.ico size is 16x16, and Live Writer won't load the image for the icon unless it's 20x18, so you have to resize the icon file anyway. Importing the icon will not work directly without making some sort of change to the file in the first place.

David Mohorn's Blog wrote Windows Live Writer Plugin Resources
on 10-12-2006 6:09 AM

Windows Live Writer Plugin Resources

Developer wrote Writing Plugins For Windows Live Writer - Working With Forms
on 10-29-2006 5:36 PM

Most plugins for Live Writer will have a form appear when you click on the Insert link within Live Writer, this form will perform the functionality of the plugin and return the code or text that will be put in the blog entry. Within this form, you can

LiveSide - Developer Blog wrote Writing Windows Live Writer Plugins - A Recap
on 10-23-2007 8:33 PM

There was a comment left on my most recent plugin guide: "I would love to see a guide on how to

Sign In Live ID using Live ID, Name/Password, or OpenID
or Join LiveSide to leave a comment!