CogDisplay Fit Method Cognex VisionPro 9.10
Uses the current ScalingMethod to find the largest zoom value that allows the entire image to be visible in the display.

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

public virtual void Fit(
	[OptionalAttribute] bool graphicsToo
)

Parameters

graphicsToo (Optional)
Type: System Boolean
If true, the image is scaled and panned so that all graphics are visible too. This parameter is ignored if there are no graphics or if the graphics all lie within the bounds of the image.
Exceptions

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

Fit(Boolean) sets the scale and pan values so that the entire image is visible in the display. If there are graphics outside the area of the image and graphicsToo is true, the image is scaled and panned so that the image and graphics are visible.

Examples

private void AcquireButton_Click(object sender, System.EventArgs e)
{
    int trignum;

    cogDisplay1.Image = mAcqFifo.Acquire(out trignum);
    cogDisplay1.Fit(true);

    numAcqs++;
    if (numAcqs > 4) {
        GC.Collect();
        numAcqs = 0;
    }
}
Private Sub AcquireButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AcquireButton.Click
    Dim trignum As Integer

    cogDisplay1.Image = mAcqFifo.Acquire(trignum)
    cogDisplay1.Fit(True)
    numAcqs += 1

    If numAcqs > 4 Then
        GC.Collect()
        numAcqs = 0
    End If
End Sub
See Also