惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Cisco Talos Blog
Cisco Talos Blog
P
Privacy & Cybersecurity Law Blog
I
Intezer
Y
Y Combinator Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
N
Netflix TechBlog - Medium
The Hacker News
The Hacker News
AWS News Blog
AWS News Blog
aimingoo的专栏
aimingoo的专栏
A
About on SuperTechFans
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Stack Overflow Blog
Stack Overflow Blog
Hacker News: Ask HN
Hacker News: Ask HN
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog
T
Tor Project blog
C
Cybersecurity and Infrastructure Security Agency CISA
云风的 BLOG
云风的 BLOG
博客园_首页
V2EX - 技术
V2EX - 技术
T
Threat Research - Cisco Blogs
腾讯CDC
宝玉的分享
宝玉的分享
博客园 - 叶小钗
罗磊的独立博客
S
Securelist
The Last Watchdog
The Last Watchdog
Google Online Security Blog
Google Online Security Blog
Scott Helme
Scott Helme
博客园 - 司徒正美
W
WeLiveSecurity
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Secure Thoughts
NISL@THU
NISL@THU
N
News and Events Feed by Topic
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
雷峰网
雷峰网
大猫的无限游戏
大猫的无限游戏
K
Kaspersky official blog
IT之家
IT之家

博客园 - Magicam

jquery easyui 扩展验证 vs2010 安装 Ajax Control Toolkit Backing up the tail mysql 1449 : The user specified as a definer ('root'@'%') does not exist 解决方法 WInform CMD command Mysql中的数据导入SQLServer2000 VS2010安装SP1后无法安装VS2010 SDK Vs2008调试Silverlight时,出现“未安装silverlight托管调试包” js 取时间代码 Sys.ArgumentOutOfRangeException: Value must be an integer 错误的原因 iframe - Magicam js实现: e.keycode详解 jquery 无法设置selected属性,未指明的错误 Mysql存储过程游标循环操作 JQuery ListBox间移动和ListBox内上下移动 Tif文件转换成GIF列表 - Magicam - 博客园 Visual Studio 2010 安装“deffactory.dat can not open” 的解决办法 - Magicam js 实现2列 div 自适应高度 - Magicam NetTiers模板属性说明 NHibernate配置引发的异常 - Magicam - 博客园
wia Kodak 扫描仪应用 winform - Magicam
Magicam · 2011-01-18 · via 博客园 - Magicam

wia

代码

        private ImageFile imageFile = null;
        
private string ScanTemp = ConfigurationSettings.AppSettings["ScanTemp"].ToString().Trim();
        
private string imgType = "jpg";
        
private DeviceManager manager = null;
        
private Device device = null;
        
private List<System.Drawing.Image> imgs = new List<System.Drawing.Image>();private List<System.Drawing.Image> StartScan()
        {
            manager 
= new DeviceManagerClass();
           
            
foreach( DeviceInfo info in manager.DeviceInfos )
            {
                
if( info.Type != WiaDeviceType.ScannerDeviceType ) continue;
                device 
= info.Connect();
                
break;
            }
if( device == null )
            {
                
throw new Exception("扫描仪没连接!");
            }

            Item item 

= device.Items[1];
            CommonDialogClass cdc 
= new WIA.CommonDialogClass();
            
//string formatID = this.GetWiaFormat();
            try
            {
                imageFile 
= cdc.ShowAcquireImage( WiaDeviceType.ScannerDeviceType, WiaImageIntent.UnspecifiedIntent,
                                                 WiaImageBias.MinimizeSize, 
"{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}"truefalsefalse );
                
            }
            
catch( System.Runtime.InteropServices.COMException ex)
            {
                imageFile 
= null;
                
//throw new Exception( ex.Message );
            }while( imageFile != null )
            {
                var buffer 
= imageFile.FileData.get_BinaryData() as byte[];
                
using( MemoryStream ms = new MemoryStream() )
                {
                    ms.Write( buffer, 
0, buffer.Length );
                    imgs.Add( System.Drawing.Image.FromStream( ms ) );
                }
                imageFile 
= null;try
                {
                    imageFile 
= cdc.ShowTransfer( item, "{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}"false ) as ImageFile;
                }
                
catch( Exception ex )
                {
                    
return imgs;
                    
//throw new Exception( ex.Message );                    
                }          
            }
            
return imgs;
        }

