LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

picture control offset when displaying an image in a XControl

Hello, I'm trying to learn something about XControls so I decided to make something like a boolean control in which you can load two images that will be displayed in each of the true or false cases. When you right clic the XControl (open the .zip attached please) in the "untitled.vi" front panel, the last option in the XControl's menu is "Seleccionar Imagenes", if you clic this option in the menu a subvi will be shown, in this subvi you will be able to select the two images that the control will show in an "ON" or "OFF" state, I need the images to fill the entire picture control size of the in the XControl, (like they do in this Subvi). But if you clic "OK" and then you return to the "untitled.vi" front panel, the image loaded in the picture control (inside the XControl) has something like an offset in the Y axis (see the image attached). The image is not filling the entire picture control. I don't know why is this happening.

I somebody know how to modify this please  tell me. Thank You.
Paul
Mechatronic engineer
Lima-Perú
Download All
0 Kudos
Message 1 of 3
(2,489 Views)

I believe what is happening is related to the aspect ratio of your file versus the aspect ratio of your picture control.  The pictures on the right are a little more rectangular, while the picture control on the left is closer to square.  So the extra space at the top of the picture control is white, and the origin of the picture control must be the lower left.

Try another picture that does not have a white background.  Or change the picture control background to something besides white and see if there is a distinct line at the edge of the picture.

You may just have to use property nodes to resize the frame of your picture control to match the aspect ratio of the image.

0 Kudos
Message 2 of 3
(2,470 Views)
             Thank you for the answer. I'm Resizing the image to the Draw Area Size, using a function block I found in this forum (made by someone called "TST"), my problem is when the code is in the XControl, cause if i put the code in a VI it works fine displaying the image in all the draw area. The code for opening and displaying the image is like I show in the attached picture, but when I do the same in the XControl the picture always has an offset in the Y-axis. If you open the project I have attached in my last post you'll understand me better. I can't findout what is happening, maybe is something easy but I need another point of view. Thank you.


Paul
Mechatronic engineer
Lima-Perú
0 Kudos
Message 3 of 3
(2,454 Views)