Kodak Imgedit.ocx控件显示tif图像

用Kodak Imgedit.ocx控件显示tif图像,可实现翻页显示多页的tif,并根据控件尺寸自动调整图片大小,相关代码如下:

 

Option Explicit Dim iPage As Integer Private Sub Command1_Click() If iPage < ImgEdit1.PageCount Then iPage = iPage + 1 ImgEdit1.Page = iPage '显示下一页 ImgEdit1.Display AjustZoom ImgEdit1.Refresh End If End Sub Private Sub Command2_Click() If iPage > 1 Then iPage = iPage - 1 ImgEdit1.Page = iPage '显示上一页 ImgEdit1.Display AjustZoom ImgEdit1.Refresh End If End Sub Private Sub Command3_Click() ImgEdit1.PrintImage 2, 2 '运行打印包“内存不足”,不知何故!!! End Sub Private Sub Form_Load() ImgEdit1.Image = App.Path & "/1203.tif" 'tif可能有多页图像 iPage = 1 ImgEdit1.Page = iPage '显示第一页 AjustZoom ImgEdit1.Display End Sub Private Sub AjustZoom() Dim zoomX As Double Dim zoomY As Double Dim zoomScale As Double zoomX = (ImgEdit1.Width / Screen.TwipsPerPixelX) / ImgEdit1.ImageWidth zoomY = (ImgEdit1.Height / Screen.TwipsPerPixelY) / ImgEdit1.ImageHeight Debug.Print "ImgEdit1.ImageWidth=" & ImgEdit1.ImageWidth & " ImgEdit1.ImageHeight=" & ImgEdit1.ImageHeight Debug.Print "zoomX=" & zoomX & " zoomY=" & zoomY zoomScale = IIf(zoomX < zoomY, zoomX, zoomY) ImgEdit1.zoom = zoomScale * 100 End Sub

你可能感兴趣的:(Kodak Imgedit.ocx控件显示tif图像)