Guide for VB.NET
Core Document Formats
Additional Features

VB.NET Imaging - Create Windows Image Viewer

VB.NET Guide and Codes for Creating Windows Image Viewer with .NET SDK

VB.NET
Home > .NET Imaging SDK > VB.NET > Create Windows Viewer
To get started with DocImage SDK for .NET, you are supposed to read VB.NET Imaging: Get Started first!

Download RasterEdge .NET Image SDK now to create a Windows Image Viewer in a Visual Basic .NET image viewing and processing application! itextsharp read pdf fields vb.net, c# split pdf by bookmark, c# pdfsharp compression, vb.net add image to pdf, vb.net print form to pdf, asp.net c# qr code generator. This Windows image viewer can enable developers to easily add a wide range of image viewing and editing functionality into their VB.NET programs.
Related .net document control helps:
asp.net image viewer jquery: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
asp.net pdf document viewer c#: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm...
powerpoint viewer asp.net mvc: ASP.NET PowerPoint Document Viewer Control (MVC & WebForms): view ppt, pptx files online in C# using ASP.NET
asp.net office document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net view excel in browser: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.
mvc document viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects
asp.net view text file: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
With this Visual Basic .NET Windows viewer installed, users can efficiently perform basic image management such as loading & opening an image, zooming in and out an image, rotating and flipping an image, printing & saving an image to your local file. All these functions can be easily achieved with simple VB.NET codings. add watermark to pdf c#, vb.net pdf open password, itextsharp remove text from pdf c#, merge pdfs into one c#, image to pdf vb.net, open pdf file visual basic 2010, vb.net ocr read text from pdf.
Furthermore, this VB.NET Windows Viewer library SDK can also allow you to add various types / shapes of annotation objects on an image and place it anywhere you like. If you need a format conversion, it is also available to convert between different image and document formats, including png, jpeg, gif, tiff, bmp, PDF, and Word, etc.
This page will provide you with detailed guidance and Visual Basic .NET sample codes for creating a VB.NET image Windows Image Viewer. You can get a basic idea of the page layout from the list below:
  • Visual Basic .NET Image Viewer function introduction
  • Visual Basic .NET demo codes to for creating Windows image viewer
  • Some more Visual Basic .NET image processing tutorial recommendations
VB.NET Windows Image Viewer Functions
RasterEdge VB .NET Windows Image Viewer can be easily installed into your computer for flexible image processing. Now we will provide you with a brief introduction of this VB.NET Windows Viewer functions . Please ensure that you have installed .NET Framework (2.0 and above supported) and Microsoft Visual Studio (2005 or later versions compatible).

Opening and creating an Image

With this VB.NET Windows image viewer library SDK, you can create a new image in formats such as png, jpeg, gif, tiff and bmp. You can also load & open an image from a local file, or from .NET Graphics. Alternatively, you are also enabled to download an image from a URL, or just create a new one from stream.

Processing and Editing an Image

Installing this VB.NET Windows image also allows you to add multiple image processing functions into your program. For example, you can now resize, crop and scale an image as you wish. Apart from that, you are entitled to change the orientation of an image and add / embed watermark to it.

Annotating an Image

You can also add various kinds of annotation objects to your images in the VB.NET Window image viewer. Supported types include callout, ellipse, freehand, hotspot, line, polygon, rectangle, rubber stamp, as well as text. You can accurately define the size and location of all the annotations with simple VB.NET codings.

Converting & Drawing an Image

Do you want to convert an image into other formats? This VB.NET Windows image viewer can enable you to convert between different image formats like png, gif, jpeg, tiff and bmp. What's more, you can even convert an image to byte array and stream using VB.NET programming.
VB.NET Windows Image Viewer Demo Codes
In the following code tab, we have presented the complete Visual Basic .NET demo codes for image processing with VB.NET Windows Image Viewer. Firstly you need to build a Windows application (with VB.NET programming language) in your Microsoft Visual Studio then you can freely copy the codings below to your program!
Imports System.IO
Imports System.Drawing.Printing
Imports RasterEdge.Imaging
Imports System.Windows
Imports RasterEdge.Imaging.WindowsControl

