I am working on a ribbon addin for Outlook 2010 using XML and VB callbacks (I have not used the ribbon designer) in Visual Studio 2010.
What I want to do is add a custom image to a button loaded by another addin. Using the code below the image appears on a standard button but not on the button from the addin. The only difference seems to be using either the id or idQ properties, "idQ" does not work.
Any help would be much appreciated.
XML
<customUI xmlns=" xmlns:x1="MCSearch.Connect" xmlns:x2="VisionMerge.Connect" onLoad="Ribbon_OnLoad" loadImage="GetImage">
<ribbon>
<tabs>
<tab idMso="TabReadMessage">
<group idMso="GroupMailDelete" visible="false" />
<group idMso="GroupRespond" visible="false" />
<group idMso="GroupMoveActions" visible="false" />
<group idQ="x2:IIRIS.Law" visible="false" />
<group id="IIRIS.Law" label="IRIS Law" visible="true" insertBeforeMso="GroupRespond" autoScale="true">
<button idQ="x2:SendSave.Email" image="SaveAndSend.jpg"/> 'this does NOT work
<button id="Test" label ="Test" image="SaveAndSend.jpg"/> 'this does work
</group>
</tab>
</tabs>
</ribbon>
</customUI>
'VB Callbacks
Public Function GetImage(ByVal imageName As String) As stdole.IPictureDisp
Return PictureConverter.ImageToPictureDisp(My.Resources.SaveAndSend)
End Function
Friend Class PictureConverter
Inherits AxHost
Private Sub New()
MyBase.New(String.Empty)
End Sub
Public Shared Function ImageToPictureDisp(ByVal image As Image) As stdole.IPictureDisp
Return CType(GetIPictureDispFromPicture(image), stdole.IPictureDisp)
End Function
End Class
What I want to do is add a custom image to a button loaded by another addin. Using the code below the image appears on a standard button but not on the button from the addin. The only difference seems to be using either the id or idQ properties, "idQ" does not work.
Any help would be much appreciated.
XML
<customUI xmlns=" xmlns:x1="MCSearch.Connect" xmlns:x2="VisionMerge.Connect" onLoad="Ribbon_OnLoad" loadImage="GetImage">
<ribbon>
<tabs>
<tab idMso="TabReadMessage">
<group idMso="GroupMailDelete" visible="false" />
<group idMso="GroupRespond" visible="false" />
<group idMso="GroupMoveActions" visible="false" />
<group idQ="x2:IIRIS.Law" visible="false" />
<group id="IIRIS.Law" label="IRIS Law" visible="true" insertBeforeMso="GroupRespond" autoScale="true">
<button idQ="x2:SendSave.Email" image="SaveAndSend.jpg"/> 'this does NOT work
<button id="Test" label ="Test" image="SaveAndSend.jpg"/> 'this does work
</group>
</tab>
</tabs>
</ribbon>
</customUI>
'VB Callbacks
Public Function GetImage(ByVal imageName As String) As stdole.IPictureDisp
Return PictureConverter.ImageToPictureDisp(My.Resources.SaveAndSend)
End Function
Friend Class PictureConverter
Inherits AxHost
Private Sub New()
MyBase.New(String.Empty)
End Sub
Public Shared Function ImageToPictureDisp(ByVal image As Image) As stdole.IPictureDisp
Return CType(GetIPictureDispFromPicture(image), stdole.IPictureDisp)
End Function
End Class