Advanced - Setting Colors and Shapes

In advanced code there are three functions that set the colors and shapes of the resulting paintbar.

 

SetColor, SetShape and SetColorAndShape

 

there is also a function GetNamedColor which allows you to get the color that is assigned by the user to a color name.

 

The following overloads of these functions are available:

 

SetColor(Color color)

 

SetColor(SysColor syscolor)

 

SetColor(int intcolorRGB)

Sets the output color to this absolute color. Does not allow the user of the paintbar to change the color in the paintbar instance parameters.

 

The SysColor refers to the MT's chart color scheme colors. intcolorRGB is the standard RGB representation of colors. For example, Color.Red is same as 0xFF0000.

SetColor(String NamedColor, SysColor DefaultColor = SysColor.None)

 

SetColor(String NamedColor, Color DefaultColor = default(Color))

 

SetColor(String NamedColor, uint DefaultColorRGB = 0)

Sets the output color to a "named color".  The name of the color will appear in the paintbar's instance parameters and user of the paintbar will be able to set it.

 

NOTE: The NamedColor has to be a literal string (not a variable) at least once in the code of the paintbar in order to appear in the paintbar's instance parameters.

SetShape(PBShape Shape)

Simply - set the shape. Set it to PBShape.Default to allow the user of the paintbar to set the desired shape in the paintbar's instance parameters.

SetColorAndShape...

Like SetColor, but also sets the shape.

 

If you're using the paintbar as a scan,  then you can have several scan results, each with its own colors. To do that, there is a set of SetColor functions that accept a resultNum parameter so you can set different colors for different results. The resultNum is 0 - based, that is, for the first scan result the resultNum would be 0, for the second it would be 1 and so on...

 

Example:

 

SetColor(1, Color.Red);

 

Similar use of the resultNum parameter is done when creating a Cloud Paintbar.