Full Screen Video Display This programming example illustrates how to display a full screen live video.
Language: | .NET C#/Visual Basic
Version: | 3.3
Author: | IC Imaging Control Support Department
Requirements: |
Software: | IC Imaging Control 3.3, Visual Studio™ 2010
Hardware: | Camera, converter or grabber with WDM Stream Class drivers.
Download C# sample | Full Screen Video - C#

Please note that only the display of the image data stream is resized. The image data stream itself remains unchanged.

The program starts by opening the built-in dialog that the end-user can use to select a video capture device (.ShowDeviceSettingsDialog). At the end of the function Form1_Load(), the live image data stream from the video capture device is displayed, using .LiveStart.

Before resizing the live video display, IC Imaging Control has to be told not to use the default size of the image data stream (by default, the video format's resolution). This is done by setting .LiveDisplayDefault to false.

In the next step, the form must be displayed in its maximized state: WindowState = FormWindowState.Maximized; and with no border: FormBorderStyle = FormBorderStyle.None. Then, the docking behavior of IC Imaging control is set to fill: icImagingControl1.Dock = DockStyle.Fill;.

    C#

    private void Form1_Load(object sender, System.EventArgs e)
    {
        icImagingControl1.ShowDeviceSettingsDialog();

        if( !icImagingControl1.DeviceValid )
        {
            Close();
            return;
        }

        WindowState = FormWindowState.Maximized;
        FormBorderStyle = FormBorderStyle.None;
        icImagingControl1.Dock = DockStyle.Fill;

        icImagingControl1.LiveStart();
    }

The code in the Form1_Load() function causes IC Imaging Control to fill the entire area of the form, which now covers the complete screen. It also raises a Resize event after IC Imaging Control has been resized. The size of the live video display is set in the Resize event handler of IC Imaging Control.

    C#

    private void icImagingControl1_Resize(object sender, System.EventArgs e)
    {
        icImagingControl1.LiveDisplayDefault = false;
        icImagingControl1.LiveDisplayWidth = icImagingControl1.Width;
        icImagingControl1.LiveDisplayHeight = icImagingControl1.Height;
    }

This sample program is terminated by clicking anywhere on the live video stream. In which case, an ICImagingControl1_MouseUp is fired. Please note that Close may not be used in the context of this event handler. Thus, the Close event has been delegated to the application's form CloseDelegate, which closes the application correctly.

    C#

    private void icImagingControl1_MouseUp(object sender, MouseEventArgs e)
    {
        BeginInvoke(new CloseDelegate(Close));
    }