我可以从C#更改分辨率dpi吗 [英] can i chang resolution dpi from c#
本文介绍了我可以从C#更改分辨率dpi吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在dpi扫描仪选项中加载int数据库字段,如何从c#中访问它
http://imageshack.us/photo/my-images/811/62695829.png/ [ ^ ]
i want to load int database field in dpi scanner option how to access it from c#
http://imageshack.us/photo/my-images/811/62695829.png/[^]
推荐答案
您想将扫描仪使用的DPI存储在数据库中吗?它只是一个整数,存储起来很容易.设置它是困难的. C#中没有TWAIN支持,而WIA支持有限,因此,这取决于您的扫描代码是否可以访问DPI设置.
我使用Google找到了此代码.你应该试试看.
You want to store the DPI used by your scanner in your db ? It''s just an int, storing it is easy. Setting it is the hard bit. There''s no TWAIN support in C#, and limited WIA support, so, it depends on if your scanning code has access to DPI settings.
I found this code using google. You should try it.
private void setItem(IItem item, object property, object value)
{
WIA.Property aProperty = item.Properties.get_Item(ref property);
aProperty.set_Value(ref value);
}
internal bool Scan(bool flatBed)
{
WIA.DeviceManager manager = new DeviceManager();
bool result = false;
object something = 1;
object somethingElse;
WIA.Device scanner = manager.DeviceInfos.get_Item(ref something).Connect();
IItem item = scanner.Items[1];
setItem(item, "6146", 4);
setItem(item, "6147", 200);
setItem(item, "6148", 200);
setItem(item, "6151", 200 * 8.5);
setItem(item, "6152", 200 * 11);
}
第一个setItem是颜色[4个黑白,2个灰度,1个颜色,0个未指定]
第二个是水平分辨率.
第三是纵向分辨率.
第四个是水平扫描区域.
第五个是垂直扫描区域.
The first setItem is the color [4 black and white, 2 grayscale, 1 color, 0 unspecified]
The second is horizontal resolution.
The third is veritcal resolution.
The fourth is horizontal scanning area.
The fifth is vertical scanning area.
这篇关于我可以从C#更改分辨率dpi吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文