May the 4th be with all of you, Today is one of my favorite days, As you have seen before I am a huge Star Wars fan and I cannot wait for December for the New Episode 7 movie to come out. Today during my lunch break, I ran into R2-D2 and some Jawas that had him captured in NYC #capturethedroid, after saying the magical phrase of “This is just the droid I was looking for” to the Jawas, they didn’t had any other choice than released him and I myself to scored a couple of nice Star Wars prices in celebration of #Maythe4th.
Also here is a 3D model of the new little droid for the upcoming Episode VII – BB8 loaded in our A360 viewer for you to play with, trust me you will spend a couple of more minutes here just spinning this little guy around. Enjoy.
Also today, I got to help Drew Jarvis from Red Top Training in Canada with a little hack on how to make your plug-in icon pick up the right side of 32x32 pixels and be displayed correctly, It can get sometimes a bit annoying, I don’t know if is Visual Studio the one that has a glitch but after this hack the icon gets displayed in the right size. Here is the question.
Question: I have a button on a ribbon, which I have supplied a 32x32 image for:
http://globaletraining.ca/icon/app_32.png
using the following code:
PushButton Button01 = GeTRibbon.AddItem(new
PushButtonData("GeT", "GeT", assembly,
typeof(LoadDockableDialog).FullName)) as PushButton;
Button01.LargeImage = new BitmapImage(GeT32);
Button01.ToolTipImage = new BitmapImage(GeT32);
Button01.ToolTip = "Load the GeT Help System";
MainDockableWindow.InitiatedText.Content =
"Please Run the GeT" + Environment.NewLine +
"Command on the Revit" + Environment.NewLine +
"Add-Ins Ribbon Tab to" + Environment.NewLine +
"Initialize the Get Addin";
However the image is always very small, attached is an example, how does the Dynamo button image look so large and mine looks so tiny? should I be using something other than PushButton?
Answer: Thank you for your query, I have tested it and it works with the following snippet of code, also see attached proof.
PushButton pushButton = ribbonPanel.AddItem(buttonData) as PushButton;
pushButton.ToolTip = "Your ToolTip Text Here";
Uri uriImage = new Uri("C:\\app-32.png", UriKind.RelativeOrAbsolute);
BitmapImage largeImage = new BitmapImage(uriImage);
pushButton.LargeImage = largeImage;
Let me know how it goes ok.
Response: Thanks Jaime, unfortunately this doesn’t seem to work for me, it still gives me a small image, which is odd as I haven’t specified an .Image only a .LargeImage, do you think I should try another image? What is the maximum image size that can be used? Is there a best suggested format?
Answer 2:Thank you for letting me know, as per our phone conversation, You are using the correct format and size of your image in order to be displayed in your plug-in. Like I said try to debug it a couple of times with the code I provided and play a bit with the names of the icon, you can roll it back when the plug-in picks up the right size.
I know it is very strange but that is how I tried it in the past and with your image as well and it worked.
Let me know how it goes ok.
Final Response: Thanks, that worked, I pointed it at a new filename and it worked without issue.Cheers.
Another Happy developer with his case resolved.
Thanks for reading and I hope it helps some of you in the future. Until next time.