←Select platform

EnumFormatsEvent Event

Summary
Occurs for each found supported transfer format of the currently selected WIA source after calling the EnumFormats method.

Syntax
C#
C++/CLI
Python
public event EventHandler<WiaEnumFormatsEventArgs> EnumFormatsEvent 
public: 
event EventHandler<WiaEnumFormatsEventArgs^>^ EnumFormatsEvent 
def EnumFormatsEvent(sender,e): # sender: WiaSession e: WiaEnumFormatsEventArgs 
Event Data

The event handler receives an argument of type WiaEnumFormatsEventArgs containing data related to this event. The following WiaEnumFormatsEventArgs properties provide information specific to this event.

PropertyDescription
Format Gets the enumerated format.
FormatsCount Gets the count of the formats being enumerated.
Stop Enables or disables firing the EnumFormatsEvent event.
TransferMode Gets the supported transfer mode for the enumerated format.
Remarks

This event will be called while enumerating the selected WIA source supported transfer formats after calling the EnumFormats method to provide the user with information about each found transfer format and also gives the ability to abort the enumeration process.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Wia; 
 
 
       
public void EnumFormatsExample(IntPtr parent) 
{ 
   if (!WiaSession.IsAvailable(WiaVersion.Version1)) 
   { 
      Console.WriteLine("WIA version 1.0 not installed."); 
      return; 
   } 
 
   WiaSession wiaSession = new WiaSession(); 
   wiaSession.Startup(WiaVersion.Version1); 
 
   DialogResult res = wiaSession.SelectDeviceDlg(parent, WiaDeviceType.Default, WiaSelectSourceFlags.NoDefault); 
   if (res != DialogResult.OK) 
   { 
      Console.WriteLine("Error selecting WIA device."); 
      wiaSession.Shutdown(); 
      return; 
   } 
 
   wiaSession.EnumFormatsEvent += new EventHandler<WiaEnumFormatsEventArgs>(wiaSession_EnumFormatsEvent); 
 
   object rootItem = wiaSession.GetRootItem(null); 
   if (rootItem != null) 
   { 
      wiaSession.EnumFormats(rootItem, WiaEnumFormatsFlags.None); 
   } 
 
   wiaSession.EnumFormatsEvent -= new EventHandler<WiaEnumFormatsEventArgs>(wiaSession_EnumFormatsEvent); 
 
   wiaSession.Shutdown(); 
} 
 
void wiaSession_EnumFormatsEvent(object sender, WiaEnumFormatsEventArgs e) 
{ 
   string strMsg = string.Empty; 
 
   strMsg = string.Format("WIA Formats count = {0}\n", e.FormatsCount); 
   Console.WriteLine(strMsg); 
 
   // print out the received formats into the console window. 
   if (e.FormatsCount > 0) 
   { 
      Guid formatGuid = WiaSession.GetFormatGuid(e.Format); 
      strMsg = string.Format("WIA Format: {0}\nWIA Format Transfer Mode: {1}\nWIA Format Guid: \n\n", e.Format.ToString(), e.TransferMode.ToString(), formatGuid); 
      Console.WriteLine(strMsg); 
   } 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Wia Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.