Kodak

代码

            try
            {
                
int k = axImgScan1.ShowSelectScanner();//选择扫描仪
                int ll_rtn = axImgScan1.OpenScanner(); //打开扫描仪 
                if( ll_rtn == 0 )
                {
                    
if( axImgScan1.ScannerAvailable() == true )//判断扫描仪是否可用 
                    {
                        
//axImgScan1.PageOption = PageOptionConstants.AppendPages;
                        
//axImgScan1.PageType = PageTypeConstants.BlackAndWhite;
                        
//axImgScan1.PageCount = 0;
                        axImgScan1.MultiPage = true;//是否多页 
                        
//axImgScan1.PageCount = axImgScan1.PageCount + 1;
                        string pathGen = ScanTemp + ScanPageName();// @"c:\abc.tif";                        
                        axImgScan1.Image = pathGen;
                        axImgScan1.FileType 
= FileTypeConstants.TIFF;//设置文件类型 
                        
//axImgScan1.GetPageTypeCompressionInfo( ImageTypeConstants.BlackAndWhite1Bit );
                        
//axImgScan1.GetPageTypeCompressionType( ImageTypeConstants.BlackAndWhite1Bit ); // axImgScan1.CompressionType = CompressionTypeConstants.JPEG;
                        axImgScan1.ScanTo = ScanToConstants.FileOnly;//.DisplayAndUseFileTemplate;
                        
//axImgScan1.ShowSetupBeforeScan = false;//是否在扫描前显示设置界面
                        axImgScan1.SetPageTypeCompressionOpts( CompPreferenceConstants.CustomSettings, ImageTypeConstants.TrueColor24bitRGB, CompTypeConstants.Uncompressed, CompInfoConstants.NoCompInfo );
                        axImgScan1.StopScanBox 
= false;
                        axImgScan1.Show();
                        
//axImgScan1.GetCompressionPreference() = CompPreferenceConstants.SmallestFile;

                        ll_rtn 
= axImgScan1.StartScan();//开始扫描

                        
if( ll_rtn == 0 )
                        {
                            Byte[] filebyte 
= GetScanFileByte( axImgScan1.Image );
                            axImgScan1.CloseScanner(); 
//关闭扫描仪                            
                            
//axImgEdit1.Image = axImgScan1.Image;
                            
//axImgEdit1.SaveAs( axImgScan1.Image, FileTypeConstants.TIFF, PageTypeConstants.BlackAndWhite, CompressionTypeConstants.NoCompression, CompInfoConstants.NoCompInfo, true );
                        }
                        
else
                        {
                            MessageBox.Show( 
"扫描仪没有正确连接或扫描控件已破坏,请检查!""系统提示" );
                        }
                        axImgScan1.CloseScanner(); 
//关闭扫描仪
                    }
                    
else
                    {
                        MessageBox.Show( 
"扫描仪没有正确连接,请重新设置!""系统提示" );
                    }
                }
                
else if( ll_rtn == 9219 )
                {
                    MessageBox.Show( 
"系统没有安装扫描仪或扫描仪没有正确连接!""系统提示" );
                }
            }
            
catch( Exception ex )
            {
                MessageBox.Show( ex.Message );
            }

IMGADMIN.OCX

代码

          //选择图片显示 axImgAdmin1用法
            axImgAdmin1.Image = "";
            axImgAdmin1.DialogTitle 
= "选择一张图片";
            axImgAdmin1.Filter 
= "All Image Files |*.bmp; *.jpg; *.tif|Bitmap Files(*.bmp)|*. bmp|JPG Files (*.jpg)|*.jpg|TIFF Files (*.tif)|*.tif|All Files (*.*)|*.*|";

            axImgAdmin1.FilterIndex 

= 4;   //选择默认文件类型,对应Filter
            axImgAdmin1.InitDir = "c:\\";  //选择的默认路径
              axImgAdmin1.CancelError = false;
            axImgAdmin1.ShowFileDialog( AdminLibCtl.DlgOptionValue.OpenDlg );
            
if( axImgAdmin1.Image == "" )
            {

            }

else
            {
                axImgEdit1.Image 
= axImgAdmin1.Image;
                axImgThumbnail1.Image 
= axImgAdmin1.Image;
                axImgEdit1.Display();
                
//MessageBox.Show( axImgEdit1.PageCount.ToString() );
            }