954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Transparent buttons

Hello, I'm currently working on an advanced 4x4 multilayer tic tac toe(will include servers, and accounts with levels and xp). Now the problem i have is that i have a image (.png) of a piece(representing X or O) and I want the button that you click to place your X or O to have a transparent backcolor so that i can still see the image of the piece.

Thanks!

AndyPants
Light Poster
35 posts since Oct 2011
Reputation Points: 15
Solved Threads: 1
 

With a PNG image, open image file in your graphics program and set palette transparency i.e. the "background" color of X and O to transparent in the images palette. You should be able to do this with any graphics application. If you have also X and O images with non-transparent backgrounds just swap non-transparent image to a transparent version on mouse click event handler.

HTH

Teme64
Veteran Poster
1,031 posts since Aug 2008
Reputation Points: 218
Solved Threads: 203
 

With a PNG image, open image file in your graphics program and set palette transparency i.e. the "background" color of X and O to transparent in the images palette. You should be able to do this with any graphics application. If you have also X and O images with non-transparent backgrounds just swap non-transparent image to a transparent version on mouse click event handler.

HTH


oh... I'm sorry, I forgot to say that the background of the .png is already transparent (I'm not that dumb, lol) but I cAnt get the buttons "backcolor" to be transparent.

AndyPants
Light Poster
35 posts since Oct 2011
Reputation Points: 15
Solved Threads: 1
 

Is your button a button control? Then you may consider some other control as a "button". You could try to use 4x4 picture boxes instead. It has all events you need and much easier graphics handling. With a button control you would have to do drawing yourself.

HTH

Teme64
Veteran Poster
1,031 posts since Aug 2008
Reputation Points: 218
Solved Threads: 203
 

Is your button a button control? Then you may consider some other control as a "button". You could try to use 4x4 picture boxes instead. It has all events you need and much easier graphics handling. With a button control you would have to do drawing yourself.

HTH


I have tried but I couldn't  figure out how to get the "backcolor" transparent. If you could plz tell me how?

thanks!

ps

picturebox1.color = color.transparent


     dosnt work cuz all it dose is just matches the color of the form

AndyPants
Light Poster
35 posts since Oct 2011
Reputation Points: 15
Solved Threads: 1
 

oh sorry not picturebox1.color but picturebox1.backcolor

AndyPants
Light Poster
35 posts since Oct 2011
Reputation Points: 15
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: