Creating a Ribbon for Office 2007 -simple version



In my post: Creating a Ribbon for Office 2007 i included all the code for the standard tutorial.


In playing with this tutorial i realized it wasn’t really viable for presenting so i stripped it down to the bare necessities  which I have included below:



Public Sub OnToggleButton(ByVal control As Office.IRibbonControl, ByVal isPressed As Boolean)


            If (isPressed) Then


                  MessageBox.Show(“Hello World!”)


            Else


                  MessageBox.Show(“Released!”)


            End If


 


    End Sub


 


 


 


    Public Function GetImage(ByVal control As Office.IRibbonControl) As stdole.IPictureDisp


        Dim pictureDisp As stdole.IPictureDisp = Nothing


        pictureDisp = ImageConverter.Convert()


        Return pictureDisp


    End Function


 


 



End Class


 


 


Friend Class ImageConverter


    Inherits System.Windows.Forms.AxHost


 


    Sub New()


        MyBase.New(Nothing)


    End Sub


 


    Public Shared Function Convert() As stdole.IPictureDisp


        Return AxHost.GetIPictureDispFromPicture(My.Resources.blankcd.ToBitmap()) ‘image)


    End Function


 


End Class


 


Comments (0)