Back to Devexpress

RepositoryItemPictureEdit.TakePictureDialogShowing Event

windowsforms-devexpress-dot-xtraeditors-dot-repository-dot-repositoryitempictureedit-0a6575d6.md

latest5.6 KB
Original Source

RepositoryItemPictureEdit.TakePictureDialogShowing Event

Fires when the Take Picture dialog is about to be displayed. Allows you to customize the dialog, and specify the camera device and resolution.

Namespace : DevExpress.XtraEditors.Repository

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Events")]
public event TakePictureDialogShowingEventHandler TakePictureDialogShowing
vb
<DXCategory("Events")>
Public Event TakePictureDialogShowing As TakePictureDialogShowingEventHandler

Event Data

The TakePictureDialogShowing event's data class is TakePictureDialogShowingEventArgs. The following properties provide information specific to this event:

PropertyDescription
CancelGets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
DeviceGets or sets the camera device.
FormGets the form that encapsulates the dialog.
ManualResolutionGets or sets a camera resolution that is applied when the TakePictureDialogShowingEventArgs.ResolutionMode property is set to Manual.
ResolutionModeGets or sets the camera resolution mode.

Remarks

The TakePictureDialogShowing event allows you to perform actions when the Take Picture dialog is about to be displayed.

The event’s Cancel parameter allows you to prevent the display of the dialog.

Access and Modify the Dialog

To modify the dialog (for instance, change the dialog’s title) use the event’s Form parameter.

csharp
private void pictureEdit1_TakePictureDialogShowing(object sender, DevExpress.XtraEditors.Camera.TakePictureDialogShowingEventArgs e) {
    e.Form.Text = "Camera";
}
vb
Private Sub PictureEdit1_TakePictureDialogShowing(sender As Object, e As DevExpress.XtraEditors.Camera.TakePictureDialogShowingEventArgs) _
    Handles PictureEdit1.TakePictureDialogShowing
    e.Form.Text = "Camera"
End Sub

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.

csharp
void pictureEdit1_TakePictureDialogShowing(object sender, TakePictureDialogShowingEventArgs e) {
    e.ResolutionMode = ResolutionMode.Maximum;
}
vb
Sub PictureEdit1_TakePictureDialogShowing(sender As Object, e As DevExpress.XtraEditors.Camera.TakePictureDialogShowingEventArgs) Handles PictureEdit1.TakePictureDialogShowing
    e.ResolutionMode = DevExpress.XtraEditors.Camera.ResolutionMode.Maximum
End Sub

The PictureEdit.TakePictureDialogShowing and RepositoryItemPictureEdit.TakePictureDialogShowing events are equivalent.

See Also

ShowCameraMenuItem

TakePictureDialogClosed

ShowTakePictureDialog()

RepositoryItemPictureEdit Class

RepositoryItemPictureEdit Members

DevExpress.XtraEditors.Repository Namespace