C#
VB
C++
Gets a System.Drawing.Image object.
public virtual Image GetStillImage(int timeOut)
Public Overridable Function GetStillImage( _ByVal timeOut As Integer _) As Image
public:virtual Image^ GetStillImage(int timeOut)
timeOut
Value containing the maximum time to wait for the image, in milliseconds.
The System.Drawing.Image object
If TimeOut is -1, the method's time-out interval never elapses. If the method fails, an error is raised. For more information, refer to the Error Codes.
using Leadtools;using Leadtools.MediaFoundation;using LeadtoolsMediaFoundationExamples.Fixtures;public PlayCtrlForm _form = new PlayCtrlForm();public PlayCtrl _playctrl = null;public bool _result = false;public string _inFile = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi");public string _outFile = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_GetStillImageExample.jpg");public void GetStillImageExample(){// reference the play control_playctrl = _form.PlayCtrl;try{// set the test timer on our form_form.TestTimer.Interval = 2000; // wait 2 seconds after start_form.TestTimer.Tick += GetStillImage_Helper;// set input media file_playctrl.SourceFile = _inFile;// set the timer on_form.TestTimer.Start();}catch (Exception){_result = false;}// we'll loop on the state and pump messages for this example.// but you should not need to if running from a Windows Forms application.while (_playctrl.State == PlayState.Running)Application.DoEvents();// check for the capture file and set the resultif (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), _outFile)))_result = true;}public void GetStillImage_Helper(object sender, EventArgs e){// get a still imageImage image = _playctrl.GetStillImage(-1);if (image != null)image.Save(_outFile, ImageFormat.Jpeg);// stop the capture_playctrl.Stop();}static class LEAD_VARS{public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media";}
Imports LeadtoolsImports Leadtools.MediaFoundationImports LeadtoolsMediaFoundationExamples.FixturesPublic _form As PlayCtrlForm = New PlayCtrlForm()Public _playctrl As PlayCtrl = NothingPublic _result As Boolean = FalsePublic _inFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_Source.avi")Public _outFile As String = Path.Combine(LEAD_VARS.MediaDir, "PlayCtrl_GetStillImageExample.jpg")Public Sub GetStillImageExample()' reference the play control_playctrl = _form.PlayCtrlTry' set the test timer on our form_form.TestTimer.Interval = 2000 ' wait 2 seconds after startAddHandler _form.TestTimer.Tick, AddressOf GetStillImage_Helper' set input media file_playctrl.SourceFile = _inFile' set the timer on_form.TestTimer.Start()Catch e1 As Exception_result = FalseEnd Try' we'll loop on the state and pump messages for this example.' but you should not need to if running from a Windows Forms application.Do While _playctrl.State = PlayState.RunningApplication.DoEvents()Loop' check for the capture file and set the resultIf File.Exists(Path.Combine(Directory.GetCurrentDirectory(), _outFile)) Then_result = TrueEnd IfEnd SubPublic Sub GetStillImage_Helper(ByVal sender As Object, ByVal e As EventArgs)' get a still imageDim image As Image = _playctrl.GetStillImage(-1)If Not image Is Nothing Thenimage.Save(_outFile, ImageFormat.Jpeg)End If' stop the capture_playctrl.Stop()End SubPublic NotInheritable Class LEAD_VARSPublic Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media"End Class
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
