ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

How to preview multiple page or .tiff image using ms visual Basic 2010?

user-image
تم إضافة السؤال من قبل Mohammed Taha , IT Manager - Chairman Office , egypt air
تاريخ النشر: 2014/11/26
Mohamed Kaleel
من قبل Mohamed Kaleel , IT Manager , Chemanol

Try This ,

 

Preview using PictureBox 

 

Imports System.IO

Imports System.Drawing.Imaging

 

Public Class Form1

 

    Dim fs As FileStream

    Dim srcBmp As Bitmap

    Dim totalPages As Integer

    Dim currentPage As Integer =0

 

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        fs = File.Open("C:\\Temp\\in.tif", FileMode.Open, FileAccess.Read)

        srcBmp = CType(Bitmap.FromStream(fs), Bitmap)

        totalPages = CInt(srcBmp.GetFrameCount(FrameDimension.Page) -1)

        srcBmp.SelectActiveFrame(FrameDimension.Page, currentPage)

        uxPicture.Image = srcBmp

    End Sub

 

    Private Sub uxPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles uxPrevious.Click

        If currentPage >0 Then

            currentPage -=1

            srcBmp.SelectActiveFrame(FrameDimension.Page, currentPage)

            uxPicture.Refresh()

        End If

    End Sub

 

    Private Sub uxNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles uxNext.Click

        If currentPage < totalPages Then

            currentPage +=1

            srcBmp.SelectActiveFrame(FrameDimension.Page, currentPage)

            uxPicture.Refresh()

        End If

    End Sub

 

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

        fs.Close()

    End Sub

End Class

المزيد من الأسئلة المماثلة