Popular Post hooovahh Posted April 24, 2017 Popular Post Report Share Posted April 24, 2017 There is still no way through scripting to replace the decals on buttons to use a different image. But using some known LabVIEW calls we can extract the image and replace it, then save it with a new file name. This has been done several times replacing the PNG image data in the CTL file. The problem I have with this is PNG images don't scale well. If I have a PNG that is 16x16 pixels on a small button, and I happen to want to make this button for a larger touch screen UI, I can but the image will look poor. LabVIEW does support some vector images mainly the EMF and WMF file formats. So using an external program Inkscape, I wrote some code that will take an SVG file (which is vector based) convert it to an EMF, and replace the decals of buttons, as well as give the CTL a PNG icon, label, and boolean text. I recently re-discovered a website that has all kinds of useful flat icons, and makes them available as SVGs. So all that is needed is to download Inkscape, download an SVG, and run a VI that I've attached. In the zip is some Example Controls I've generated using the SVGs from the Essential Collection which make controls based on 6 different templates. The JKI Flat Dark/Light, the Flatline Dark/Light, and the System Vertical and Horizontal controls. The main VI is in Replace Button Decals\Create Control from SVG.vi. I could see this being used on a repository of SVGs at some central location like a network drive, and then call something like Tools>>Generate Controls which shows a database of icons, and control types, and then generates them, rather than generating tons of controls that might never be used. Oh and I did find this pretty handy program that allows for viewing SVG images in Windows Explorer. It really helps to be able to see the icons and organize them before generating controls. Vector SVG Controls.zip 4 1 Quote Link to comment
drjdpowell Posted April 24, 2017 Report Share Posted April 24, 2017 Nice work. Though the problem with using vector-graphic icons in LabVIEW is the lack of antialiasing, especially for small icon sizes. A PNG icon, if kept at original size, looks better. Quote Link to comment
hooovahh Posted April 24, 2017 Author Report Share Posted April 24, 2017 Bummer. Well still most of the icons look alright when small but is definitely noticeable. Quote Link to comment
drjdpowell Posted April 25, 2017 Report Share Posted April 25, 2017 At some point, when everyone has ridiculously high-res screens, we won’t need antialiasing anymore. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.