彩票走势图

ImageGear Professional 使用教程:如何在VB环境使用ImageGear ActiveX控件(下)

原创|使用教程|编辑:龚雪|2016-03-24 10:46:57.000|阅读 309 次

概述:本次教程将向您介绍如何在 Visual Basic 开发环境下运行及使用ImageGear ActiveX控件。

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

相关链接:

最新版ImageGear Professional下载

详细步骤:

  • 为Form_Load 与 Form_Resize添加以下Form声明和子程序:
Private currentPage As IGPage
Private currentPageDisp As IGPageDisplay
Private currentFileDialog As IGFileDlg
Private Sub Form_Load()
    On Error GoTo ErrorHandler
    IGCoreCtl1.License.SetSolutionName "Accusoft"
    IGCoreCtl1.Result.NotificationFlags = IG_ERR_OLE_ERROR
    IGCoreCtl1.AssociateComponent
IGFormatsCtl1.ComponentInterface
    IGCoreCtl1.AssociateComponent
IGDisplayCtl1.ComponentInterface
    IGDlgsCtl1.GearFormats =
IGFormatsCtl1.ComponentInterface
    IGDlgsCtl1.GearCore = IGCoreCtl1.ComponentInterface
    IGDlgsCtl1.GearDisplay =
IGDisplayCtl1.ComponentInterface
Set currentFileDialog = IGDlgsCtl1.CreateFileDlg
    Set currentPage = IGCoreCtl1.CreatePage
    Set currentPageDisp =
IGDisplayCtl1.CreatePageDisplay(currentPage)
    IGPageViewCtl1.PageDisplay = currentPageDisp
IGPageViewCtl1.UpdateView
    Exit Sub
ErrorHandler:
    MsgBox "Errors on stack? " & IGCoreCtl1.Result.isOk &
vbCrLf & Err.Description, vbCritical, "An error has
occurred"
End Sub
Private Sub Form_Resize()
    If Me.Height > 0 Then
        IGPageViewCtl1.Height = Me.ScaleHeight
    End If
    If Me.Width > 0 Then
        IGPageViewCtl1.Width = Me.ScaleWidth
    End If
End Sub
  • 通过下列代码或单击表单上的菜单为mnuOpen创建一个click程序:
Private Sub mnuOpen_Click()
    On Error GoTo ErrorHandler
    Dim loadDialogOptions As IGFileDlgPageLoadOptions
    Set loadDialogOptions = _

IGDlgsCtl1.CreateFileDlgOptions(IG_FILEDLGOPTIONS_PAGELOADOB
J)
    If currentFileDialog.Show(loadDialogOptions) Then
        IGFormatsCtl1.LoadPageFromFile currentPage,
loadDialogOptions.FileName, _
                loadDialogOptions.PageNum
    End If
    IGPageViewCtl1.UpdateView
    Exit Sub
ErrorHandler:
    MsgBox "Errors on stack? " & IGCoreCtl1.Result.isOk &
vbCrLf & Err.Description, vbCritical, "An error has
occurred"
End Sub
  • 通过下列代码或者分别双击每个控件为mnuZoomin和mnuZoomout指令添加click程序:
Private Sub mnuZoomIn_Click()
    On Error GoTo ErrorHandler
    Dim zoomzoom As IGDisplayZoomInfo
    Set zoomzoom =
currentPageDisp.GetZoomInfo(IGPageViewCtl1.hWnd)
    zoomzoom.HZoom = zoomzoom.HZoom * 1.25
    zoomzoom.VZoom = zoomzoom.VZoom * 1.25
    zoomzoom.Mode = IG_DSPL_ZOOM_H_FIXED Or
IG_DSPL_ZOOM_V_FIXED
    currentPageDisp.UpdateZoomFrom zoomzoom
    IGPageViewCtl1.UpdateView
    Exit Sub
ErrorHandler:
    MsgBox "Errors on stack? " & IGCoreCtl1.Result.isOk &
vbCrLf & Err.Description, vbCritical, "An error has
occurred"
End Sub
  • 编译并运行您的项目后,您将得到如下图所示的支持上百种文件格式的图像浏览器:
image viewer

本教程译自


标签:文档图像

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn


为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP