本文整理汇总了C#中DeviceInfo.Connect方法的典型用法代码示例。如果您正苦于以下问题:C# DeviceInfo.Connect方法的具体用法?C# DeviceInfo.Connect怎么用?C# DeviceInfo.Connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceInfo
的用法示例。
在下文中一共展示了DeviceInfo.Connect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Scan
public Image Scan(DeviceInfo device)
{
if (device == null)
throw new ArgumentException("Device must be specified");
var scanner = device.Connect();
var wiaCommonDialog = new WPFCommonDialog();
var item = scanner.Items[1];
var image = (ImageFile)wiaCommonDialog.ShowTransfer(item, wiaFormatBMP, false);
string fileName = Path.GetTempFileName();
File.Delete(fileName);
image.SaveFile(fileName);
image = null;
// add file to output list
return Image.FromFile(fileName);
}
示例2: Scan
public Image Scan(DeviceInfo device, PageSize pageSize, ColorDepth colorDepth, Resolution resolution, Orientation orientation, bool setSize = true)
{
if (device == null)
throw new ArgumentException("Device must be specified");
var scanner = device.Connect();
var wiaCommonDialog = new WPFCommonDialog();
var item = scanner.Items[1];
SetupPageSize(item, pageSize, colorDepth, resolution, orientation, setSize);
var image = (ImageFile)wiaCommonDialog.ShowTransfer(item, wiaFormatBMP, false);
string fileName = Path.GetTempFileName();
File.Delete(fileName);
image.SaveFile(fileName);
image = null;
// add file to output list
return Image.FromFile(fileName);
}
示例3: InitScanner
/// <summary>
/// Connects to a specific scanner and initializes parameters
/// </summary>
/// <param name="_myDeviceInfo">selected scanner</param>
private void InitScanner(DeviceInfo _myDeviceInfo)
{
object np = "Name";
ScannerName = (string)_myDeviceInfo.Properties.get_Item(ref np).get_Value();
objScannerPowerManager.InitScannerPowerManager(ScannerName);
Enable();
Scanner = _myDeviceInfo.Connect();
wiaItem = Scanner.Items[1];
SelectPicsProperties(ScanningDPI);
}
示例4: Scanner
public Scanner()
{
_deviceId = GetDefaultDeviceID();
_deviceInfo = FindDevice(_deviceId);
_device = _deviceInfo.Connect();
}