09-03-2019 03:03 PM
Hello,
I'm using LabView NXG 3.1.1 and I've noticed that when running a VI in a separate window instead of the editor, the window that opens up is enormous. I can manually resize it by going to the Panel tab and entering in my screen's resolution in the width and height boxes in the 'Canvas' section.
However, the program I'm working on will likely be run on multiple machines with potentially different screen resolutions. How do I ensure that when the program opens up in a separate window, the window will be the correct size every time?
09-04-2019 11:14 AM
Hi gabe57,
There is a way to programmatically set the window size, but not to read the resolution of the new screens. Would that be sufficient?
Best,
09-04-2019 12:44 PM
Ok,
So there is no way to get the resolution of the current screen?
In order to set the window size, it looks like it can be done by creating a panel reference and inserting a property node for the window size. Is that the right way to do it?
Thanks,
Gabe
09-04-2019 01:03 PM
Hi Gabe,
That's correct, that's how you would do that.
As for getting screen resolution, LabVIEW NXG doesn't support this natively. There may be some workarounds to get it, including using the VI Interop node to call into LabVIEW, but the best solution for you depends on many other factors.
Best,
09-04-2019 01:51 PM
Not sure if .net works in NXG, but look at method 3 of this post
09-04-2019 05:42 PM
Hi gabe57,
You can programmatically resize the panel using both of the above suggestions. See the below images and the attached example project. You can use the .NET Interface to call the System.Windows.Forms assembly and use the Screen object per that other post.
Frozen, .NET does in fact work with LabVIEW NXG (NXG is built in .NET). See Calling .NET Code from Your Application for more info.
Thanks,
Frank