Namespace Picture_Labs
Public Partial Class Form1
Inherits Form
Private WindowsViewer As New RasterImaging()

'Open And Save Dialog
Private ofd As New OpenFileDialog()
Private sfd As New SaveFileDialog()

'Zoom Level
Private zoomFactor As Double = 1.0

'Image Processing Handler
Private imageHandler As New RasterImaging.ImageHandler()

Public Sub New()
InitializeComponent()
End Sub



Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Form1.Load
imageHandler = New RasterImaging.ImageHandler()
End Sub



Private Sub cOpen_Click(sender As Object, e As System.EventArgs) Handles cOpen.Click
ofd = New OpenFileDialog()
ofd.Title = "Open Picture"
ofd.Filter = "Picture File |*.bmp;*.jpg;*.png;*.gif"
ofd.ShowDialog()
If ofd.FileName.ToString() <> "" Then
'Send Image To Handle
imageHandler.CurrentBitmap = CType(Bitmap.FromFile(ofd.FileName), Bitmap)
imageHandler.BitmapPath = ofd.FileName

Me.AutoScroll = True
Me.AutoScrollMinSize = New Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor))
Me.Invalidate()

ofd.Dispose()
End If

End Sub



' Detect any Change From Handle and Then Display It To Current Form
Private Sub Form1_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
' Scale Image To Center Screen
Dim g As Graphics = e.Graphics
Dim FormSizeX As Integer = (Me.Size.Width / 2) - (imageHandler.CurrentBitmap.Width / 2)
Dim FormSizeY As Integer = (Me.Size.Height / 2) - (imageHandler.CurrentBitmap.Height / 2)
g.DrawImage(imageHandler.CurrentBitmap, New Rectangle(FormSizeX, FormSizeY,
Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor)))
End Sub



' Save The File
Private Sub cSave_Click(sender As Object, e As System.EventArgs) Handles cSave.Click
sfd = New SaveFileDialog()
sfd.Title = "Save Pictre"
sfd.Filter = "Windows Bitmap (*.bmp) |*.bmp"
sfd.ShowDialog()
If sfd.FileName.ToString() <> "" Then
imageHandler.SaveBitmap(sfd.FileName)
End If
End Sub



' Change Zoom Level
Private Sub cbScale_Change(sender As Object, e As EventArgs)
Select Case cbScale.Text
Case "50%"
zoomFactor = 0.5
Me.AutoScrollMinSize = New Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor))
Me.Invalidate()
Exit Select
Case "100%"
zoomFactor = 1.0
Me.AutoScrollMinSize = New Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor))
Me.Invalidate()
Exit Select
Case "150%"
zoomFactor = 1.5
Me.AutoScrollMinSize = New Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor))
Me.Invalidate()
Exit Select
Case "200%"
zoomFactor = 2.0
Me.AutoScrollMinSize = New Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor))
Me.Invalidate()
Exit Select
Case "250%"
zoomFactor = 2.5
Me.AutoScrollMinSize = New Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor))
Me.Invalidate()
Exit Select
Case "300%"
zoomFactor = 3.0
Me.AutoScrollMinSize = New Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor))
Me.Invalidate()
Exit Select
Case "350%"
zoomFactor = 3.5
Me.AutoScrollMinSize = New Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor))
Me.Invalidate()
Exit Select
Case "400%"
zoomFactor = 4.0
Me.AutoScrollMinSize = New Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor))
Me.Invalidate()
Exit Select
Case Else
Exit Select
End Select
End Sub



