CogDisplay DrawingEnabled Property Cognex VisionPro 9.22 SR1
Gets or sets whether drawing takes place.

Namespace: Cognex.VisionPro.Display
Assembly: Cognex.VisionPro.Display.Controls (in Cognex.VisionPro.Display.Controls.dll) Version: 87.1.0.0 (87.1.0.0)
Syntax

public virtual bool DrawingEnabled { get; set; }

Property Value

Type: Boolean
True if drawing takes place.
Events

Exceptions

ExceptionCondition
AxHost InvalidActiveXStateException Thrown when the display control is invalid.
Remarks

When this property is true (the default), then all methods and properties that would change the appearance of a display are rendered immediately.

If you are constructing a complex graphic display using many individual graphic objects, you can improve performance by disabling drawing, adding all the graphics, then enabling drawing. When you re-enable drawing, all rendering is performed.

Note that setting this property to false also disables any updates to the display of the image, so changes to pan or zoom values will not appear until after drawing is re-enabled

Examples

private void doDraw() {
    CogCircle mCircle = new CogCircle();
    CogRectangle mRect = new CogRectangle();

    cogDisplay1.DrawingEnabled = false;

    cogDisplay1.InteractiveGraphics.Add(mCircle, "Circle", false);
    cogDisplay1.InteractiveGraphics.Add(mRect, "Rect", false);

    mCircle.CenterX = cogDisplay1.Image.Width / 2;
    mCircle.CenterY = cogDisplay1.Image.Height / 2;
    mCircle.Radius = cogDisplay1.Image.Height / 4;
    mRect.SetCenterWidthHeight(mCircle.CenterX, mCircle.CenterY, cogDisplay1.Image.Width / 2, cogDisplay1.Image.Height /2);

    cogDisplay1.DrawingEnabled = true;
}
Private Sub doDraw()
    Dim mCircle As New CogCircle
    Dim mRect As New CogRectangle

    cogDisplay1.DrawingEnabled = False
    cogDisplay1.InteractiveGraphics.Add(mCircle, "Circle", False)
    cogDisplay1.InteractiveGraphics.Add(mRect, "Rect", False)

    mCircle.CenterX = cogDisplay1.Image.Width / 2
    mCircle.CenterY = cogDisplay1.Image.Height / 2
    mCircle.Radius = cogDisplay1.Image.Height / 4
    mRect.SetCenterWidthHeight(mCircle.CenterX, mCircle.CenterY, cogDisplay1.Image.Width / 2, cogDisplay1.Image.Height / 2)

    cogDisplay1.DrawingEnabled = True
End Sub
See Also