cancel
Showing results for 
Search instead for 
Did you mean: 

How to switch a bitmap image between transparent and opaque.

kweisi50
Associate II

Hi,

I have small bitmap in a window, which normally I would like it appear to be transparent (invisible) but when a flag is set to become fully opaque, when the flag is cleared go back to being fully transparent.

Kind Regards

MikeZ

1 ACCEPTED SOLUTION

Accepted Solutions
eng23
Senior

Hi,

Have you tried "imageX.setVisible(flag);" ?

View solution in original post

4 REPLIES 4
eng23
Senior

Hi,

Have you tried "imageX.setVisible(flag);" ?

Martin KJELDSEN
Chief III

Hi @kweisi50​,

You can either use setVisible(), as suggested by @eng23​, or use setAlpha():

//Set invisible
image.setAlpha(0); 
image.setVisible(false);
 
//Set fully visible
image.setAlpha(255); 
image.setVisible(true);

kweisi50
Associate II

Hi Martin/eng23,

Sorry for the delay in replying, thanks for you solution.

MikeZ

You're welcome!