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

推荐订阅源

小众软件
小众软件
N
News and Events Feed by Topic
A
About on SuperTechFans
aimingoo的专栏
aimingoo的专栏
The Cloudflare Blog
H
Heimdal Security Blog
Schneier on Security
Schneier on Security
Engineering at Meta
Engineering at Meta
Google Online Security Blog
Google Online Security Blog
宝玉的分享
宝玉的分享
AI
AI
The GitHub Blog
The GitHub Blog
MongoDB | Blog
MongoDB | Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
The Last Watchdog
The Last Watchdog
T
Troy Hunt's Blog
S
Security @ Cisco Blogs
H
Hacker News: Front Page
F
Fortinet All Blogs
博客园_首页
S
Secure Thoughts
N
News and Events Feed by Topic
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
Spread Privacy
Spread Privacy
Hacker News - Newest:
Hacker News - Newest: "LLM"
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Hugging Face - Blog
Hugging Face - Blog
Hacker News: Ask HN
Hacker News: Ask HN
C
CXSECURITY Database RSS Feed - CXSecurity.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Stack Overflow Blog
Stack Overflow Blog
L
LINUX DO - 最新话题
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Schneier on Security
Know Your Adversary
Know Your Adversary
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Scott Helme
Scott Helme
P
Privacy & Cybersecurity Law Blog
S
Securelist
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
O
OpenAI News
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
PCI Perspectives
PCI Perspectives
L
LangChain Blog
雷峰网
雷峰网
Security Archives - TechRepublic
Security Archives - TechRepublic
V2EX - 技术
V2EX - 技术

博客园 - 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() );
            }