Skip to content

ImageGrabbedEventArgs Class#

Provides data for the ImageGrabbed event

Inheritance Hierarchy#

System.Object
  System.EventArgs
    Basler.Pylon.ImageGrabbedEventArgs

Syntax#

C#

public class ImageGrabbedEventArgs : EventArgs

VB

Public Class ImageGrabbedEventArgs
    Inherits EventArgs

The ImageGrabbedEventArgs type exposes the following members.

Constructors#

NameDescription
Public methodImageGrabbedEventArgs Initializes a new instance of the ImageGrabbedEventArgs class.
 

Properties#

NameDescription
Public propertyGrabResult Retrieves the grab result.
Public propertyIsClone Indicates if the event arguments have been created by calling Clone().
 

Methods#

NameDescription
Public methodClone Clones the event arguments including the grab result.
Public methodDisposeGrabResultIfClone Disposes the grab result held if the event arguments have been created by calling Clone().
 

Remarks#

Caution Caution
The grab result will be disposed after the event call. If you want to keep the grab result, clone the event arguments or the grab result.
  The following pattern can be used in Windows Forms applications to marshal the event call to the GUI thread.

C#

private void OnImageGrabbed(Object sender, ImageGrabbedEventArgs e)
{
    if (InvokeRequired)
    {
        // If called from a different thread, we must use the Invoke method to marshal the call to the proper thread.
        BeginInvoke(new EventHandler<ImageGrabbedEventArgs>(OnImageGrabbed), sender, e.Clone());
        return;
    }

    try
    {
        //do something
    }
    finally
    {
        e.DisposeGrabResultIfClone();
    }
}

ImageGrabbedEventArgs.Clone Method#

Clones the event arguments including the grab result.

Syntax#

C#

public ImageGrabbedEventArgs Clone()

VB

Public Function Clone As ImageGrabbedEventArgs

Return Value#

Type: ImageGrabbedEventArgs
Returns a copy of the event arguments with a clone of the contained grab result. The cloned grab result must be disposed.

Remarks#

Note Note
The grab result or the cloned event must be disposed.

ImageGrabbedEventArgs.DisposeGrabResultIfClone Method#

Disposes the grab result held if the event arguments have been created by calling Clone().

Syntax#

C#

public void DisposeGrabResultIfClone()

VB

Public Sub DisposeGrabResultIfClone

ImageGrabbedEventArgs Constructor#

Initializes a new instance of the ImageGrabbedEventArgs class.

Syntax#

C#

public ImageGrabbedEventArgs(
    IGrabResult grabResult
)

VB

Public Sub New ( 
    grabResult As IGrabResult
)

Parameters#

 

grabResult
Type: Basler.Pylon.IGrabResult
A grab result.

ImageGrabbedEventArgs.GrabResult Property#

Retrieves the grab result.

Syntax#

C#

public IGrabResult GrabResult { get; }

VB

Public ReadOnly Property GrabResult As IGrabResult
    Get

Property Value#

Type: IGrabResult

Remarks#

Caution Caution
The grab result is going to be disposed after the event call. Clone the event arguments or the grab result if you want to keep the grab result.

ImageGrabbedEventArgs.IsClone Property#

Indicates if the event arguments have been created by calling Clone().

Syntax#

C#

public bool IsClone { get; }

VB

Public ReadOnly Property IsClone As Boolean
    Get

Property Value#

Type: Boolean