Thursday, 12 March 2009

Images in your Revit 2010 ribbons

Further to my recent post about Ribbons, you can add a 32 x 32 pixel image to your panel button using this code:

myPushButton.LargeImage = New BitmapImage(New Uri("C:\File Path\myImage.bmp", UriKind.Absolute))

And you'll need this too:

Imports System.Windows.Media.Imaging

And here's what it looks like using a picture of a bit of my Lambretta:



If you use a bigger image then it doesn't seem to get resized, Revit just shows the top-left 32 x 32 square. What's particularly interesting is that you can call your images from the web, like this:

myPushButton.LargeImage = New BitmapImage(New Uri("http://www.mydomain.net/images/myImage.gif", UriKind.Absolute))

Notice it doesn't have to be a bitmap. You can use gif, png etc, and if you're a whizz with photoshop you can specify transparent colours. I did try an animated gif and to my relief it didn't work. Imagine having a 'spinny logo' vying for your attention while you're trying to do some work!

No comments:

Post a Comment

Comments are moderated, so you'll have to wait a little bit before they appear!