Leadtools.Twain Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.8.31
Capability Property
See Also  Example
Leadtools.Twain Namespace > TwainTemplateEventArgs Class : Capability Property




Gets the TwainCapability currently being processed by the event.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property Capability As TwainCapability
Visual Basic (Usage)Copy Code
Dim instance As TwainTemplateEventArgs
Dim value As TwainCapability
 
value = instance.Capability
C# 
public TwainCapability Capability {get;}
Managed Extensions for C++ 
public: __property TwainCapability* get_Capability();
C++/CLI 
public:
property TwainCapability^ Capability {
   TwainCapability^ get();
}

Return Value

The TwainCapability currently being processed by the event.

Example

Visual BasicCopy Code
Public Sub twnSession_SaveTemplate(ByVal sender As Object, ByVal e As TwainTemplateEventArgs)
   Dim twCap As TwainCapability = e.Capability
   If twCap.Information.ContainerType = TwainContainerType.OneValue Then
      If CType(twCap.OneValueCapability.Value, TwainCapabilityValue) = TwainCapabilityValue.TransferMechanismFile Then
         MessageBox.Show("File transfer avaialble and its container is OneValue")
      End If
   End If
End Sub

Public Sub CapabilityPropertyExample(ByVal parent As IWin32Window)
   Dim session As TwainSession = New TwainSession()
   session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None)

   AddHandler session.SaveTemplate, AddressOf twnSession_SaveTemplate
   session.SaveTemplateFile("c:\test.ltt")

   session.Shutdown()
End Sub
C#Copy Code
public void twnSession_SaveTemplate(object sender, TwainTemplateEventArgs e) 

   TwainCapability twCap = e.Capability; 
   if (twCap.Information.ContainerType == TwainContainerType.OneValue) 
   { 
      if (twCap.OneValueCapability.Value == (object)TwainCapabilityValue.TransferMechanismFile) 
      { 
         MessageBox.Show("File transfer avaialble and its container is OneValue"); 
      } 
   } 

 
public void CapabilityPropertyExample(IWin32Window parent) 

   TwainSession session = new TwainSession(); 
   session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None); 
 
   session.SaveTemplate += new EventHandler<TwainTemplateEventArgs>(twnSession_SaveTemplate); 
   session.SaveTemplateFile(@"c:\test.ltt"); 
 
   session.Shutdown(); 
}

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also