Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Creating Custom Face IDs for Add-In Buttons



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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Creating Custom Face IDs for Add-In Buttons

Hi keepITcool,

That's new to me - cool!

What I've done when making icons is to save the icon image with the mask
colour already set. Several image editors provide this option, though I
guess it only works with images of 256 colours or less.

Insert into a sheet and copy just the one image to a button. In other words
no need for a separate mask image and the final icon should look same in all
versions, I think (?) Requires simply (from your routine) for all versions:

shpIcon.CopyPicture xlScreen, xlPicture
oBtn.PasteFace

Regards,
Peter T

"keepITcool" wrote in message


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Creating Custom Face IDs for Add-In Buttons



I've extensively tested this.

You DONT want to use the EMF (Picture) if you can avoid it.
For crisp icons WITH transparency you need to do it my way.

(try editing the icon with the button editor.. in multiple versions
and you'll see the difference)



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


Peter T wrote :

Hi keepITcool,

That's new to me - cool!

What I've done when making icons is to save the icon image with the
mask colour already set. Several image editors provide this option,
though I guess it only works with images of 256 colours or less.

Insert into a sheet and copy just the one image to a button. In other
words no need for a separate mask image and the final icon should
look same in all versions, I think (?) Requires simply (from your
routine) for all versions:

shpIcon.CopyPicture xlScreen, xlPicture
oBtn.PasteFace

Regards,
Peter T

"keepITcool" wrote in message


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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Creating Custom Face IDs for Add-In Buttons

You DONT want to use the EMF (Picture) if you can avoid it.
For crisp icons WITH transparency you need to do it my way.

(try editing the icon with the button editor.. in multiple versions
and you'll see the difference)


Ah, I see what you mean - I had never noticed!

So I suppose to cater for all versions it might be an idea to use the two
images per your suggestion for xlXP+ and use only a third "pre-masked" image
for earlier versions.

Regards,
Peter T


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Creating Custom Face IDs for Add-In Buttons

I will give this a shot also. Thanks for your help.

Mark

"keepITcool" wrote in message
ft.com...


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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Creating Custom Face IDs for Add-In Buttons

Peter,

Thanks for taking the time to reply. I will try out all suggestions and see
which works best.

Mark

"Peter T" <peter_t@discussions wrote in message
...
Hi keepITcool,

That's new to me - cool!

What I've done when making icons is to save the icon image with the mask
colour already set. Several image editors provide this option, though I
guess it only works with images of 256 colours or less.

Insert into a sheet and copy just the one image to a button. In other
words
no need for a separate mask image and the final icon should look same in
all
versions, I think (?) Requires simply (from your routine) for all
versions:

shpIcon.CopyPicture xlScreen, xlPicture
oBtn.PasteFace

Regards,
Peter T

"keepITcool" wrote in message


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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Custom Buttons bauman78 Excel Discussion (Misc queries) 3 August 26th 09 04:23 AM
Creating Custom Face IDs for Add-In Buttons Jim Cone Excel Programming 2 June 10th 05 12:27 AM
Custom face on a button without using clipboard? Nigel Excel Programming 3 October 15th 04 01:07 PM
Custom button face without clipboard? Nigel Excel Programming 2 October 15th 04 12:46 PM
Add-in with custom Face R Avery Excel Programming 2 March 5th 04 03:34 PM


All times are GMT +1. The time now is 11:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"