M
Matrim Cauthon
Hello,
I'v done a lot of research of the last weeks but I can't figure out
how to assing a custom picture to a custom CommandBarButton the way it
looks naturally.
The Visual Basic (without .NET) can use the LoadPicture(strPath)
method to load a selfmade bitmap into the CommandBarButton.Picture
property.
Sad but true there is nothing like such a LoadPicture in Visual Basic
..NET left.
Since the Picture property of a CommandBar Button is
stdole.IPictureDisp I can't just assign a self loaded bitmap/icon to
it. Any cast (like CType(myBitmap, IPictureDisp) fails upon runtime.
(The same goes out to the Mask property)
There is another way to assign a picture to a button, I know.
It uses the PasteFace() method of a CommandBarButton which retrieves
for example a Bitmap from the Clipboard (which was incidently stored
there).
But to be honest, it doesn't look good enough. I don't know how to
define transparency into such a image.
The button keeps looking ugly because it doesn't seem to be really
embedded into the command bar. Especially when highlighting it via
mouse cursor.
I'm sure there are some other people who encountered such a problem
to. Maybe there is a way to define a background color or a cast from
bmp to IPictureDisp or something like that.
Anything would be great.
Kinda regards,
Mat.
I'v done a lot of research of the last weeks but I can't figure out
how to assing a custom picture to a custom CommandBarButton the way it
looks naturally.
The Visual Basic (without .NET) can use the LoadPicture(strPath)
method to load a selfmade bitmap into the CommandBarButton.Picture
property.
Sad but true there is nothing like such a LoadPicture in Visual Basic
..NET left.
Since the Picture property of a CommandBar Button is
stdole.IPictureDisp I can't just assign a self loaded bitmap/icon to
it. Any cast (like CType(myBitmap, IPictureDisp) fails upon runtime.
(The same goes out to the Mask property)
There is another way to assign a picture to a button, I know.
It uses the PasteFace() method of a CommandBarButton which retrieves
for example a Bitmap from the Clipboard (which was incidently stored
there).
But to be honest, it doesn't look good enough. I don't know how to
define transparency into such a image.
The button keeps looking ugly because it doesn't seem to be really
embedded into the command bar. Especially when highlighting it via
mouse cursor.
I'm sure there are some other people who encountered such a problem
to. Maybe there is a way to define a background color or a cast from
bmp to IPictureDisp or something like that.
Anything would be great.
Kinda regards,
Mat.