This event is generated when the TakeSnapshot method successfully executes.
[Visual Basic]Public Event Snapshot As SnapshotEventHandler
[C#] public event SnapshotEventHandlerSnapshot;
Event Data
Event Handler receives arguments of type SnapshotEventArgs
Explanation
The Snapshot event is generated when the TakeSnapshot method successfully executes.
The snapshot retrieved within this event can be referred to in the SnapshotEventArgs arguments
Regarding the SnapshotEventArgs Class property:
When Dispose is True, the retrieved snapshot's Bitmap is freed from
the memory when the event finishes. To keep the Bitmap, it is
necessary to execute the Clone method and save the Bitmap to
file.
Example
Displaying the retrieved snapshot in a PictureBox:
[Visual Basic.NET]
Private Sub Preview1_Snapshot(ByVal sender As Object, ByVal e As Newtone.ImageKit.Win.WebCamera.SnapshotEventArgs) Handles Preview1.Snapshot
e.Dispose = False
If Not (PictureBox1.Image Is Nothing) Then
Private Sub Preview1_Snapshot(ByVal sender As Object, ByVal e As Newtone.ImageKit.Win.WebCamera.SnapshotEventArgs) Handles Preview1.Snapshot
e.Dispose = False
If Not (PictureBox1.Image Is Nothing) Then
PictureBox1.Image.Dispose()
PictureBox1.Image = Nothing
End If
'if e.Dispose is False then
PictureBox1.Image = e.Bitmap
'if e.Dispose is True then
PictureBox1.Image = Nothing
End If
'if e.Dispose is False then
PictureBox1.Image = e.Bitmap
'if e.Dispose is True then
'PictureBox1.Image =
e.Bitmap.Clone()
End Sub
End Sub
[Visual C#.NET]
private void preview1_Snapshot(object sender, Newtone.ImageKit.Win.WebCamera.SnapshotEventArgs e)
{
e.Dispose = false;
if (pictureBox1.Image != null)
{
pictureBox1.Image.Dispose();
pictureBox1.Image = null;
}
//if e.Dispose is false then
private void preview1_Snapshot(object sender, Newtone.ImageKit.Win.WebCamera.SnapshotEventArgs e)
{
e.Dispose = false;
if (pictureBox1.Image != null)
{
pictureBox1.Image.Dispose();
pictureBox1.Image = null;
}
//if e.Dispose is false then
pictureBox1.Image =
(Image)e.Bitmap;
//if e.Dispose is true then
//if e.Dispose is true then
//pictureBox1.Image =
(Image)e.Bitmap.Clone();
}
}
See Also
Preview Members | Newtone.ImageKit.Win.WebCamera.Preview