The Simplest Sample For ASP.NET Barcode Server Control
- In order to use EaseSoft ASP.NET Barcode Server Control, Please copy the file “easeLinear.aspx” in the same directory and copy “EaseWebControl.dll” to the “bin” folder.
- Create an ASP.NET page,For example demo1.aspx
- Register the server control:<%@ Register TagPrefix=”cc1″ Namespace=”EaseSoftBarcode ” Assembly = “EaseWebControl” %>
- Declare the server control and set the control’s property value in the page:<cc1:EaseWebControl id=”EaseLinear1″ runat=”server” BackColor=”Yellow” Text=”98765432101″></cc1:EaseWebControl>
The Sample Manipulating ASP.NET Barcode Server Control
You can programmatically identify an individual ASP.NET server control within a page by providing it with an id attribute. You can use this id reference to programmatically manipulate the server control’s object properties at run time.For example, the following sample demonstrates how to wire and handle a button event on a single page.Event handler provide a clean way for page developers to handle the ASP.NET Barcode Server Control in an ASP.NET page.
GDI+ and Printing
GDI+ is Microsoft’s new .NET Framework class library for graphical programming. GDI+ provides us with three types of drawing surfaces- windows,bitmaps,and printers.EaseSoft Barcode Control was based on GDI+ control, it supports screen display ,bitmaps, and printers. There are two fundamental types of custom control for use in .NET:
- Windows Forms custom controls are used in rich client applications. These are typically highly responsive custom controls- they may track the mouse when it enters the control, and they may change the mouse cursor or even the appearance of the custom control.
- Web Forms custom controls are used in Web applications. These controls will typically be less dynamically interactive.
The Resolution of a Drawing Surface
In GDI+, the resolution of our drawing surface is always expressed in units of pixels-per-inch(DPI) or dots-per-inch(DPI). if a surface has a resolution of 72 DPI, then we should be able to examine a 1-inch square of the surface and find that it is a composed of a grid of 72 pixels in the horizontal direction by 72 pixels in the vertical direction.
Screen Resolution :The screen is assumed to have a resolution of 96 DPI,regardless of the actual resolution of the screen.
Printer Resolution : Every printer device also has a resolution. The user can select their desired resolution.
Bitmap Resolution: Every Bitmap Image also has a resolution. You can set the resolution when you create the bitmap.
It is very easy to print graphics with GDI+ printing class “PrintDocument” ,which encapsulates a print document in memory. We can use this object to send output to a printer or print preview dialog. The flowing is a simple printing barcode image example:
private void Print_Click(object sender, System.EventArgs e)
{
PrintDocument pd = new PrintDocument();
EaseSoftBarcode.EaseWebControl easeLinear1 = new EaseSoftBarcode.EaseWebControl();
pd.DocumentName = "Printing a Barcode";
pd.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.PrintPageEventHandler );
pd.Print();
}
private void PrintPageEventHandler(Object obj,PrintPageEventArgs ev)
{
Graphics g = ev.Graphics;
g.DrawImage(easeLinear1.Picture,40,100);
}