LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmatically make a picture control transparent

Solved!
Go to solution
Solution
Accepted by topic author Ben_01880

So it sounds like you have what you need, correct?

 

Since the ability to set teh background color of a Picture was not exposed and since you seem to really be interested in doing this at run time I'll out line what could work.

 

1) Defer FP updates.

 

2) Set picture invisable.

 

3) Invoke node Get FP Image

 

4) Determine location and bounds of picture control.

 

5) Use bounds to extract image from region occupied by the picture from image obtained in #3

 

6) Set picture visable

 

7) Write image from step #5 to Picture.

 

😎 Undefer FP updates.

 

But why you would want to do this when starting with a picture with a transparent background (set at edit time) get you to the same place, I just don't understand.

 

Care to share your concerns?

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 11 of 22
(2,022 Views)
Thanks for the ideas, I do have most of what I need
0 Kudos
Message 12 of 22
(2,016 Views)

Hi,

 

Now I understand, what you needed. ;). Property for background color of the Draw Area missing...

In addition to suggestions above you can do it also with XControl (they are so funny)

Very "quick and dirty" implementation in attachment (not "ready for use" - just idea).

 

Andrey.

 

0 Kudos
Message 13 of 22
(2,002 Views)

There is a difference between transparent and visible -- this is particularly evident with a Tab control. For instance, a Tab Control with a transparent background can be a very useful way to change control and indicator layouts over a static background. It is sometimes useful to control transparency programmatically at runtime, and it may not be immediately apparent how to do this if you haven't done it before.

 

The easiest way to programmatically make something transparent (and non-transparent) at runtime is to use a transparent ColorBox constant. Simply drop a ColorBox constant on your block diagram and color it to "transparent" using the color picker tool. (See "ColorBox Constant.png" attached.)

 

If you want to construct the numeric value for transparency programmatically, it is essentially (R=255 + B=255 + G=255) +1. The method is illustrated in "Constructing Transparency.png" (attached).

 

 

Download All
Message 14 of 22
(1,516 Views)

Can partial transparency of a tab control be achieved?

0 Kudos
Message 15 of 22
(1,388 Views)

As far as I know, there is no way to achieve partial transparency via a control property, as this would require an "alpha channel" value to specify the level of transparency. My understanding is that LabVIEW uses a single color, specified by a unique U32 RGB color value, to specify transparency, defined as follows:

 

Transparency = 255 [red channel] + 255 [green channel] + 255 [blue channel] + 1 

 

or more specifically, Transparency = [U32]16777216

 

To illustrate, if you wire a U32 constant with a value of 16777216 into the "Colors:Foreground Color" and  "Colors:Background Color" properties of your tab control, the tab control will become transparent when the Property Node update executes. Any value less than 16777216 will result in a color change to the expected RGB color. (Values greater than 16777216 appear to either produce an error or an unexpected color result.)

 

Perhaps in the future NI will provide additional U32 RGB color values in the range above 16777216 to specify variable transparency. For right now, this doesn't appear to be implemented (-- although I haven't tested all possible values between 16,777,216 and 4,294,967,296 to verify this assumption!)

 

Unless there is another way to do it, I don't think partial transparency is an option.

  

0 Kudos
Message 16 of 22
(916 Views)

That's a lengthy for an answer to a question asked (off topic) 5 years ago...

0 Kudos
Message 17 of 22
(907 Views)

wiebe@ CARYA,

 

Yes. Yes it was...

 

But, if one persons has the question, someone else may be thinking the same thing! Smiley Happy

0 Kudos
Message 18 of 22
(900 Views)

@The_Seeker wrote:

wiebe@ CARYA,

 

Yes. Yes it was...

 

But, if one persons has the question, someone else may be thinking the same thing! Smiley Happy


Well, it did get 26 views in those 5 years Smiley Wink.

 

Anyway, the question isn't exactly clear. Partially transparent doesn't specify what parts should be transparent and what parts shouldn't.

 

I'd probably end up with a fully transparent TabControl, and use it as an enum to switch the content of a transparent SubPanel. The SubPanel can be aligned to look exactly like a TabPage. The TabControl can actually be minimized so it doesn't seem to have a page at all. You'd be using just the page selection part.

0 Kudos
Message 19 of 22
(889 Views)

wiebe@CARYA wrote:

Well, it did get 26 views in those 5 years Smiley Wink.


Actually, the question got 500 views...

0 Kudos
Message 20 of 22
(884 Views)