This website is being translated through machine translation by a third-party service. Basler does not warrant the accuracy, reliability or timeliness of any information translated by this system and will not accept liability for loss or damage incurred as a result. Content that has not yet been translated appears in English. Switch to English version
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#
privatevoidOnImageGrabbed(Objectsender,ImageGrabbedEventArgse){if(InvokeRequired){// If called from a different thread, we must use the Invoke method to marshal the call to the proper thread.BeginInvoke(newEventHandler<ImageGrabbedEventArgs>(OnImageGrabbed),sender,e.Clone());return;}try{//do something}finally{e.DisposeGrabResultIfClone();}}