Programmatically Change Font, Color, or Size of String Subset

Updated Aug 1, 2018

Reported In

Software

  • LabVIEW

Issue Details

  • I can manually select a portion of the text in a string control or indicator and change its colors, but how can I do this programmatically?
  • How do I programmatically change the color of a section of a string control?

Solution

You can programmatically change the font of a subset of text from a string control or indicator by following these steps:
 
  1. Right-Click on the string control or indicator and select Create»Property Node»Text»Selection»Start
  2. Right-click on the Text.SelStart property and select Create»Constant. This specifies the offset of the first character of the selected text.
  3. Expand the property node to expose a second property.
  4. Left-click on this second property and select Text»Selection»End
  5. Right-click on the Text.SelEnd property and select Create»Constant. This specifies the offset of the last character of the selected text. 
  6. Expand the property node to expose a third property. 
  7. Left-click on the third property and select Text»Font and then the font property to be programmatically controlled. 
  8. Repeat steps 6 and 7 to programmatically control additional properties like color or size for the selected text.

Additional Information

You can use the image below as a reference for adjusting the font, size, and color of a subset of text.

WAS THIS ARTICLE HELPFUL?

Not Helpful