Showing results for 
Search instead for 
Did you mean: 

i want to scale the font size programmatically according to the screen resolution

I have done scaling the front panel and front panel objects by programmatically. but the text (font) size is still remain same. It’s shows very bad. So I want to scale the font size programmatically according to the screen resolution. Can u suggest some idea to implement?
0 Kudos
Message 1 of 10
You can accomplish this task by using property nodes. The two main things you need to do in your program is read the current screen resolution and set the font size accordingly. Below I've described how to carry out these two steps:

1) Programmatically getting the screen resolution: The VIs you will need can be found in the All Functions->Application Control palette. Place down an Open Application and a Property Node and wire them together in that order (this allows the property node to control the local machine). Right click the property and navigate to Properties->Display->Primary Workspace and select it. This property will output the screen resolution in pixel coordinates (you can press Ctrl+H to bring up the context help and hover your cursor over the property to get more information about the format of the output).

2) Programmatically setting the font size of a control: Find the control on the block diagram, right-click it, and select Create->Property Node. Next, you will need to right-click the property in the property node and select the font size property. For a button control, you would select Properties->Boolean Text->Font->Size. You will then need to right-click the property again and select Change to Write (this allows you to set the value rather than read it). Now you can wire up your desired font size to the property.

Once you are able to acquire the screen resolution and set the font size, it is up to you how you choose the font size based on the screen resolution. You could use a simple multiplier or you could use a case structure that assigns font sizes to different ranges of screen resolutions. The choice is up to you! Hopefully, though, this information will put you well on your way.


Eric S.
Applications Engineer
National Instruments
E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 2 of 10
I don't know if it's possible to rescale the font of statics texts of the front faces of vis programaticaly, as it's told for the commands and indicators.
Because when you go to a lower screen resolution, commands and indicators go smaller, but not  the fonts.  And as the statics texts of the front faces hasn't got any references on the code diagram,so it seems a bit difficult!!!
So if you can help me, you are welcome!

ps :
I work on my development computer with a screen resolution of 1024 x 768 and the software have to run on a CNC computer with a screen resolution of 640 x 480.

0 Kudos
Message 3 of 10

So are you trying to resize a free label (one you made by double clicking and typing on the Front Panel) with varying resolutions?  If so you are correct that since you can't get a reference to a free label, you will need a workaround.  One thing that I can think of would be to make the free label a caption of a control that you have on your VI.  The captions can be resized using the same procedure outlined above (except you would need a reference to the controls caption).

Please let me know if you have any other questions!
Andy F.
National Instruments
0 Kudos
Message 4 of 10
Thanks for your answer Andy!

In fact, I have to improve a quite imposing  software that has already  been developed for another CNC.
So i prefer not to make a new project...
Is there any property of the front panel that can avoid this problem?

For example :
    Make a class constant, choose Generic, Graphic object, decoration, text, and then make a property node with font.size?
    or is it only for distants fronts panels?
    Isn't there something else like that in labview. I think it's one of the less things a software development tool can offer.

Thanks to answer me once again!
0 Kudos
Message 5 of 10

As shown in the attached vi, resizing free labels is easy, once you know how to proceed 😉

First, you need to get a reference to the free label. It's a FP decoration (among others...). Then tell LabVIEW that you want to access the text properties of the decorations (using "To More Specific Class) , and you're done.

Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
Message 6 of 10
Your help is wonderful, thank you.
But i have a little problem: my labview version is 7.0 and i can't read the VI you have sent, please can you give me one i can read.

0 Kudos
Message 7 of 10
Here is a 7.0 version  
Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
Message 8 of 10
Very big thanks Chilly Charly!!!

0 Kudos
Message 9 of 10
Of course.  Well that is my oversight, I looked all over, but completely forgot about the decoration references.  Well done!

Andy F.
National Instruments
0 Kudos
Message 10 of 10