Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

multiline captions in annotations

Is it possible to create a multiline caption for a grid annotation? Also, I would like to have a background color for the annotation instead of it being transparent - is there a way to do this?
0 Kudos
Message 1 of 4
(3,338 Views)
Hi,

In order to create a multiline caption, add a line to manually set the caption in your code. In the line add line feed characters, and the lines will be seperated. For example:

xyPointAnnotation1.Caption = "This is on the first line\nThis is on the second line";

Your annotation caption will appear as:

This is on the first line
This is on the second line

Apparentley, when you try to set this property in the Form view, the line feed characters are included in the text. So if I go to my user interface view, and set the Caption property of the annotation object to the above line, it will show up as:

This is on the first line\nThis is on the second line

In order to set the background color of the Caption, there is a property for the annotation object called "CaptionBackColor".

Good luck!

Tyler T.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,322 Views)
Thanks for the reply. I should have specified I am using the CNiAnnotation class, and cannot get either of these things to work using this class.
0 Kudos
Message 3 of 4
(3,317 Views)
Hi,

From looking at the class libraries, it does not appear that either task can be accomplished using the CNi function set. The CNiColor parameter only refers to the foreground color of the caption text. Moreover, CNi does not interpret line feeds or carriage returns.

I suggest writing a small class that uses the standard Windows Dialog Static Text. The position of the Annotation can be used to place the textbox. Additionally, you are able to set the background color of the text.

Regards,

Tyler T.
0 Kudos
Message 4 of 4
(3,305 Views)