Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Wed, 7 Dec 2005 17:00:15 +0200,    group: microsoft.public.word.vba.addins        back       


Toolbar Icons   
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

-- 
Galin Iliev [MCSD, MCSD.NET]
Senior Software Developer
www.wordassist.com
date: Wed, 7 Dec 2005 17:00:15 +0200   author:   Galin iliev ._no_spam_

Re: Toolbar Icons   
Hi Galin, 

> 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()
>
Since Office 2002 you don't need to use PasteFace to change the icon on a 
toolbar button. Look up the PICTURE property of the CommandBarButton object 
(Office object library).

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply 
in the newsgroup and not by e-mail :-)
date: Fri, 09 Dec 2005 15:13:01 +0100   author:   Cindy M -WordMVP-

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us