ImageGear for .NET User Guide > Getting Started > ImageGear for .NET Visual Studio 2010 Tutorials > ImageGear for .NET VB.NET Tutorial > Developing the Application |
VB .NET |
Copy Code |
---|---|
Imports System.IO Imports System.Diagnostics Imports ImageGear Imports ImageGear.Core Imports ImageGear.Windows.Forms Imports ImageGear.Display Imports ImageGear.Processing Imports ImageGear.Formats |
VB .NET |
Copy Code |
---|---|
' holds the image data Private igPage As ImGearPage ' controls how the page is displayed Private igPageDisplay As ImGearPageDisplay |
VB .NET |
Copy Code |
---|---|
'***The SetSolutionName, SetSolutionKey and possibly the SetOEMLicenseKey
'methods must be called to distribute the runtime.***
'ImGearLicense.SetSolutionName("YourSolutionName")
'ImGearLicense.SetSolutionKey(12345, 12345, 12345, 12345)
'Manually Reported Runtime licenses also require the following method
'call to SetOEMLicenseKey.
'ImGearLicense.SetOEMLicenseKey("2.0.AStringForOEMLicensing..."); |
Please add the ImGearEvaluationManager.Initialize() call if you are evaluating the product.
VB .NET |
Copy Code |
---|---|
' Support for common formats:
ImGearCommonFormats.Initialize() |
VB .NET |
Copy Code |
---|---|
LoadPageToolStripMenuItem.Click Dim dlg As New OpenFileDialog dlg.Filter = "All files (*.*)|*.*" dlg.FilterIndex = 1 dlg.RestoreDirectory = True If dlg.ShowDialog = DialogResult.OK Then Dim stream As New FileStream(dlg.FileName, FileMode.Open, FileAccess.Read) Try ' load the image into the page igPage = ImGearFileFormats.LoadPage(stream, 0) Catch ex As Exception Console.WriteLine("Failed to load image") End Try If Not igPage Is Nothing AndAlso Not igPage.DIB Is Nothing Then ' create a new page display igPageDisplay = New ImGearPageDisplay(igPage) ' associate the page display with the page view ImGearPageView1.Display = igPageDisplay ' cause the page view to repaint ImGearPageView1.Invalidate() End If End If End Sub |
ImGearPageDisplay Class | Constructs a new PageDisplay object for the given page. |
ImGearPageView.Invalidate | Invalidates the control thus causing it to repaint. |
ImGearFileFormats.LoadPage Method | Loads a file from a given stream and returns a new ImGearPage Class. |
ImGearFileFormats.GetSavingFilter Method | Gets a filter string which can be passed to a windows common dialog filter member. |
VB .NET |
Copy Code |
---|---|
If Not igPageDisplay Is Nothing AndAlso Not igPageDisplay.Page.DIB.IsEmpty() Then ' get the current zoom info Dim igZoomInfo As ImGearZoomInfo igZoomInfo = igPageDisplay.GetZoomInfo(ImGearPageView1) ' increase the zoom igZoomInfo.Horizontal.Value = igZoomInfo.Horizontal.Value * 1.25 igZoomInfo.Vertical.Value = igZoomInfo.Vertical.Value * 1.25 igZoomInfo.Horizontal.Fixed = True igZoomInfo.Vertical.Fixed = True ' set the new zoom values and repaint the view igPageDisplay.UpdateZoomFrom(igZoomInfo) ImGearPageView1.Invalidate() End If |
ImGearPageDisplay.GetZoomInfo Method | Retrieves the current zoom information from the display and page view. |
ImGearPageDisplay.UpdateZoomFrom Method | Sets new zoom values from the given ImGearZoomInfo Structure object. |
ImGearZoomInfo Structure | Holds horizontal and vertical zoom values and settings. |
VB .NET |
Copy Code |
---|---|
If Not igPageDisplay Is Nothing AndAlso Not igPageDisplay.Page.DIB.IsEmpty() Then ' get the current zoom info Dim igZoomInfo As ImGearZoomInfo igZoomInfo = igPageDisplay.GetZoomInfo(ImGearPageView1) ' decrease the zoom igZoomInfo.Horizontal.Value = igZoomInfo.Horizontal.Value / 1.25 igZoomInfo.Vertical.Value = igZoomInfo.Vertical.Value / 1.25 igZoomInfo.Horizontal.Fixed = True igZoomInfo.Vertical.Fixed = True ' set the new zoom values and repaint the view igPageDisplay.UpdateZoomFrom(igZoomInfo) ImGearPageView1.Invalidate() End If |
Example Title |
Copy Code |
---|---|
If Not igPage Is Nothing Then Try ImGearProcessing.Rotate(igPage, ImGearRotationValues.VALUE_90) Catch ex As Exception Console.WriteLine(ex.Message) End Try ImGearPageView1.Invalidate() End If |
ImGearProcessing.Rotate Method | Rotates the given page by the given amount. |
VB .NET |
Copy Code |
---|---|
Application.Exit() |