公共TwainDeviceEventGetDeviceEventData ()
公共函数GetDeviceEventData ()作为TwainDeviceEvent
公共:
TwainDeviceEvent ^GetDeviceEventData ();
代表设备事件信息的TwainDeviceEvent对象
此方法将返回特定设备事件的信息。要获取每个设备事件的状态,请将EnableGetDeviceEvent属性设置为TRUE以启用触发GetDeviceEvent事件要获取CAP_DEVICEEVENT能力值,请调用GetDeviceEventCapability方法,要设置CAP_DEVICEEVENT能力,请调用SetDeviceEventCapability方法,也可以调用ResetDeviceEventCapability方法来重置CAP_DEVICEEVENT能力
该方法应该在GetDeviceEvent事件中调用,以获取设备事件信息。
使用Leadtools;
使用Leadtools.Twain;
TwainSession session =新TwainSession ();
公共无效GetDeviceEventDataExample (IntPtr父)
{
试一试
{
会话。启动(父,“制造商”,“productFamily”,“版本”,“应用程序”, TwainStartupFlags.None);
会话。GetDeviceEvent + =新EventHandler < EventArgs > (session_GetDeviceEvent);
会话。EnableGetDeviceEvent =真正的;
session.Acquire (TwainUserInterfaceFlags.Show);
session.Shutdown ();
}
抓
{}
}
无效session_GetDeviceEvent (对象发送者,EventArgs
{
试一试
{
TwainDeviceEvent deviceEvent = session.GetDeviceEventData();
字符串味精=字符串.Format ("事件={0}\nEvent Name ={1}\n", deviceEvent。事件,deviceEvent。DeviceName);
MessageBox.Show(味精);
如果(deviceEvent。事件== TwainCapabilityValue。DeviceEventCheckBattery)
{
味精=字符串.Format (“电池时间={0}\n电池百分比={1}\n”, deviceEvent。BatteryMinutes deviceEvent.BatteryPercentage);
MessageBox.Show(味精);
}
其他的如果(deviceEvent。事件== TwainCapabilityValue。DeviceEventCheckPowerSupply)
{
味精=字符串.Format (“电源={0}\n”, deviceEvent.PowerSupply);
MessageBox.Show(味精);
}
其他的如果(deviceEvent。事件== TwainCapabilityValue。DeviceEventCheckPowerSupply)
{
味精=字符串.Format ("XResolution ={0}\nYResolution ={1}\n", deviceEvent。XResolution deviceEvent.YResolution);
MessageBox.Show(味精);
}
其他的如果(deviceEvent。事件== TwainCapabilityValue。DeviceEventCheckFlash)
{
味精=字符串.Format (“FlashUsed2 = {0} \ n”, deviceEvent.FlashUsed2);
MessageBox.Show(味精);
}
其他的如果(deviceEvent。事件== TwainCapabilityValue。DeviceEventCheckAutomaticCapture)
{
味精=字符串.Format (“自动捕获={0}\nTime第一次捕获之前={1}\nTime捕获之间={2}\n”, deviceEvent。AutomaticCapture deviceEvent。TimeBeforeFirstCapture deviceEvent.TimeBetweenCaptures);
MessageBox.Show(味精);
}
}
抓
{}
}
进口Leadtools
进口Leadtools。吐温
公共感到失望会话作为TwainSession =新TwainSession ()
私人子session_GetDeviceEvent (按值传递发送方作为对象,按值传递e作为System.EventArgs)处理会话。GetDeviceEvent
试一试
昏暗的deviceEvent作为TwainDeviceEvent = session.GetDeviceEventData()
昏暗的味精作为字符串=字符串.Format ("事件={0}{1}事件名称={2}", deviceEvent。事件, Chr(13), deviceEvent.DeviceName)
MessageBox.Show(味精)
如果deviceEvent。事件= TwainCapabilityValue。DeviceEventCheckBattery然后
味精=字符串.Format (“电池时间={0}{1}电池百分比={2}”, deviceEvent。电池分钟,Chr(13), deviceEvent.BatteryPercentage)
MessageBox.Show(味精)
ElseIfdeviceEvent。事件= TwainCapabilityValue。DeviceEventCheckPowerSupply然后
味精=字符串.Format (“电源={0}”deviceEvent.PowerSupply)
MessageBox.Show(味精)
ElseIfdeviceEvent。事件= TwainCapabilityValue。DeviceEventCheckPowerSupply然后
味精=字符串.Format ("XResolution ={0}{1}YResolution ={2}", deviceEvent。XResolution, Chr(13), deviceEvent.YResolution)
MessageBox.Show(味精)
ElseIfdeviceEvent。事件= TwainCapabilityValue。DeviceEventCheckFlash然后
味精=字符串.Format (“FlashUsed2 ={0}”deviceEvent.FlashUsed2)
MessageBox.Show(味精)
ElseIfdeviceEvent。事件= TwainCapabilityValue。DeviceEventCheckAutomaticCapture然后
味精=字符串.Format (“自动捕获={0}{1}第一次捕获前时间={2}{3}捕获间隔时间={4}”, deviceEvent。自动捕获,Chr(13), deviceEvent。TimeBeforeFirstCapture, Chr(13), deviceEvent.TimeBetweenCaptures)
MessageBox.Show(味精)
结束如果
抓
结束试一试
结束子
公共子GetDeviceEventDataExample (按值传递父作为IntPtr)
试一试
会话。启动(父,“制造商”,“productFamily”,“版本”,“应用程序”TwainStartupFlags.None)
AddHandler会话。GetDeviceEvent,AddressOfsession_GetDeviceEvent
会话。EnableGetDeviceEvent =真正的
session.Acquire (TwainUserInterfaceFlags.Show)
session.Shutdown ()
抓
结束试一试
结束子
帮助收藏
光栅net|C API|c++类库|HTML5 JavaScript
文档net|C API|c++类库|HTML5 JavaScript
医疗net|C API|c++类库|HTML5 JavaScript
医疗网络查看器net
188宝金博怎么下载
支持的平台上
.NET、Java、Android和iOS/macOS程序集
C API/ c++类库
HTML5 JavaScript库
您的邮件已发送给技术支持!应该有人联系!如果你的事情很紧急,请回来聊天。
聊天时间:
周一至周五,美国东部时间上午8:30至下午6:00
感谢您的反馈!
请再次填写表格,开始新的聊天。
所有代理目前都离线。
聊天时间:
星期一至星期五
美国东部时间上午8:30 -下午6点
如需与我们联系,请填写此表格,我们将通过电子邮件与您联系。