View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Alter mask of image on button

I understand now that the images on buttons are a picture and a mask.
Would it be possible to alter the mask of this image?
I use a temporary button to get some FaceID images in an ImageList like
this:

'Add an empty toolbar
Set NewToolbar = Application.CommandBars.Add _
(Name:="FaceIds", temporary:=True)
NewToolbar.Visible = False

On Error Resume Next
For i = 0 To 14
Set NewButton = NewToolbar.Controls.Add _
(Type:=msoControlButton, id:=2950)
NewButton.FaceId = FaceIDNumbers(i)
NewButton.CopyFace
Set iImageName = .ImageList1.ListImages.Add(, ,
PastePicture(xlBitmap))
NewButton.Delete
Next
On Error GoTo 0

NewToolbar.Delete
Set NewToolbar = Nothing

PastePicture is the routine written by Stephen Bullen.
The trouble is that I can't alter the background colour of this image and it
is always like a grey/brown colour.
I can export the image and mask separately (from the Excel help):

Sub GetButtonImageAndMask(cbButton As CommandBarButton)

Dim picPicture As IPictureDisp
Dim picMask As IPictureDisp

With cbButton
'Get the button image and mask of this CommandBarButton object
Set picPicture = .Picture
Set picMask = .mask

'Save the button image and mask in a folder.
stdole.SavePicture picPicture, "c:\FaceIDPicture" & .FaceId & ".bmp"
stdole.SavePicture picMask, "c:\FaceIDMask" & .FaceId & ".bmp"
End With

End Sub


So, maybe it is somehow possible to alter the mask.
I can see there is the Render method of this mask, but couldn't find any
information how to use this.
Any ideas how to do this?


RBS