Using the Windows Forms Instrument Control Strip .NET Control

Measurement Studio 2019 Help

Edition Date: May 2019

Part Number: 375857B-01

»View Product Info
Download Help (Windows Only)

The Measurement Studio InstrumentControlStrip control provides a container for ToolStripPropertyEditor and other tool strip items. The ToolStripPropertyEditor hosts the PropertyEditor control and exposes all members of the PropertyEditor control. You use the InstrumentControlStrip control to display a set of PropertyEditor controls through the ToolStripPropertyEditor. By using a single InstrumentControlStrip control, you can edit multiple property values of controls. For more information about the PropertyEditor control, refer to Using the Measurement Studio Windows Forms Property Editor .NET Control.

You can use the InstrumentControlStrip control as a toolbar for editing property values of another control through the associated editors at run time. For example, you can populate the InstrumentControlStrip with ToolStripPropertyEditor items that edit property values of a WaveformGraph through the associated editors at run time. The editor displayed by the ToolStripPropertyEditor is the same editor that displays when you edit the property at design time.

Source represents the property to edit. To edit a property of an object, you must set the Source property with an object reference and the property name on that object. The following example shows how to set Source so that you can edit the ScaleArc value on a Knob control. The example assumes that a Knob control called knob1 and a ToolStripPropertyEditor object called toolStripPropertyEditor1 have been declared and initialized.


ToolStripPropertyEditor1.Source = New PropertyEditorSource(Knob1, "ScaleArc")

toolStripPropertyEditor1.Source = new PropertyEditorSource(knob1, "ScaleArc");

The first image shows the Scale Arc instrument strip control. The second image shows the Scale Arc instrument strip control expanded.

You cannot use the ToolStripPropertyEditor by adding the object to the Items collection of an InstrumentControlStrip. The following example shows how to add a ToolStripPropertyEditor object to an InstrumentControlStrip control. The example assumes that an InstrumentControlStrip control called instrumentControlStrip1 and a ToolStripPropertyEditor object called toolStripPropertyEditor1 have been declared and initialized.




You can add other types of items to the InstrumentControlStrip, such as ToolStripButton , ToolStripLabel , ToolStripComboBox , and ToolStripSeparator . You add ToolStripLabel before ToolStripPropertyEditor to label the PropertyEditor with the name of the property that will be edited.

Use SourceValue to get the value of the property being edited, and use FormattedSourceValue to get the string representation of the property value. You can call EditValue to launch the associated editor programmatically. You use the IsEditingValue property to determine if the property value is being edited.

You can also edit the property value by typing the value of the property into the ToolStripPropertyEditor object. If the property value cannot be converted to a valid value, the SourceValueWarning event is raised. You can use the SourceValueWarning event to set the SourceValue property to a valid value. If SourceValue is not set to a valid value in the event, the ToolStripPropertyEditor reverts to the previous value.

You can change the way end users interact with the control through the InteractionMode. You can customize the appearance of the control by setting the BorderStyle, RenderMode, DisplayMode, and PropertyTextAlign properties. Use RenderMode to determine the style used to draw the RenderMode. RenderMode is set to Inherit by default to allow the style of the ToolStripPropertyEditor to be ambient with its InstrumentControlStrip container. The RenderMode value is only applied when the BorderStyle is BorderStyle .


Not Helpful