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




Gets or sets image resolution properties for the current data source.

Syntax

Visual Basic (Declaration) 
Public Property ImageResolution As TwainImageResolutionProperties
Visual Basic (Usage)Copy Code
Dim instance As TwainProperties
Dim value As TwainImageResolutionProperties
 
instance.ImageResolution = value
 
value = instance.ImageResolution
C# 
public TwainImageResolutionProperties ImageResolution {get; set;}
Managed Extensions for C++ 
public: __property TwainImageResolutionProperties get_ImageResolution();
public: __property void set_ImageResolution( 
   TwainImageResolutionProperties value
);
C++/CLI 
public:
property TwainImageResolutionProperties ImageResolution {
   TwainImageResolutionProperties get();
   void set (TwainImageResolutionProperties value);
}

Return Value

TwainImageResolutionProperties structure contains Image effects data class.

Example

Visual BasicCopy Code
Public Sub twainSession_SetProperty(ByVal sender As Object, ByVal e As TwainSetPropertyEventArgs)
   Dim msg As String = String.Format("Capability %d\nStatus = %d", e.Capability, e.Status)
   e.Stop = False
End Sub

Public Sub ImageResolutionPropertyExample(ByVal parent As IWin32Window)
   Try
      Dim twainSession As TwainSession = New TwainSession()
      twainSession.Startup(parent, "LEAD Technologies, Inc.", "LEAD Twain .NET", "Version 14", "LEADTools Twain test sample", TwainStartupFlags.None)

      twainSession.EnableSetPropertyEvent = True
      AddHandler twainSession.SetProperty, AddressOf twainSession_SetProperty

      Dim props As TwainProperties = twainSession.Properties
      Dim imageRes As TwainImageResolutionProperties = props.ImageResolution

      imageRes.UnitOfResolution = TwainImageUnit.Inches
      imageRes.BitsPerPixel = 1
      imageRes.HorizontalResolution = 150
      imageRes.VerticalResolution = 150
      imageRes.XScaling = 1
      imageRes.YScaling = 1
      imageRes.RotationAngle = 90

      imageRes.LeftMargin = 0
      imageRes.RightMargin = 0
      imageRes.TopMargin = 200
      imageRes.BottomMargin = 200

      props.EnableAutoFeed = True
      props.MaximumNumberOfPages = -1

      Dim buffer As String = String.Format("Duplex state = {0}", twainSession.DuplexScanningMode.ToString())
      MessageBox.Show(buffer)

      props.ImageResolution = imageRes
      twainSession.Properties = props
      twainSession.Shutdown()
   Catch ex As Exception
      MessageBox.Show(ex.Message)
   End Try
End Sub
C#Copy Code
void twainSession_SetProperty(object sender, TwainSetPropertyEventArgs e) 

   string msg = string.Format("Capability %d\nStatus = %d", e.Capability, e.Status); 
   e.Stop = false; 

 
public void ImageResolutionPropertyExample(IWin32Window parent) 

   try 
   { 
      TwainSession twainSession = new TwainSession(); 
      twainSession.Startup(parent, "LEAD Technologies, Inc.", "LEAD Twain .NET", "Version 14", "LEADTools Twain test sample", TwainStartupFlags.None); 
 
      twainSession.EnableSetPropertyEvent = true; 
      twainSession.SetProperty += new EventHandler<TwainSetPropertyEventArgs>(twainSession_SetProperty); 
      TwainProperties props = twainSession.Properties; 
      TwainImageResolutionProperties imageRes = props.ImageResolution; 
 
      imageRes.UnitOfResolution = TwainImageUnit.Inches; 
      imageRes.BitsPerPixel = 1; 
      imageRes.HorizontalResolution = 150; 
      imageRes.VerticalResolution = 150; 
      imageRes.XScaling = 1; 
      imageRes.YScaling = 1; 
      imageRes.RotationAngle = 90; 
 
      imageRes.LeftMargin = 0; 
      imageRes.RightMargin = 0; 
      imageRes.TopMargin = 200; 
      imageRes.BottomMargin = 200; 
 
      props.EnableAutoFeed = true; 
      props.MaximumNumberOfPages = -1; 
 
      string buffer = string.Format("Duplex state = {0}", twainSession.DuplexScanningMode.ToString()); 
      MessageBox.Show(buffer); 
 
      props.ImageResolution = imageRes; 
      twainSession.Properties = props; 
      twainSession.Shutdown(); 
   } 
   catch (Exception ex) 
   { 
      MessageBox.Show(ex.Message); 
   } 
}

Remarks

This property should be called after calling the get Properties property After you update this structure, you can update the TWAIN source by calling the set Properties property.

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