السلام عليكم
اذا كان الماسح الضوئي يدعم التغذية التلقائية بأكثر من ورقة
كيف يمكن ان يتم تعديل الكود التالي حتى تظهر كل صورة ملتقطة من السكانر لوحدها في PictureBox
الصورة الأولى تظهر في PictureBox1
الصورة الثانية تظهر في PictureBox2
الصورة الثالثة تظهر في PictureBox3
الصورة الرابعة تظهر في PictureBox4
مرفق المثال
اذا كان الماسح الضوئي يدعم التغذية التلقائية بأكثر من ورقة
كيف يمكن ان يتم تعديل الكود التالي حتى تظهر كل صورة ملتقطة من السكانر لوحدها في PictureBox
الصورة الأولى تظهر في PictureBox1
الصورة الثانية تظهر في PictureBox2
الصورة الثالثة تظهر في PictureBox3
الصورة الرابعة تظهر في PictureBox4
كود :
Imports Leadtools
Imports Leadtools.Twain
Imports Leadtools.Codecs
Imports Leadtools.WinForms
Public Class Form1
Private WithEvents TwainSession As TwainSession
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
TwainSession.Shutdown()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
RasterCodecs.Startup()
Me.TwainSession = New TwainSession
' هذا الكود أخذته من درس للأخ عبد الله الدورسي
' لذلك تلاحظون ورود اسمه في الكود اللي تحت بالانجليزي
Me.TwainSession.Startup(Me, "Scan Technologies, Inc.", "Abdulla Scanner .NET", "Version 16", "Abdulla Twain test sample", TwainStartupFlags.None)
Me.TwainSession.ShowProgressIndicator(True)
Me.Text = TwainSession.SelectedSourceName
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "error")
End Try
End Sub
Private Sub TwainSession_AcquirePage(ByVal sender As Object, ByVal e As Leadtools.Twain.TwainAcquirePageEventArgs) Handles TwainSession.AcquirePage
Try
' هذا الحدث يجلب الصورة الملتقطة ويظهرها مباشرة في أدة الصور
If Not IsNothing(e.Image) Then
PictureBox1.Image = Image.FromHbitmap(e.Image.ToHBitmap)
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "خطأ", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.TwainSession.Acquire(TwainUserInterfaceFlags.Show)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
' اغلاق البرنامج
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
' تفريغ أداة الصور
PictureBox1.Image = Nothing
End Sub
End Class
مرفق المثال