Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
4 ratings:
 2.75 out of 5   

How to Programmatically Set an Image as a Front Panel Background



Primary Software:
Primary Software Version: 8.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
How do I programmatically set an image as a front panel background?

Solution:
VI Server is used to programmatically set an image as a front panel background through the use of property nodes and VI references.

If setting the front panel background of another VI, the Open VI Reference VI is used to convert a VI file path to a VI reference.  If setting the background of the current VI, use a VI Server Reference found in the Application Control palette. 

Complete the block diagram as follows to programmatically set an image as the front panel background.
  1. Place a Open VI Reference VI or a VI Server Reference on the block diagram and wire a path control to the vi path input. 
  2. Wire the vi reference output to a Property Node to explicit link the property node to the VI class.
  3. Select Front Panel from the property list. 
  4. Wire the panel refnum output to a second Property Node and select Panes[] from the property list. 
  5. The output of Panes[ ] is an array of pane refnums, so add an Index Array VI to the block diagram to select a single pane. 
  6. The output of the Index Array VI will be wired into a third Property Node.  Select BackgroundImage on the final Property Node. 
  7. BackgroundImage requires a cluster input of image data.  The Read BMP File VI, Read JPEG FileRead PNG File VI all convert an image file into an image data cluster.  Wire the image data cluster output to the BackgroundImage input, and wire the path of the image file into one of the above mentioned read VIs.


An example VI is available on the community here:  Developer Zone Community: Programmatically Set an Image as a Front Panel Background, or you can use the VI Snippet above and drag it into LabVIEW from Internet Explorer.

Related Links:
Developer Zone Community: Programmatically Set an Image as a Front Panel Background
KnowledgeBase 3HGEI6L2: How To Set an Image as a Front Panel Background

Attachments:





Report Date: 07/27/2009
Last Updated: 02/07/2014
Document ID: 4ZQGR7WA

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit