545 lines
22 KiB
VB.net
545 lines
22 KiB
VB.net
Imports System.ComponentModel
|
||
Imports System.Globalization
|
||
Imports System.Text.RegularExpressions
|
||
Imports DigitalData.Modules.Logging
|
||
Imports GdPicture14
|
||
|
||
Public Class DocumentViewer
|
||
Private Enum ZoomMode
|
||
Zoom50
|
||
Zoom100
|
||
Zoom150
|
||
Zoom200
|
||
ZoomSelectedArea
|
||
ZoomFitToViewer
|
||
ZoomFitWidth
|
||
ZoomFitHeight
|
||
End Enum
|
||
|
||
Private _docPath As String
|
||
Private _currentSearchOccurence As Integer = 0
|
||
Private _toggleGamma As Boolean = True
|
||
Private _licenseKey As String = String.Empty
|
||
Private _licenseManager As New GdPicture14.LicenseManager()
|
||
Private _logConfig As LogConfig
|
||
Private _logger As Logger
|
||
|
||
' List of all created temp files when converting msg files
|
||
Private _TempFiles As New List(Of String)
|
||
|
||
Private Sub DocumentViewer_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||
Dim zoomModes As New Dictionary(Of ZoomMode, String) From {
|
||
{ZoomMode.Zoom50, "50%"},
|
||
{ZoomMode.Zoom100, "100%"},
|
||
{ZoomMode.Zoom150, "150%"},
|
||
{ZoomMode.Zoom200, "200%"},
|
||
{ZoomMode.ZoomSelectedArea, "Zoom to selected area"},
|
||
{ZoomMode.ZoomFitToViewer, "Fit to viewer"},
|
||
{ZoomMode.ZoomFitWidth, "Fit to viewer width"},
|
||
{ZoomMode.ZoomFitHeight, "Fit to viewer height"}
|
||
}
|
||
|
||
For Each item In zoomModes
|
||
cbZoom.Items.Add(item.Value)
|
||
Next
|
||
|
||
_TempFiles.Clear()
|
||
|
||
UpdateMainUi()
|
||
End Sub
|
||
|
||
''' <summary>
|
||
''' Initialize the Viewer
|
||
''' </summary>
|
||
''' <param name="LogConfig">A LogConfig object</param>
|
||
''' <param name="LicenseKey">The GDPicture.NET License Key</param>
|
||
Public Sub Init(LogConfig As LogConfig, LicenseKey As String)
|
||
_logConfig = LogConfig
|
||
_logger = LogConfig.GetLogger()
|
||
|
||
_licenseKey = LicenseKey
|
||
_licenseManager.RegisterKEY(_licenseKey)
|
||
End Sub
|
||
|
||
''' <summary>
|
||
''' Terminate Viewer, freeing up resources and deleting temp files
|
||
''' </summary>
|
||
Public Sub Done()
|
||
DeleteTempFiles()
|
||
Dispose()
|
||
End Sub
|
||
|
||
''' <summary>
|
||
''' Load a file and display it
|
||
''' </summary>
|
||
''' <param name="filepath"></param>
|
||
Public Sub LoadFile(filepath As String)
|
||
If _licenseKey = String.Empty Then
|
||
_logger.Warn("License key was not provided. File {0} not loaded.", filepath)
|
||
Exit Sub
|
||
End If
|
||
|
||
_logger.Info("Resetting Viewer.")
|
||
|
||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||
GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter
|
||
|
||
_logger.Info("Loading File.")
|
||
|
||
DoLoadFile(filepath)
|
||
|
||
_logger.Info("Updating UI.")
|
||
|
||
statusLabel.Text = _docPath
|
||
|
||
UpdateMainUi()
|
||
End Sub
|
||
|
||
Public Sub CloseDocument()
|
||
GdViewer.CloseDocument()
|
||
UpdateMainUi()
|
||
End Sub
|
||
|
||
Public Sub DeleteTempFiles()
|
||
For Each oFile In _TempFiles
|
||
Try
|
||
IO.File.Delete(oFile)
|
||
Catch ex As Exception
|
||
_logger.Warn("Could not delete temp file {0}", oFile)
|
||
End Try
|
||
Next
|
||
_TempFiles.Clear()
|
||
End Sub
|
||
|
||
Private Sub DoLoadFile(FilePath As String)
|
||
Try
|
||
Dim oFileInfo = New IO.FileInfo(FilePath)
|
||
Dim oExtension As String = oFileInfo.Extension
|
||
|
||
Select Case oExtension
|
||
Case ".msg"
|
||
Dim oMsg As New Independentsoft.Msg.Message(FilePath)
|
||
' TODO: Improve Encoding, maybe convert based on encoding
|
||
oMsg.Encoding = System.Text.Encoding.UTF32
|
||
Dim oMime = oMsg.ConvertToMimeMessage()
|
||
Dim oTempFileName = IO.Path.GetTempFileName()
|
||
oMime.Save(oTempFileName, True)
|
||
|
||
RichEditControl1.LoadDocument(oTempFileName, DevExpress.XtraRichEdit.DocumentFormat.Mht)
|
||
|
||
_TempFiles.Add(oTempFileName)
|
||
|
||
RichEditControl1.Visible = True
|
||
RichEditControl1.Dock = DockStyle.Fill
|
||
Case ".eml"
|
||
RichEditControl1.LoadDocument(FilePath, DevExpress.XtraRichEdit.DocumentFormat.Mht)
|
||
|
||
RichEditControl1.Visible = True
|
||
RichEditControl1.Dock = DockStyle.Fill
|
||
Case ".xls"
|
||
Using oConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter()
|
||
' Loading the source document.
|
||
oConverter.LoadFromFile(FilePath, GdPicture14.DocumentFormat.DocumentFormatXLSX)
|
||
' Saving as the PDF document.
|
||
oConverter.SaveAsPDF("output.pdf", PdfConformance.PDF1_5)
|
||
End Using
|
||
|
||
_docPath = "output.pdf"
|
||
|
||
GdViewer.DisplayFromFile(_docPath)
|
||
Case Else
|
||
_docPath = FilePath
|
||
|
||
GdViewer.DisplayFromFile(_docPath)
|
||
|
||
RichEditControl1.Visible = False
|
||
RichEditControl1.Dock = DockStyle.None
|
||
End Select
|
||
Catch ex As Exception
|
||
_logger.Error(ex)
|
||
End Try
|
||
End Sub
|
||
|
||
Private Sub btnOpen_Click(sender As Object, e As EventArgs)
|
||
CloseDocument()
|
||
|
||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||
GdViewer.DocumentAlignment = ViewerDocumentAlignment.DocumentAlignmentTopCenter
|
||
|
||
If OpenFileDialog.ShowDialog() = DialogResult.OK Then
|
||
GdViewer.DisplayFromFile(OpenFileDialog.FileName)
|
||
End If
|
||
|
||
GdViewer.Focus()
|
||
UpdateMainUi()
|
||
End Sub
|
||
|
||
Private Function GetDocumentTypeLabel() As String
|
||
Dim result As String = ""
|
||
Select Case GdViewer.GetDocumentType()
|
||
Case DocumentType.DocumentTypeBitmap
|
||
result = "Bilddatei"
|
||
Case DocumentType.DocumentTypeMetaFile
|
||
result = "Metafile"
|
||
Case DocumentType.DocumentTypePDF
|
||
result = "PDF"
|
||
Case DocumentType.DocumentTypeSVG
|
||
result = "SVG"
|
||
Case DocumentType.DocumentTypeTXT
|
||
result = "Textdatei"
|
||
Case DocumentType.DocumentTypeUnknown
|
||
result = "Unbekannt"
|
||
End Select
|
||
Return result
|
||
End Function
|
||
|
||
Private Sub UpdateMainUi()
|
||
If GdViewer.PageCount = 0 Then
|
||
'btnOpen.Enabled = True
|
||
btnPrint.Enabled = False
|
||
btnFirstPage.Enabled = False
|
||
btnPreviousPage.Enabled = False
|
||
tbCurrentPage.Enabled = False
|
||
lblPageCount.Enabled = False
|
||
btnNextPage.Enabled = False
|
||
btnLastPage.Enabled = False
|
||
btnZoomOut.Enabled = False
|
||
cbZoom.Enabled = False
|
||
btnZoomIn.Enabled = False
|
||
btnFitPage.Enabled = False
|
||
btnFitWidth.Enabled = False
|
||
btnRotateLeft.Enabled = False
|
||
btnRotateRight.Enabled = False
|
||
btnFlipX.Enabled = False
|
||
btnFlipY.Enabled = False
|
||
tbCurrentPage.Text = "0"
|
||
lblPageCount.Text = "/ 0"
|
||
cbZoom.SelectedIndex = -1
|
||
Else
|
||
'btnOpen.Enabled = False
|
||
btnPrint.Enabled = True
|
||
btnFirstPage.Enabled = True
|
||
btnPreviousPage.Enabled = True
|
||
tbCurrentPage.Enabled = True
|
||
lblPageCount.Enabled = True
|
||
btnNextPage.Enabled = True
|
||
btnLastPage.Enabled = True
|
||
btnZoomOut.Enabled = True
|
||
cbZoom.Enabled = True
|
||
btnZoomIn.Enabled = True
|
||
btnFitPage.Enabled = True
|
||
btnFitWidth.Enabled = True
|
||
btnRotateLeft.Enabled = True
|
||
btnRotateRight.Enabled = True
|
||
btnFlipX.Enabled = True
|
||
btnFlipY.Enabled = True
|
||
UpdateaNavigationToolbar()
|
||
End If
|
||
End Sub
|
||
|
||
Private Sub btnFirstPage_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles btnFirstPage.Click
|
||
GdViewer.DisplayFirstPage()
|
||
End Sub
|
||
|
||
Private Sub btnPreviousPage_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles btnPreviousPage.Click
|
||
GdViewer.DisplayPreviousPage()
|
||
End Sub
|
||
|
||
Private Sub btnNextPage_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles btnNextPage.Click
|
||
GdViewer.DisplayNextPage()
|
||
End Sub
|
||
|
||
Private Sub btnLastPage_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles btnLastPage.Click
|
||
GdViewer.DisplayLastPage()
|
||
End Sub
|
||
|
||
Private Sub tbCurrentPage_Leave(ByVal sender As System.Object, ByVal e As EventArgs) Handles tbCurrentPage.Leave
|
||
Dim page As Integer = 0
|
||
If Integer.TryParse(tbCurrentPage.Text, page) Then
|
||
If page > 0 And page <= GdViewer.PageCount Then
|
||
GdViewer.DisplayPage(page)
|
||
UpdateaNavigationToolbar()
|
||
End If
|
||
End If
|
||
End Sub
|
||
|
||
Private Sub GdViewer1_PageChanged() Handles GdViewer.PageChanged
|
||
UpdateaNavigationToolbar()
|
||
End Sub
|
||
|
||
Private Sub ChangeZoomValue()
|
||
If cbZoom.SelectedIndex <> -1 Then
|
||
Select Case cbZoom.SelectedIndex
|
||
Case ZoomMode.Zoom50
|
||
GdViewer.Zoom = 50.0F / 100
|
||
Case ZoomMode.Zoom100
|
||
GdViewer.Zoom = 100.0F / 100
|
||
Case ZoomMode.Zoom150
|
||
GdViewer.Zoom = 150.0F / 100
|
||
Case ZoomMode.Zoom200
|
||
GdViewer.Zoom = 250.0F / 100
|
||
Case ZoomMode.ZoomSelectedArea
|
||
If GdViewer.IsRect() Then
|
||
GdViewer.ZoomRect()
|
||
Else
|
||
GdViewer.MouseMode = ViewerMouseMode.MouseModeAreaSelection
|
||
GdViewer.Focus()
|
||
End If
|
||
Case ZoomMode.ZoomFitToViewer
|
||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeFitToViewer
|
||
Case ZoomMode.ZoomFitWidth
|
||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||
Case ZoomMode.ZoomFitHeight
|
||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeHeightViewer
|
||
End Select
|
||
Else
|
||
If (IsNumeric(Regex.Replace(cbZoom.Text, "[^0-9,.]", ""))) Then
|
||
GdViewer.Zoom = Val(Regex.Replace(cbZoom.Text, "[^0-9,.]", "")) / 100
|
||
End If
|
||
End If
|
||
UpdateaNavigationToolbar()
|
||
End Sub
|
||
|
||
Private Sub cbZoom_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As EventArgs) Handles cbZoom.SelectedIndexChanged
|
||
ChangeZoomValue()
|
||
End Sub
|
||
|
||
Private Sub GdViewer1_AfterZoomChange() Handles GdViewer.AfterZoomChange
|
||
UpdateaNavigationToolbar()
|
||
If GdViewer.MouseMode = ViewerMouseMode.MouseModeAreaZooming Then
|
||
GdViewer.MouseMode = ViewerMouseMode.MouseModePan
|
||
End If
|
||
End Sub
|
||
|
||
Private Sub btnZoomOut_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles btnZoomOut.Click
|
||
GdViewer.ZoomOUT()
|
||
End Sub
|
||
|
||
Private Sub btnZoomIn_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles btnZoomIn.Click
|
||
GdViewer.ZoomIN()
|
||
End Sub
|
||
|
||
Private Sub cbZoom_TextUpdate(ByVal sender As System.Object, ByVal e As EventArgs) Handles cbZoom.Validating
|
||
ChangeZoomValue()
|
||
End Sub
|
||
|
||
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles btnPrint.Click
|
||
If GdViewer.PageCount = 0 Then
|
||
Return
|
||
End If
|
||
Using f As New frmViewerPrint(GdViewer)
|
||
f.ShowDialog(Me)
|
||
If f.DialogResult <> DialogResult.OK Then
|
||
Return
|
||
End If
|
||
Dim printSettings As frmViewerPrint.PrintSettings = f.printConfiguration
|
||
If Not GdViewer.PrintSetActivePrinter(printSettings.Printer) Then
|
||
Return
|
||
End If
|
||
GdViewer.PrintSetDocumentName("GdPicture Print Job " + DateTime.Now.ToString("yyyy-MM-dd HH\mm"))
|
||
GdViewer.PrintSetAlignment(printSettings.PrintAlignment)
|
||
Select Case printSettings.Orientation
|
||
Case frmViewerPrint.PrintOrientation.AutoDetection
|
||
GdViewer.PrintSetAutoRotation(True)
|
||
Exit Select
|
||
Case frmViewerPrint.PrintOrientation.Portrait
|
||
GdViewer.PrintSetAutoRotation(False)
|
||
GdViewer.PrintSetOrientation(PrinterOrientation.PrinterOrientationPortrait)
|
||
Exit Select
|
||
Case frmViewerPrint.PrintOrientation.Paysage
|
||
GdViewer.PrintSetAutoRotation(False)
|
||
GdViewer.PrintSetOrientation(PrinterOrientation.PrinterOrientationLandscape)
|
||
Exit Select
|
||
End Select
|
||
GdViewer.PrintSetCopies(printSettings.Copies)
|
||
If printSettings.Copies > 1 Then
|
||
GdViewer.PrintSetCollate(printSettings.Collate)
|
||
End If
|
||
Select Case printSettings.PagesToPrint
|
||
Case frmViewerPrint.PagesToPrint.All
|
||
GdViewer.PrintSetFromToPage(1, GdViewer.PageCount)
|
||
GdViewer.Print(printSettings.PrintSize)
|
||
Exit Select
|
||
Case frmViewerPrint.PagesToPrint.Current
|
||
GdViewer.PrintSetFromToPage(GdViewer.CurrentPage, GdViewer.CurrentPage)
|
||
GdViewer.Print(printSettings.PrintSize)
|
||
Exit Select
|
||
Case frmViewerPrint.PagesToPrint.Range
|
||
If printSettings.PageRange IsNot Nothing And printSettings.PageRange <> String.Empty Then
|
||
If printSettings.PageRange.Contains("-") Then
|
||
Dim pageStart As Integer = 0
|
||
If Integer.TryParse(printSettings.PageRange.Split("-"c)(0), pageStart) Then
|
||
Dim pageEnd As Integer = 0
|
||
If Integer.TryParse(printSettings.PageRange.Split("-"c)(1), pageEnd) Then
|
||
If pageEnd < pageStart Then
|
||
GdViewer.PrintSetFromToPage(pageEnd, pageStart)
|
||
GdViewer.Print(printSettings.PrintSize)
|
||
Else
|
||
GdViewer.PrintSetFromToPage(pageStart, pageEnd)
|
||
GdViewer.Print(printSettings.PrintSize)
|
||
End If
|
||
Else
|
||
MessageBox.Show("Page range is invalid.", "Error", MessageBoxButtons.OK, MessageBoxIcon.[Error])
|
||
End If
|
||
Else
|
||
MessageBox.Show("Page range is invalid.", "Error", MessageBoxButtons.OK, MessageBoxIcon.[Error])
|
||
End If
|
||
Else
|
||
Dim page As Integer = 0
|
||
If Integer.TryParse(printSettings.PageRange, page) Then
|
||
GdViewer.PrintSetFromToPage(page, page)
|
||
GdViewer.Print(printSettings.PrintSize)
|
||
Else
|
||
MessageBox.Show("Page range is invalid.", "Error", MessageBoxButtons.OK, MessageBoxIcon.[Error])
|
||
End If
|
||
End If
|
||
Else
|
||
MessageBox.Show("Page range is invalid.", "Error", MessageBoxButtons.OK, MessageBoxIcon.[Error])
|
||
End If
|
||
Exit Select
|
||
End Select
|
||
End Using
|
||
End Sub
|
||
|
||
Private Sub btnRotateLeft_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles btnRotateLeft.Click
|
||
GdViewer.Rotate(RotateFlipType.Rotate270FlipNone)
|
||
End Sub
|
||
|
||
Private Sub btnRotateRight_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles btnRotateRight.Click
|
||
GdViewer.Rotate(RotateFlipType.Rotate90FlipNone)
|
||
End Sub
|
||
|
||
Private Sub btnFlipX_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles btnFlipX.Click
|
||
GdViewer.Rotate(RotateFlipType.RotateNoneFlipX)
|
||
End Sub
|
||
|
||
Private Sub btnFlipY_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles btnFlipY.Click
|
||
GdViewer.Rotate(RotateFlipType.RotateNoneFlipY)
|
||
End Sub
|
||
|
||
Private Sub GdViewer1_TransferEnded(ByVal status As GdPictureStatus, ByVal download As System.Boolean) Handles GdViewer.TransferEnded
|
||
GdViewer.Focus()
|
||
UpdateMainUi()
|
||
End Sub
|
||
|
||
Private Sub cbZoom_Validating(ByVal sender As System.Object, ByVal e As CancelEventArgs) Handles cbZoom.Validating
|
||
ChangeZoomValue()
|
||
End Sub
|
||
|
||
Private Sub AddSearchRegion(ByVal occurence As Integer, ByVal leftCoordinate As Single, ByVal topCoordinate As Single, ByVal regionWidth As Single, ByVal regionheight As Single, ByVal ensureVisibility As Boolean)
|
||
Dim searchRegion As Integer = GdViewer.AddRegionInches("SearchResult" & occurence, leftCoordinate, topCoordinate, regionWidth, regionheight, ForegroundMixMode.ForegroundMixModeMASKPEN, Color.Yellow)
|
||
GdViewer.SetRegionEditable(searchRegion, False)
|
||
If ensureVisibility Then
|
||
GdViewer.EnsureRegionVisibility(searchRegion)
|
||
End If
|
||
End Sub
|
||
|
||
Private Sub btnSettings_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSettings.Click
|
||
Using frmSettings As New frmViewerSettings(GdViewer)
|
||
frmSettings.ShowDialog(Me)
|
||
End Using
|
||
UpdateaNavigationToolbar()
|
||
End Sub
|
||
|
||
Private Sub UpdateaNavigationToolbar()
|
||
Dim currentPage As Integer = GdViewer.CurrentPage()
|
||
tbCurrentPage.Text = currentPage.ToString()
|
||
lblPageCount.Text = "/ " & GdViewer.PageCount.ToString()
|
||
If currentPage = 1 Then
|
||
btnFirstPage.Enabled = False
|
||
btnPreviousPage.Enabled = False
|
||
Else
|
||
btnFirstPage.Enabled = True
|
||
btnPreviousPage.Enabled = True
|
||
End If
|
||
If currentPage = GdViewer.PageCount Then
|
||
btnNextPage.Enabled = False
|
||
btnLastPage.Enabled = False
|
||
Else
|
||
btnNextPage.Enabled = True
|
||
btnLastPage.Enabled = True
|
||
End If
|
||
cbZoom.Text = String.Format(CultureInfo.InvariantCulture, "{0:#0.##%}", GdViewer.Zoom)
|
||
|
||
|
||
Dim widthInches, heightInches As Double
|
||
|
||
If GdViewer.GetDocumentType = DocumentType.DocumentTypePDF Then
|
||
widthInches = GdViewer.PdfGetPageWidth / 72
|
||
heightInches = GdViewer.PdfGetPageHeight / 72
|
||
Else
|
||
widthInches = GdViewer.PageWidth / GdViewer.HorizontalResolution
|
||
heightInches = GdViewer.PageHeight / GdViewer.VerticalResolution
|
||
End If
|
||
|
||
Me.ToolStripStatusLabel1.Text = "Typ: " + GetDocumentTypeLabel() + " - " +
|
||
"Seitengröße (zoll): " + Trim(Str(Math.Round(widthInches, 2))) + " × " + Trim(Str(Math.Round(heightInches, 2))) + " - " +
|
||
"Seitengröße (pixel): " + Trim(Str(GdViewer.PageWidth)) + " × " + Trim(Str(GdViewer.PageHeight)) + " - " +
|
||
"Horizontale Auflösung: " + Trim(Str(Math.Round(GdViewer.HorizontalResolution, 2))) + " DPI - " +
|
||
"Vertikale Auflösung: " + Trim(Str(Math.Round(GdViewer.VerticalResolution, 2))) + " DPI"
|
||
|
||
End Sub
|
||
|
||
Private Sub btnFitWidth_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnFitWidth.Click
|
||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeWidthViewer
|
||
End Sub
|
||
|
||
Private Sub btnFitPage_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnFitPage.Click
|
||
GdViewer.ZoomMode = ViewerZoomMode.ZoomModeFitToViewer
|
||
End Sub
|
||
|
||
Private Sub DefaultToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles DefaultToolStripMenuItem.Click
|
||
GdViewer.MouseMode = ViewerMouseMode.MouseModeDefault
|
||
DefaultToolStripMenuItem.Checked = True
|
||
AreaSelectionToolStripMenuItem.Checked = False
|
||
PanToolStripMenuItem.Checked = False
|
||
AreaZoomingToolStripMenuItem.Checked = False
|
||
MagnifierToolStripMenuItem.Checked = False
|
||
GdViewer.Focus()
|
||
End Sub
|
||
|
||
Private Sub AreaSelectionToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles AreaSelectionToolStripMenuItem.Click
|
||
GdViewer.MouseMode = ViewerMouseMode.MouseModeAreaSelection
|
||
DefaultToolStripMenuItem.Checked = False
|
||
AreaSelectionToolStripMenuItem.Checked = True
|
||
PanToolStripMenuItem.Checked = False
|
||
AreaZoomingToolStripMenuItem.Checked = False
|
||
MagnifierToolStripMenuItem.Checked = False
|
||
GdViewer.Focus()
|
||
End Sub
|
||
|
||
Private Sub PanToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles PanToolStripMenuItem.Click
|
||
GdViewer.MouseMode = ViewerMouseMode.MouseModePan
|
||
DefaultToolStripMenuItem.Checked = False
|
||
AreaSelectionToolStripMenuItem.Checked = False
|
||
PanToolStripMenuItem.Checked = True
|
||
AreaZoomingToolStripMenuItem.Checked = False
|
||
MagnifierToolStripMenuItem.Checked = False
|
||
GdViewer.Focus()
|
||
End Sub
|
||
|
||
Private Sub AreaZoomingToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles AreaZoomingToolStripMenuItem.Click
|
||
GdViewer.MouseMode = ViewerMouseMode.MouseModeAreaZooming
|
||
DefaultToolStripMenuItem.Checked = False
|
||
AreaSelectionToolStripMenuItem.Checked = False
|
||
PanToolStripMenuItem.Checked = False
|
||
AreaZoomingToolStripMenuItem.Checked = True
|
||
MagnifierToolStripMenuItem.Checked = False
|
||
GdViewer.Focus()
|
||
End Sub
|
||
|
||
Private Sub MagnifierToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles MagnifierToolStripMenuItem.Click
|
||
GdViewer.MouseMode = ViewerMouseMode.MouseModeMagnifier
|
||
DefaultToolStripMenuItem.Checked = False
|
||
AreaSelectionToolStripMenuItem.Checked = False
|
||
PanToolStripMenuItem.Checked = False
|
||
AreaZoomingToolStripMenuItem.Checked = False
|
||
MagnifierToolStripMenuItem.Checked = True
|
||
GdViewer.Focus()
|
||
End Sub
|
||
|
||
Private Sub DocumentViewer_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
|
||
GdViewer.Dispose()
|
||
End Sub
|
||
End Class
|