Log In
[Expand]Welcome to DevExpress .NET Documentation
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Collapse]Editors and Simple Controls
    Templated ListBox Items
   [Expand]Simple Editors
   [Expand]Lookup Editors
   [Expand]Token Edit Control
   [Expand]Breadcrumb Edit Control
   [Expand]Range Control
   [Expand]Image Slider
    Camera Control
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Camera Control

The Camera Control object represents a control that displays a video stream from a video capture device, such as a webcam, and provides an end-user with the capability to operate the device and adjust the video quality. In the figure below, you can see the Camera Control displayed in the Take Picture dialog.

In the top far corner, the Camera Control displays the predefined Settings context button. The visibility of this button is controlled by the CameraControl.ShowSettingsButton property. This button, when clicked, invokes the built-in Camera Settings panel, which allows an end-user to select the active device, adjust the contrast, brightness and saturation, or reset these settings to their defaults. See the figure below.

In code, you can invoke this panel by calling the CameraControl.ShowSettingsForm method.

The Camera Control automatically detects video capture devices. By default, the control uses the first found device. At run time, the Camera Settings panel allows an end-user to select the device from which to capture the video stream. In code, for this purpose, use the CameraControl.Device property. To get the list of available devices, call the CameraControl.GetDevices static method.

The Camera Control allows you to operate the selected device — start or stop the video stream display, and take snapshots. To begin to capture and display a video, call the CameraControl.Start method. This method's overloads allow you to start capturing video from the currently selected device, or specify a particular device. However, when the control is displayed onscreen for the first time, it automatically starts to display the video stream captured from the default device. To prevent this, set the CameraControl.AutoStartDefaultDevice property to false.

To get the video frame currently displayed by the control, call the CameraControl.TakeSnapshot method. This method returns a bitmap image that uses the 32 bit format to store color data. When you need to terminate capturing the video, call the CameraControl.Stop method.

Also, the Camera Control provides you with the capability to adjust the video qualities on video capture devices. Typically, video capture devices support the brightness, contrast, hue, saturation, gamma, and sharpness properties. The availability of a video quality setting, as well as the extreme and default values, depends on a particular video capture device. At run time, an end-user can invoke the Camera Settings panel to adjust the video properties on available devices. In code, you can get access to the video properties on a currently selected device through the CameraControl.VideoSettings property.


The video property values are held by the device itself. Thus, changing property values using the Camera Control may affect the quality of videos captured in other applications.

In addition to the Settings button, the Camera Control allows you to display custom context buttons and provide your end-users with custom functionality. The CameraControl.ContextButtons property provides access to the collection of context buttons displayed in the Camera Control. By default, the context buttons are hidden from view and seamlessly appear when the control is hovered over with the mouse pointer. However, the CameraControl.ContextButtonOptions property provides you with the capability to adjust the appearance and behavior of the context buttons. To respond to a context button click, handle the CameraControl.ContextButtonClick event. To learn more about context buttons, see the ContextItem base class.

Expanded Take Picture Dialog

The Camera Control is embedded in the Take Picture dialog (the DevExpress.XtraEditors.Camera.TakePictureDialog object) that can be used in your application to take a picture from an end-user's webcam and get the resulting image. To show this dialog, call the TakePictureDialog.ShowDialog method. When this dialog is invoked, it automatically shows the video stream from the default webcam. An end-user can take a snapshot, and save it or take another. See the figure below.

When an end-user clicks the Save or Cancel button, the dialog closes and the TakePictureDialog.ShowDialog method returns the corresponding dialog result. If the Save button was clicked, the TakePictureDialog.Image property contains the taken snapshot. The code snippet below shows how to show the dialog and save the snapshot to a file.

Is this topic helpful?​​​​​​​