Posts: 24
Registered: ‎05-19-2011
Message 1 of 3 (271 Views)

Not able to display my .png files in the ribbon

271 Views, 2 Replies
12-23-2012 07:30 PM

Hello all,

Good day,  Merry Christmas and a Happy new year to all,

I am trying to create a ribbon of my own, and the code and execution is fine, but I am not able to put the images.

my images are not more than 1 kb in size and are stored in the resources.resources1.... how do I get them to display.
Please help.

I am trying to work with the available code found in one of the training sessions,

'Code starts

'on one of my subs I am calling this function 

'ribBtn.LargeImage = LoadImage("FR.png")

Private Shared Function LoadImage(ByRef ImageName As String) As Imaging.BitmapImage

Dim bi As New System.Windows.Media.Imaging.BitmapImage()

bi.StreamSource = GetEmbeddedResourceStream("MyRibbon_Autocad." & ImageName)
bi.EndInit() ' When i debug the code, the code is exiting at this point, i am assuming it is not getting initialised.
Return bi
End Function

Protected Shared Function GetEmbeddedResourceStream(ByVal ResourceName As String) As Stream
Return System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(ResourceName)
End Function


I dont see any error, but the ribbon is getting generated but withut any images, just a plane ribbon.


ADN Support Specialist
Posts: 749
Registered: ‎03-21-2011
Message 2 of 3 (223 Views)

Re: Not able to display my .png files in the ribbon

01-01-2013 10:06 PM in reply to: jamkhp



Wish you a very happy new year.


Have you set the "ribBtn.Size = RibbonItemSize.Large" ?

This will ensure that AutoCAD uses the large image.


Here is a blog post with a sample code that might help :


Developer Technical Services
Autodesk Developer Network

Posts: 21
Registered: ‎08-20-2008
Message 3 of 3 (200 Views)

Re: Not able to display my .png files in the ribbon

01-02-2013 05:39 PM in reply to: jamkhp


Thank you and to you

using System.Windows.Media.Imaging;
using Autodesk.Windows;

RibbonButton rConductorbutton = new RibbonButton();
            rConductorbutton.Text = "OOO";
            rConductorbutton.Id = "btnConductor";
            rConductorbutton.Orientation = System.Windows.Controls.Orientation.Vertical;
            rConductorbutton.Size = RibbonItemSize.Standard;
            rConductorbutton.Image = new BitmapImage(new Uri(... + @"\Icon\Conductor32.png", UriKind.RelativeOrAbsolute));
            rConductorbutton.ShowText = true;
            rConductorbutton.ShowImage = true;
            rConductorbutton.Click += new System.Windows.RoutedEventHandler(btnCounductor_Click);



it can be one of the ways that you can use to show png file but it's C# if couldn't change it to VB let me know to change it for you


Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.