LEADTOOLS Multimedia (Leadtools.Multimedia assembly) Send comments on this topic. | Back to Introduction | Help Version 17.0.3.22
SetVideoWindowPos Method
See Also 
Leadtools.Multimedia Namespace > CaptureCtrl Class : SetVideoWindowPos Method



left
X-coordinate of the origin of the video window in pixels with respect to the screen.
top
Y-coordinate of the origin of the video window in pixels with respect to the screen.
width
Video window width in pixels
height
Video window height in pixels
left
X-coordinate of the origin of the video window in pixels with respect to the screen.
top
Y-coordinate of the origin of the video window in pixels with respect to the screen.
width
Video window width in pixels
height
Video window height in pixels
Sets the position and size of the video window.

Syntax

Visual Basic (Declaration) 
Public Overridable Sub SetVideoWindowPos( _
   ByVal left As Single, _
   ByVal top As Single, _
   ByVal width As Single, _
   ByVal height As Single _
) 
Visual Basic (Usage)Copy Code
Dim instance As CaptureCtrl
Dim left As Single
Dim top As Single
Dim width As Single
Dim height As Single
 
instance.SetVideoWindowPos(left, top, width, height)
C# 
public virtual void SetVideoWindowPos( 
   float left,
   float top,
   float width,
   float height
)
C++/CLI 
public:
virtual void SetVideoWindowPos( 
   float left,
   float top,
   float width,
   float height
) 

Parameters

left
X-coordinate of the origin of the video window in pixels with respect to the screen.
top
Y-coordinate of the origin of the video window in pixels with respect to the screen.
width
Video window width in pixels
height
Video window height in pixels

Example

Visual BasicCopy Code
Public _result As Boolean = False
      Public _form As CaptureCtrlForm = New CaptureCtrlForm()
      Public _capturectrl As CaptureCtrl
      Public Sub SetVideoWindowPosExample()
         ' reference the capture control
         _capturectrl = _form.CaptureCtrl

         ' output file
         Dim outFile As String = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_SetVideoWindowPosExample.avi")

         Try
            ' select a video capture device
            If _capturectrl.VideoDevices("USB") Is Nothing Then
               Throw New Exception("No USB video device available")
            End If

            _capturectrl.VideoDevices("USB").Selected = True

            ' set a video compressor for the capture file
            _capturectrl.VideoCompressors.Mpeg4.Selected = True

            ' set the preview on
            _capturectrl.Preview = True

            ' set start event handler
            AddHandler _capturectrl.Started, AddressOf CaptureCtrl_Started

            ' set the video window position
            _capturectrl.SetVideoWindowPos(10, 10, 50, 50)

            ' set the target output
            _capturectrl.TargetFile = outFile

            ' start the capture
            _capturectrl.StartCapture(CaptureMode.Video)
         Catch e1 As Exception
            _result = False
         End Try
      End Sub

      Private Sub CaptureCtrl_Started(ByVal sender As Object, ByVal e As EventArgs)
         ' check the current position and set the result to what we expect
         _result = (_capturectrl.VideoWindowTop = 10 AndAlso _capturectrl.VideoWindowLeft = 10 AndAlso _capturectrl.VideoWindowWidth = 50 AndAlso _capturectrl.VideoWindowWidth = 50)

         ' stop the capture
         _capturectrl.StopCapture()
      End Sub

Public NotInheritable Class LEAD_VARS
   Public Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 17\Media"
End Class
C#Copy Code
public bool _result = false;
      public CaptureCtrlForm _form = new CaptureCtrlForm();
      public CaptureCtrl _capturectrl;
      public void SetVideoWindowPosExample()
      {
         // reference the capture control
         _capturectrl = _form.CaptureCtrl;

         // output file
         string outFile = Path.Combine(LEAD_VARS.MediaDir,"CaptureCtrl_SetVideoWindowPosExample.avi");

         try
         {
            // select a video capture device
            if (_capturectrl.VideoDevices["USB"] == null)
               throw new Exception("No USB video device available");

            _capturectrl.VideoDevices["USB"].Selected = true;

            // set a video compressor for the capture file
            _capturectrl.VideoCompressors.Mpeg4.Selected = true;

            // set the preview on
            _capturectrl.Preview = true;

            // set start event handler
            _capturectrl.Started += new EventHandler(CaptureCtrl_Started);

            // set the video window position
            _capturectrl.SetVideoWindowPos(10, 10, 50, 50);

            // set the target output
            _capturectrl.TargetFile = outFile;

            // start the capture
            _capturectrl.StartCapture(CaptureMode.Video);
         }
         catch (Exception)
         {
            _result = false;
         }
      }

      void CaptureCtrl_Started(object sender, EventArgs e)
      {
         // check the current position and set the result to what we expect
         _result = (_capturectrl.VideoWindowTop == 10 && _capturectrl.VideoWindowLeft == 10
                     && _capturectrl.VideoWindowWidth == 50 && _capturectrl.VideoWindowWidth == 50);

         // stop the capture
         _capturectrl.StopCapture();
      }

static class LEAD_VARS
{
   public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 17\Media";
}

Remarks

Sets the position and size of the video window.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also