Tolerance Property

Measurement Studio User Interface

Tolerance Property

Syntax

CWImage.Tolerance

Data Type

Long

Purpose

Specifies the percentage for matching color hues on the image to the SubstituteColor property.

Remarks

Use the Color property to specify the color in the metafile image that you want to replace. Then use the SubstituteColor property to specify the color that will replace Color. Use the Tolerance property to specify the percentage at which you want Color matched.

If you set the Tolerance to 100, then all colors on the image (that is, 100 %) are substituted. If you set this property to 0, then no color on the image (0 %) is substituted. Use a small tolerance to replace close matches to SubstituteColor.

Example

'Load the metafile into the OffImage of the CWButton
Set CWButton1.OffImage.CWImage.Picture = LoadPicture("c:\pics\stop.wmf")

'Replace all red in image with blue
CWButton1.OffImage.CWImage.Substitute = True
CWButton1.OffImage.CWImage.Color = vbRed
CWButton1.OffImage.CWImage.SubstituteColor = vbBlue
'Substitute only very close hue matches
CWButton1.OffImage.CWImage.Tolerance = 10

See Also

Substitute

Color

SubstituteColor