Re: Creating Custom Face IDs for Add-In Buttons

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance





if you want to create your own icons:

get an icon editor:
I like ArtIcons Pro.

Since toolbars use 16x16px 24mill color, no need for fancy editors like
AWicons, since you cannot use 32bit transparency on toolbar buttons.

Then you export 2 bitmaps: "Picture", and the "Mask"
(the mask is a B&W bitmap used to set the transparent areas)


Insert the icons as pictures in a sheet
(OR use an ImageList ActiveX control...)

Use picture toolbar to set the transparent color
on the colored "Pict" (needed for earlier versions than xlXP)

>From Office XP and newer commandbar buttons have an exposed
Picture and Mask property, so the buttons can be "ultra sharp".


I use following routine which works in all versions.
and which I call from my MakeMenu procedure.

ByVal arguments were used so you have a bit more flexibility in
the datatype of your object variables in the calling procedure.

For StdOle.StdPicture you need a reference to Ole Automation
(but that should be activated anyway)


Sub SetIcon(ByVal oBtn As Office.CommandBarButton, _
ByVal shpIcon As Excel.Shape, _
ByVal shpMask As Excel.Shape)

Dim oMask As stdole.StdPicture
On Error GoTo endH:

If Val(Application.Version) < 10 Then
'Run for xl97/xl2k
shpIcon.CopyPicture xlScreen, xlPicture
oBtn.PasteFace
Else
#If VBA6 Then
'Compile for xl2K+
'Run for xlXP+
'Avoid compile error in xl2k by using callbyname
shpMask.CopyPicture xlScreen, xlBitmap
oBtn.PasteFace

Set oMask = CallByName(oBtn, "Picture", VbGet)
shpIcon.CopyPicture xlScreen, xlBitmap
oBtn.PasteFace
CallByName oBtn, "Mask", VbLet, oMask
#End If
End If

endH:
'Clear clipboard by copying an empty cell
Range("iv65536").Copy
Application.CutCopyMode = False

End Sub


hth


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Mark Dev wrote :

> All,
>
> Can anyone give me some advice on the best method for creating custom
> icons to use on my Add-In toolbar buttons? What's the process? What
> tools are required?
>
> Thanks
.



Relevant Pages

  • Re: No custom icons in Word X?
    ... Make your button face in any graphic editor then copy the picture to the ... control-click on any toolbar button and choose Properties. ... Click the triangle and choose Paste Face to change the button face ... > user defined icons for symbol bars. ...
    (microsoft.public.mac.office.word)
  • Re: Creating Custom Face IDs for Add-In Buttons
    ... since you cannot use 32bit transparency on toolbar buttons. ... > Insert the icons as pictures in a sheet ... > Picture and Mask property, so the buttons can be "ultra sharp". ... > Mark Dev wrote: ...
    (microsoft.public.excel.programming)
  • Re: Substituting the main menu bar(s)
    ... quite see it as an argument against the picture of a trumpet which means the ... Which is a good argument for designing icons sensitively, ... bar through it which indicates that a vertical bar will move across the ... The blank button on the ties toolbar (with 7 different styles of tie all ...
    (microsoft.public.vc.mfc)
  • Re: Replace an image with another one
    ... Thank you Suzanne. ... SnapGraphics is an ancient program I once played with because of its unique ... Your comment about the toolbar gave me a clue. ... Look for the picture toolbar somewhere one your screen. ...
    (microsoft.public.word.newusers)
  • Re: Deploying custom toolbar and custom icons
    ... and pasted my icons on a hidden ... the background gray used is a little different from the toolbar color. ... Sub Auto_Open ... does it in his menumaker workbook: ...
    (microsoft.public.excel.programming)