' Rotate And Flip Image
Private Sub cbRotateFlip_Change(sender As Object, e As EventArgs)
Select Case cbRotateFlip.Text
Case "Rotate 90"
imageHandler.RotateFlip(RotateFlipType.Rotate90FlipNone)
Me.AutoScroll = True
Me.AutoScrollMinSize = New Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor))
Me.Invalidate()
Exit Select
Case "Rotate 180"
imageHandler.RotateFlip(RotateFlipType.Rotate180FlipNone)
Me.AutoScroll = True
Me.AutoScrollMinSize = New Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor))
Me.Invalidate()
Exit Select
Case "Rotate 270"
imageHandler.RotateFlip(RotateFlipType.Rotate270FlipNone)
Me.AutoScroll = True
Me.AutoScrollMinSize = New Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor))
Me.Invalidate()
Exit Select
Case "Flip Horizontal"
imageHandler.RotateFlip(RotateFlipType.RotateNoneFlipX)
Me.AutoScroll = True
Me.AutoScrollMinSize = New Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor))
Me.Invalidate()
Exit Select
Case "Flip Vertical"
imageHandler.RotateFlip(RotateFlipType.RotateNoneFlipY)
Me.AutoScroll = True
Me.AutoScrollMinSize = New Size(Convert.ToInt32(imageHandler.CurrentBitmap.Width * zoomFactor),
Convert.ToInt32(imageHandler.CurrentBitmap.Height * zoomFactor))
Me.Invalidate()
Exit Select
Case Else
Exit Select
End Select
End Sub

Private Sub cbMask_Change(sender As Object, e As EventArgs)
Select Case cbMask.Text
Case "Red"
Me.Cursor = Cursors.WaitCursor
imageHandler.RestorePrevious()
imageHandler.SetColorFilter(RasterImaging.ImageHandler.ColorFilterTypes.Red)
Me.Invalidate()
Me.Cursor = Cursors.[Default]
Exit Select
Case "Green"
Me.Cursor = Cursors.WaitCursor
imageHandler.RestorePrevious()
imageHandler.SetColorFilter(RasterImaging.ImageHandler.ColorFilterTypes.Green)
Me.Invalidate()
Me.Cursor = Cursors.[Default]
Exit Select
Case "Blue"
Me.Cursor = Cursors.WaitCursor
imageHandler.RestorePrevious()
imageHandler.SetColorFilter(RasterImaging.ImageHandler.ColorFilterTypes.Blue)
Me.Invalidate()
Me.Cursor = Cursors.[Default]
Exit Select
Case Else
Exit Select
End Select
End Sub

Private Sub cbFilter_Change(sender As Object, e As EventArgs)
Select Case cbFilter.Text
'"Gamma",
'"Contrast",
'"Brightness"});
Case "Grayscake"
Me.Cursor = Cursors.WaitCursor
imageHandler.RestorePrevious()
imageHandler.SetGrayscale()
Me.Invalidate()
Me.Cursor = Cursors.[Default]
Exit Select
Case "Invert"
Me.Cursor = Cursors.WaitCursor
imageHandler.RestorePrevious()
imageHandler.SetInvert()
Me.Invalidate()
Me.Cursor = Cursors.[Default]
Exit Select
Case "Gamma"
Me.Cursor = Cursors.WaitCursor
imageHandler.RestorePrevious()
'You Can Change This Value
imageHandler.SetGamma(2.1, 2.1, 2.0)
'Is Enough?
Me.Invalidate()
Me.Cursor = Cursors.[Default]
Exit Select
Case "Contrast"
Me.Cursor = Cursors.WaitCursor
imageHandler.RestorePrevious()
'You Can Change This Value
imageHandler.SetContrast(2.5)
'Is Enough?
Me.Invalidate()
Me.Cursor = Cursors.[Default]
Exit Select
Case "Brightness"
Me.Cursor = Cursors.WaitCursor
imageHandler.RestorePrevious()
'You Can Change This Value
imageHandler.SetBrightness(15)
'Is Enough?
Me.Invalidate()
Me.Cursor = Cursors.[Default]
Exit Select
Case Else
Exit Select
End Select
End Sub

End Class
End Namespace
More Tutorials!
Find more user guides with RasterEdge .NET Image SDK using VB.NET sample codings!


Recommend this to Google+


RasterEdge.com is professional provider of ASP.NET MVC Document Viewer, ASP.NET PDF Viewer, MVC PDF Viewer document, content and imaging solutions, available for ASP.NET AJAX, Silverlight, Windows Forms as well as WPF. We are dedicated to provide powerful & profession imaging controls, PDF document, image to pdf files and components for capturing, viewing, processing, converting, compressing and stroing images, documents and more.

©2000-2023 Raster Edge.com