LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Picture control forgets its image after resizing

Solved!
Go to solution

I have a VI that uses a picture control that resizes as the window resizes.  The problem is, the image erases most of itself when it resizes.  I've deduced that this occurs because I have Erase First unselected.  After the resize, only the last draw remains visible.  See the attached example to better understand.

 

I'm wondering if there is a way to get it to remember.  Or a way to get the picture data, so I can "redraw" it after any resize, without actually redrawing.

 

Any suggestions? Thanks

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 1 of 14
(3,990 Views)
Add a feedback node Smiley Wink for the picture.  It is only the unselection of 'Erase First' that keeps all of the circles drawn.  Initialize with an empty picture and use the picture in and picture out on the drawing VIs.
0 Kudos
Message 2 of 14
(3,986 Views)
Oh I forgot to mention.  In my real application that loop loops >200 times and, if I use a shift register, by the 10th time it runs really slow.  So, I'm trying to avoid that.
Message Edited by elset191 on 09-25-2009 01:29 PM
--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 3 of 14
(3,978 Views)
In that case I would build an array of pictures, wire that array to concatenate strings and wire that to the picture control.  You could use a local variable to update the picture in the loop (unselect Erase First) if you want to see the action unfold).
Message 4 of 14
(3,972 Views)

Darin.K wrote:
In that case I would build an array of pictures, wire that array to concatenate strings and wire that to the picture control.  You could use a local variable to update the picture in the loop (unselect Erase First) if you want to see the action unfold).

This works, but it's still slow (not nearly as slow as the shift registers) in my main app.  I'm going to see if I can't trim down the additional draws.

 

Where the heck did you come up with using concatenate strings?

Message Edited by elset191 on 09-25-2009 01:49 PM
--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 5 of 14
(3,964 Views)

You'll have to find the balance between performance (no redraws) and usability (many redraws).

 

Concatenate Strings was my second VIOTD, but since it was still in the experimental phase it is buried in the Breakpoint Thread.

0 Kudos
Message 6 of 14
(3,960 Views)
Where did you learn/what made you think to try concatenate strings on images?
--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 7 of 14
(3,958 Views)

So, as an update.  In my actual application these pictures are polar graphs.  And after thinking about it I realized I was redrawing the grids and labels every time (over 250).  So I trimmed down all of these redaws.  I'm still plotting over 250 images though.  The images are now just really thinned down. 

 

Using the concatenate strings method the drawing is really fast, but the resizing takes about 5 seconds.

Using the shift registers the drawing takes >5 seconds and the resizing takes about 5 seconds still.

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 8 of 14
(3,949 Views)
At some point I figured that there was a reason that the wires for pictures looked like strings.
0 Kudos
Message 9 of 14
(3,946 Views)
Before you resize, try Picture to Bitmap followed by Draw Flattened Pixmap to get your picture back.  If you have a lot of overlapping picture elements, flattening should speed the drawing process.
0 Kudos
Message 10 of 14
(3,943 Views)