コード例 #1
0
        private void btnScan_Click(object sender, EventArgs e)
        {
            //TwainOperation to = new TwainOperation(twnSession, txtSaveLocation.Text, format);
            //to.Start();

            Cursor current = this.Cursor;

            this.Cursor = Cursors.WaitCursor;

            RasterImage image = twnSession.AcquireToImage(TwainUserInterfaceFlags.Show | TwainUserInterfaceFlags.Modal);

            using (RasterCodecs codecs = MainForm.GetRasterCodecs())
            {
                codecs.Save(image, txtSaveLocation.Text, format, 0);
            }

            image.Dispose();

            this.Cursor = current;

            this.DialogResult = DialogResult.OK;
            this.Close();
        }