From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically editing control images

Solved!
Go to solution

I'm programmatically changing the images that make up various controls using the method AndreyDmitriev described in this dicussion:

https://decibel.ni.com/content/message/10496

When I do this, however, the images are imported into the control at the same size they are in the control and not the size of the image being imported. As such many of my images are getting resized and look ugly in the new controls.


Does anyone know a way to import images programmatically without resizing them? I know I could do this by hand, but frankly, I just don't want to.

Thanks,
David

David S.
0 Kudos
Message 1 of 2
(3,752 Views)
Solution
Accepted by dstrandb

I don't think there is for someone without access to the LabVIEW source. Replacing the image is a question of finding the image resource and replacing that. While that is not trivial it is a data blob in the file that is locatable without knowing every detail of the control file format. The information about the size of the image in the control is simply part of the control description resources itself. So even if you know how to locate resources in the control file, you still don't know which resource you need to have, nor which bytes in that resource define the position and size of the image.

And even with access to the source a possible solution is very likely NOT LabVIEW version independant. NI keeps improving LabVIEW and that also means adding new information to their resource data structures. So even if someone at NI would want to go to the length to write a password protected VI to do that, he or she would very likely be called back because it can't be made a stable VI without spending lots and lots of time on it to not corrupt older versions of LabVIEW files and if that person would just limit to the newest LabVIEW version it would cause complaints about not supporting older versions.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 2
(2,909 Views)