Share via


CameraCaptureDialog.ShowDialog Method

3/29/2010

Displays the "Camera Capture" dialog box, which allows the user to capture still images and video clips.

Namespace: Microsoft.WindowsMobile.Forms
Assembly: Microsoft.WindowsMobile.Forms (in microsoft.windowsmobile.forms.dll)

Syntax

public DialogResult ShowDialog ()
'Declaration
Public Function ShowDialog As DialogResult

Return Value

One of the DialogResult values (either OK or Cancel).

Remarks

This is a modal dialog box.

Example

This example shows how to call and display a dialog box for taking a picture or video.

CameraCaptureDialog cameraCapture = new CameraCaptureDialog();
            
cameraCapture.Owner = null;
cameraCapture.InitialDirectory = @"\My Documents";
cameraCapture.DefaultFileName = @"test.3gp";
cameraCapture.Title = "Camera Demo";
cameraCapture.VideoTypes = CameraCaptureVideoTypes.Messaging;
cameraCapture.Resolution = new Size(176, 144);
cameraCapture.VideoTimeLimit = new TimeSpan(0, 0, 15);  // Limited to 15 seconds of video.
cameraCapture.Mode = CameraCaptureMode.VideoWithAudio;

if (DialogResult.OK == cameraCapture.ShowDialog())
{
    Console.WriteLine("The picture or video has been successfully captured to:\n{0}", cameraCapture.FileName);
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread-safe. Any instance members are not guaranteed to be thread-safe.

See Also

Reference

CameraCaptureDialog Class
CameraCaptureDialog Members
Microsoft.WindowsMobile.Forms Namespace