Problem with ToolboxBitmap property when creating ActiveX control

Hi,

I am trying to set the ToolboxBitmap property of my control to a bitmap I have made. As stated I have made the bitmap 16 x 15 pixels.

However the bitmap is always displayed incorrectly in the toolbox. For some reason all the black is being removed from the picture.

Why is this happening and how do I stop it?

Thanks

PyroMyst
LVL 1
pyromystAsked:
Who is Participating?
 
VbmasterConnect With a Mentor Commented:
The color of upper left corner will be the transparent color. And because your bitmap has a black border the upper left corn is black -> black is the transparent color -> all black pixels will be transparent.
0
 
SirNickCommented:
Is it a .ico or .bmp picture?
0
 
pyromystAuthor Commented:
It's a bitmap. I have also tried .jpg but I had the same result.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
SirNickCommented:
If you double click the picture in the toolbox does it still bring up an instance of your control?
0
 
pyromystAuthor Commented:
Yes it does. I have actually compiled and tested it as a .ocx successfully.

I then tried to give it a custom toolbox bitmap but it only shows the remaining colours after removing all black pixels.
0
 
SirNickCommented:
I see you made a bitmap 16 x 15 pixels.  Have you tried making one 16 x 16, because I thought that whenever you use a bitmap for this purpose it is like using an icon file which are usually 16 x 16 or 32 x 32 or am I wrong.  It could be slightly distorted therefore removing the black.

Is the black areas around the edges or in the centre of the bitmap.
0
 
pyromystAuthor Commented:
I haven't tried 16 x 16 because the help in MSDN said that the bitmap should be 16 x 15 otherwise it would be scaled.

The black is as a border and in the center. All other colours appear undistorted.

It seems almost as if it is treating black as a mask because where the black should be it is transparent.
It should work because in the help they suggest using black, white and greys suggesting to me that black should appear normally.
0
 
pyromystAuthor Commented:
Are you sure about that?

I have just tried changing the upper left pixel to white, however white still appears and my black is still missing. Furthermore I can see the white pixel in the upper left corner.
0
 
pyromystAuthor Commented:
I carried on investigating and your idea is correct. However it is the lower left corner that determines the transparent colour, not the upper left.

Is there anyway around this? I don't like having a corner missing from my border.
0
 
JanusFuryCommented:
nope, no way around it. I hate ToolboxBitmap.
0
 
pyromystAuthor Commented:
Thanks for your quick help Vbmaster, and thank you JanusFury for answering that last question of mine.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.