Galin iliev
2005-12-07 15:00:15 UTC
Hello guys
I 've been digging for a while trying to add nice image to CommandBarButton
in MS Word using VS 2005 without aby luck.
I found http://blogs.msdn.com/vsto/archive/2003/12/18/44404.aspx and
http://support.microsoft.com/default.aspx?scid=kb;en;288771
second one gives very good exmaple for merging image and mask in Clipboard
and paste face on button at once. there is some code for creating mask image
from source but it is on VB6 and it is quite inconvinient (and impractical)
to keep using API function while most of them has their .NET equivalents.
does anyone know some example of this in .NET?
I tried to load them in sample VB.NET 2005 project but I get ComException on
.PasteFace()
this is the code
buttonInsert = .Controls.Add(Type:=Core.MsoControlType.msoControlButton)
With buttonInsert
.Caption = "Insert Snippet"
Try
My.Computer.Clipboard.SetData("Toolbar Button Face",
My.Resources.ToolbarIcons.Manage)
My.Computer.Clipboard.SetData("Toolbar Button Mask",
My.Resources.ToolbarIcons.Mask)
.PasteFace()
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
I am sure images are correct because I created them with code from MS Office
VBA help file (artice for CommadBarButton.Picture property)
Thank you in advance
I 've been digging for a while trying to add nice image to CommandBarButton
in MS Word using VS 2005 without aby luck.
I found http://blogs.msdn.com/vsto/archive/2003/12/18/44404.aspx and
http://support.microsoft.com/default.aspx?scid=kb;en;288771
second one gives very good exmaple for merging image and mask in Clipboard
and paste face on button at once. there is some code for creating mask image
from source but it is on VB6 and it is quite inconvinient (and impractical)
to keep using API function while most of them has their .NET equivalents.
does anyone know some example of this in .NET?
I tried to load them in sample VB.NET 2005 project but I get ComException on
.PasteFace()
this is the code
buttonInsert = .Controls.Add(Type:=Core.MsoControlType.msoControlButton)
With buttonInsert
.Caption = "Insert Snippet"
Try
My.Computer.Clipboard.SetData("Toolbar Button Face",
My.Resources.ToolbarIcons.Manage)
My.Computer.Clipboard.SetData("Toolbar Button Mask",
My.Resources.ToolbarIcons.Mask)
.PasteFace()
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
I am sure images are correct because I created them with code from MS Office
VBA help file (artice for CommadBarButton.Picture property)
Thank you in advance
--
Galin Iliev [MCSD, MCSD.NET]
Senior Software Developer
www.wordassist.com
Galin Iliev [MCSD, MCSD.NET]
Senior Software Developer
www.wordassist.com