ICogGraphicMultiPen AddInteractivePen Method Cognex VisionPro
Creates an interactive pen based on the specified simple pens and returns the key. The specified simple pen keys must already exist, and zero is a valid key meaning 'use the pen properties of the graphic for the given state'.

Namespace: Cognex.VisionPro
Assembly: Cognex.VisionPro.Core (in Cognex.VisionPro.Core.dll) Version: 65.1.0.0
Syntax

int AddInteractivePen(
	int simplePenKeyWhenNormal,
	int simplePenKeyWhenSelected,
	int simplePenKeyWhenDragged
)

Parameters

simplePenKeyWhenNormal
Type: System Int32

The pen to use to draw the graphic in its normal state.

simplePenKeyWhenSelected
Type: System Int32

The pen to use when the graphic is selected.

simplePenKeyWhenDragged
Type: System Int32

The pen to use when the graphic is dragged.

Return Value

Type: Int32

The returned pen key.

Events

Event TypeReason
CogGeneralContour Changed

Fires when the pen is added.

The following state flags may be affected:

    Exceptions

    ExceptionCondition
    ArgumentException

    The key value for one of the simple pens is unknown, or one of the pens is not a simple pen

    Remarks

    Creates an interactive pen based on the specified simple pens and returns the key. The specified simple pen keys must already exist, or you can specify 0 to use the contour's default for a particular state.

    For example, the following line uses custom pens for the normal and dragged state and the contour's default SelectedColor, SelectedLineStyle, and SelectedLineWidthInScreenPixels for the selected state.

    MyInteractivePenKey = Contour.CustomPens.AddInteractivePen(MyNormalPenKey, 0, MyDragPenKey)

    AddInteractivePen(Int32, Int32, Int32) never returns the special key value 0.

    See Also