Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

toolbar icons in bmp format 1

Status
Not open for further replies.

Mezzzo

Technical User
May 30, 2003
56
US
Hi Group

I am looking for application toolbar icons in bmp format. I am looking for a collection that has a truly transparent background. Many of the icons have a red or white background...this does not work well for the current application.

Thanks
 
You don't need to worry about the transparency of the icons. Visual Basic will take care of this.

Stick to the same bitmaps having white or red backgound and insert them in your image list.

On the 'General' tab of the image list property pages, make sure that the 'UseMaskColor' check box is selected.

Now click the 'Color' tab and select 'MaskColor' from the 'Properties' list on the left.

From the 'Color Set' combo on the right, choose 'Standard Colors' and then White or Red color from the 'Color Palette' list on the bottom (whichever background color your icon bitmaps have).

Click OK. After these steps, Visual Basic will automatically mask the selected color and icons will appear transparent as required.
 
Hi

Thank. Now I understand how to use the mask feature.
That procedure did work fine. It seems some of my icon
backgrounds are gray and white. I assume I must find a
set of icons with a common background color.

Thanks again
 
I like to use the same background color as the default microsoft toolbar bitmaps fornd in C:\Program Files\Microsoft Visual Studio\Common\Graphics\Bitmaps\TlBr_W95. It just keeps things consistant and the image list mask is already set to that colour.

zemp
 
How does this work for PictureBox/Image controls?

I have some pictures/icons on top of varying BackColor and I can't seem to get the masking to work. I have tried pure white, gray and magenta in both the images and the control. The whole rectangular image is shown with white/gray/magenta border/BackColor...

My current approach is keeping the images in an ImageList with correct MaskColor and pic.Picture = smallIcons.ImageList(i).Picture

[elephant2]
graabein
 
>How does this work for PictureBox/Image controls?

It doesn't...
 
Argh! Any suggestions to work-arounds? I do need to display several images on the GUI and the BackColor is subject to change. I do not want to make copies of the image file and change the color there but... if that's the only way...
 
The approach you have mentioned is one solution.

Put the picture into an ImageList, and then just:

ImageList1.ListImages(1).Draw Form1.hDC, 10, 10, imlTransparent ' x,y coordinates are in the scalemode of the Device context
 
I use .gif's with transparency set.

zemp
 
I went with the ImageList.ListImages().Draw method and got it to work. I had to put it in the Paint event of the control with the DC. Thanks for the help guys!
 
Another problem... when I change state I want to change icon on the DC but it is transparent. How do I clear a certain area before I draw another icon?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top