Guide for VB.NET
Core Document Formats
Additional Features
Rectangle Annotation

VB.NET Imaging - Add Rectangle Annotation in VB

How to Annotate File with Rectangle Annotation Image Using VB.NET Code

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

VB.NET Rectangle Annotation Creating Application
How to note or annotate source digital document image file in a programming way? To help VB.NET developers solve this problem, we particularly design this VB.NET rectangle annotator control, a component from .NET imaging SDK. Using this VB.NET rectangle annotation toolkit, developers can mark & annotate the content of target document image file in following three ways using VB.NET code.
Related .net document control helps:
powerpoint viewer mvc: ASP.NET PowerPoint Document Viewer Control (MVC & WebForms): view ppt, pptx files online in C# using ASP.NET edit pdf text color: ASP.NET PDF Text Edit Control: online edit PDF text content using C# ASP.NET excel view: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser. edit pdf page: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C# dicom web viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET display tiff images: ASP.NET Tiff Viewer: view, annotate multipage Tiff images in ASP.NET MVC, WebForms using C# Control
document viewer c#: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...
  • Solution 1: Use this VB.NET rectangle annotating API to create a rectangle annotation with black non-transparent filled color. This VB.NET solution can help users hide or cover certain document or image information
  • Solution 2: Add a rectangle annotation with transparent background color to source document image file using this VB.NET rectangle annotator control. This solution can be used as a method to highlight the content of target file in .NET developing application
  • Solution 3: Use this .NET rectangle annotator library to create a rectangle annotation which has no background color and owns a customized border in VB.NET imaging application. This VB.NET solution is designed to help users create a rectangle text box to insert additional annotation information.
In order to help you have a deeper and quicker understanding of the working principle of this VB.NET rectangle annotator control SDK, we will explain how to annotate source document image file with rectangle annotation using VB.NET code from following aspects.
  • Function list of this VB.NET rectangle annotator control toolkit
  • Overview of VB.NET imaging dlls that are used to add rectangle annotations
  • VB.NET method to draw rectangle annotation on image file
  • VB.NET programming code to create customized rectangle annotation
  • Differences between RasterEdge VB.NET rectangle annotators and other similar annotating SDKs
VB.NET Rectangle Annotator SDK Functions
  • An easy-to-use rectangle annotating toolkit for VB.NET imaging application
  • Generated rectangle annotation can be saved as a separate image object in VB.NET
  • Able to attach a user-defined shadow to created rectangle annotation using VB.NET
  • The edge property, filled shape property & shadow property are independently controlled
  • The size and position of created rectangle annotation can be easily modified using VB.NET code
  • Allow VB.NET developers to add rectangle annotation to Word file, if integrated with .NET, VB.NET Word processing SDK
VB.NET Image Rectangle Annotating DLLs
Those mature VB.NET rectangle annotating APIs are compacted into following two dlls which can be completely embedded into VB.NET developing application by adding reference directly.
  • RasterEdge.Imaging.Basic.dll
  • RasterEdge.Imaging.Annotation.dll
As this RasterEdge.Imaging.Basic.dll adopts the application of X & Y location, this VB.NET rectangle annotator component add-on enables developers to accurately define the position where rectangle annotation will be created. What should be mentioned here is that the library (RasterEdge.Imaging.Annotation.dll) can be also used to add other popular annotating types to image or document file, like freehand annotation and text annotation.
VB.NET Image Rectangle Annotating Method
From following VB.NET rectangle annotating method, you will know the starting point of rectangle annotation is determined by the values of X & Y. The size of rectangle annotation is defined by the values of width & height.
Public Shared Function 
CreateRectangleAnnotation(x As Single, y As Single, w As Single, h As Single) As RectangleAnnotation
End Function

Public Shared Function
CreateRectangleAnnotation(x As Single, y As Single, w As Single, h As Single, outline As AnnotationPen, fill As AnnotationBrush, _
shadow As AnnotationBrush, shadowX As Single, shadowY As Single) As RectangleAnnotation
End Function
VB.NET Code to Create Rectangle Annotation
In this part, a detailed VB.NET sample code is presented here, which will show you how to use this VB.NET rectangle annotation for creating a desired rectangle annotation.
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports RasterEdge.Imaging.Annotation
Imports System.Diagnostics
Imports RasterEdge.Imaging.Annotation.Basic

Namespace annotation_trial
Public Partial Class Form1
Inherits Form
Public Sub New()
End Sub

Private Sub button1_Click(sender As Object, e As EventArgs)

Dim obj As New RectangleAnnotation()
' set annotation size
obj.X = 60F
obj.Y = 45F
obj.Width = 561F
obj.Height = 228F

'set annotation edge property
obj.OutLine = New LinePen()
obj.OutLine.Width = 5F
'set annotation edge width
obj.OutLine.Brush = New AnnotationBrush()
obj.OutLine.Brush.FillType = RasterEdge.Imaging.Annotation.FillType.Solid
'set annotation edge style
obj.OutLine.Brush.Solid_Color = Color.Blue
'set annotation edge color
'set the property of filled shape

'obj.Fill = new AnnotationBrush();
'obj.Fill.FillType = RasterEdge.Imaging.Annotation.FillType.Solid;//set filled shape style
'obj.Fill.Solid_Color = Color.Gray;//set filled shape color

obj.Fill = BrushGenerator.CreateSolidBrush(Color.Maroon)

'obj.Fill = BrushGenerator.CreateHatchBrush(Color.IndianRed, Color.LightGreen, System.Drawing.Drawing2D.HatchStyle.DarkHorizontal);
'obj.Fill.FillType = FillType.Hatch;

'Image loadImage = Image.FromFile("c:/SampleAnnoImg.png");
'obj.Fill = BrushGenerator.CreateTextureBrush(loadImage, System.Drawing.Drawing2D.WrapMode.Clamp, new RectangleF(0, 0, 100, 100));

'obj.Fill = BrushGenerator.CreateLinearGradientBrush(Color.IndianRed, Color.LightGreen, System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal, new RectangleF(0, 0, 100, 100));

'set the property of shadow
obj.ShadowFill = New AnnotationBrush()
obj.ShadowFill.FillType = RasterEdge.Imaging.Annotation.FillType.Solid
'set shadow style
obj.ShadowFill.Solid_Color = Color.DarkGreen
'set shadow color
obj.ShadowX = 10F
'set shadow position
obj.ShadowY = 12F
obj.ShowShadow = True
'show shadow or not
Dim folderName As String = "C:/"
Dim img As Bitmap = obj.CreateAnnotation()
img.Save(folderName & "rectangleannotation.png")
End Sub
End Class
End Namespace
Comparison on VB.NET Rectangle Annotation SDKs
The biggest feature that distinguishes RasterEdge VB.NET rectangle annotator from other similar rectangle annotating SDKs is its comprehensive annotating settings. From above VB.NET code demo, you can obviously find a fact that this VB.NET rectangle annotator control add-on allows developers to create a customized rectangle annotation by adjusting annotation properties with separate VB.NET code. Therefore, if you want to create a customized rectangle annotation on source document image file, this VB.NET rectangle annotator SDK will be your best choice.

Recommend this to Google+ 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-2017 Raster