Skip to main content

TakePictureDialog Class

The modal dialog to take pictures from a camera device.

Namespace: DevExpress.XtraEditors.Camera

Assembly: DevExpress.XtraEditors.v23.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public class TakePictureDialog

Remarks

Use the Take Picture dialog to allow users to take pictures from an attached camera device in a modal dialog. This dialog contains an embedded Camera Control.

CameraControl - Capture Dialog New

When a user captures an image and clicks the Save button, the image is saved to the TakePictureDialog.Image property.

The following code shows a TakePictureDialog and then saves the captured image to a file.

using DevExpress.XtraEditors.Camera;

TakePictureDialog d = new TakePictureDialog();
if(d.ShowDialog() == System.Windows.Forms.DialogResult.OK){
    Image i = d.Image;
    i.Save("C:\\snapshot.bmp");
}

Select the Camera Device and Resolution

The Take Picture dialog saves the currently selected camera device and its resolution in the system registry when a user closes the dialog. These settings are reused the next time a user opens the dialog. If the system registry contains no information on the previously used camera device, the Take Picture dialog will use the default camera device (CameraControl.GetDefaultDevice).

To override the default camera device and resolution selection, use the TakePictureDialog.Device and TakePictureDialog.ResolutionMode properties.

The following example sets the maximum resolution for the selected camera device.

TakePictureDialog dialog = new TakePictureDialog();
dialog.ResolutionMode = ResolutionMode.Maximum;
dialog.ShowDialog();

Customize the Dialog and Output Image

The following events allow you to customize the dialog, camera device, resolution and captured image:

  • TakePictureDialog.Showing - Fires when the dialog is about to be displayed. Allows you to customize the form, and specify the camera device and resolution.
  • TakePictureDialog.Closed - Fires when the dialog is closed. Allows you to get the dialog result and captured image, and replace this image.

Inheritance

Object
TakePictureDialog
See Also