Jump to content

Programmatically editing control images


Recommended Posts

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

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

which is similar to the method from:

http://lavag.org/top...within-control/

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 life would be a lot easier if I could do it programmatically.

Thanks,

David

Edited by dstrandberg
Link to comment
  • 3 weeks later...

My goto method for resizing controls is to use the following VI from the resource directory:

...\LabVIEW 2009\resource\dialog\Resize.llb\PosDims.PasteToTargets.vi

Open the ctl file you have created and get the control reference (only object), hide the label so the control bounds equal the image bounds, then use that VI to scale the control to match the original image size, then reposition the label. In the attached VI I add the ability to change the label as well. I use this to autogenerate frameless buttons from PNG glyph files.

ScaleControl.vi

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.