Skip to main content
kweisi50
Associate III
May 22, 2019
Solved

How to switch a bitmap image between transparent and opaque.

  • May 22, 2019
  • 3 replies
  • 1223 views

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

This topic has been closed for replies.
Best answer by eng23

Hi,

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

3 replies

eng23
eng23Best answer
Senior
May 22, 2019

Hi,

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

Martin KJELDSEN
Principal III
May 23, 2019

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
kweisi50Author
Associate III
May 24, 2019

Hi Martin/eng23,

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

MikeZ

Martin KJELDSEN
Principal III
May 24, 2019

You're welcome!