UI Interest Group Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you make the front panel transparent but not the controls in it?

I started this as an Idea in the LabVIEW Idea Exchange but thought the discoveries I found on the workaround would be a good topic here.  If you would like to see the Idea in the LabVIEW Idea Exchange, it can be found here.

Some of you may know that there is a Windows API function that can be called to make a set color act transparent to the Windows OS.  A set of VIs were published to aid in making this call and the originals can be found in Darren's Weekly Nugget here.

I made one change to the Transparent Window.vi (which I included as attachment) where I changed the color hex value to a control so that I could input the color. My first simple experiment, also attached, worked but lead me to one of the first of the caveats.  Anything the same color as the set color also goes transparent. Selecting white or black as the color will cause the LabVIEW Run, Stop, and other buttons to become partially transparent and difficult to click on. So, it is better to use some odd color like pink/fuchsia. This was difficult because it made the color box in my first experiment go transparent and then it could no longer be selected.

After each run of the simple test, I closed and restarted the VI to reset the transparency.  I began to change the color and noticed not all colors would visually show as transparent but the color was still transparent to the Windows OS.  Clicking on that VI caused my links on my desktop to be activated as if it was transparent.  So I decided I needed a way to see which colors would both act and show visually transparent.

I then created a control VI and a test VI to work around the selection problem.  These VIs are called Transparent Color Control.vi and Transparent Color Test Window.vi respectively and are attached as well.  This allowed my to change the color by channel while the test VI was running and constantly updating.  What I found was that the Red and Blue channels had to be equal to each other and it did not matter what the green was set to.

Also, I thought the slider control that is part of the Transparent Window.vi  would control the alpha channel to make shadows blend with the background image but this was not  the case.  The slider controlled the window's transparency just like the current property node does.  I found that using a PNG with blending, such as a shadow, blended my set color with the shadow and not the transparency.  This is the main shortcoming with the workaround.  However, there is enough good to it to make it useful.

Take a look at my test VIs and let me know what you think.  I found that my Transparent Color Test Window.vi looked best if the color was set slightly off-black (Red=Blue=1, Green=0).

Do you know of other ways to get the desired effect presented in the original Idea?

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



Message 1 of 6
(15,972 Views)

TheQ wrote:

I made one change to the Transparent Window.vi (which I included as attachment) where I changed the color hex value to a control so that I could input the color.

I have no practical suggestions other than that you don't stop there. That VI was nothing more than a test VI to see if the function call worked. I used it in one unimportant program to generate a particular effect, which is why it got an icon, but as you can see, it was never cleaned or polished. It has coercion dots, lacks error handling and will probably not work with 64 bit Windows (although I'll admit I have no idea if window handles in Win64 are 64 bit or 32 bit for compatibility).

I never looked deeply into the function, but there might be other options (e.g. there might be flags which change the way the alpha input behaves or you might be able to call the function repeatedly with multiple colors if you set a certain flag or the Win32 API or .NET API might have other functions for setting alpha transparency). Like I said, I never really looked into this, so I have no real idea. I would suggest a more general search on the web.


___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(7,841 Views)
0 Kudos
Message 4 of 6
(7,842 Views)

Works nice in LV2013…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(7,842 Views)

Works Nice in LV 2021

Tried it to provide Count down notification for User Preparation 

Screen Capture.gif

Message 6 of 6
(1,538 Views)