Leadtools.Document Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.10.31
DrawPage(Graphics,Int32,Rectangle,Rectangle,Rectangle,Rectangle,RasterPaintProperties) Method
See Also  Example
Leadtools.Document Namespace > RasterDocumentEngine Class > DrawPage Method : DrawPage(Graphics,Int32,Rectangle,Rectangle,Rectangle,Rectangle,RasterPaintProperties) Method




graphics
Graphics object specified the device that contains the drawing.
pageIndex
Specifies the index of the page to be drawn. This index is zero-based.
src
The coordinates for the source drawing area
srcClip
The coordinates for the source clipping drawing area
dest
The coordinates for the destination drawing area
destClip
The coordinates for the destination clipping drawing area
paintProperties
Gets or sets the RasterPaintProperties which control the display
Draws the specified page with(out) its zones, at any size, to a Graphics object. If the display surface has fewer colors than the image, this method dithers the output to that display surface without affecting the actual image data.

Syntax

Visual Basic (Declaration) 
Overloads Public Sub DrawPage( _
   ByVal graphics As Graphics, _
   ByVal pageIndex As Integer, _
   ByVal src As Rectangle, _
   ByVal srcClip As Rectangle, _
   ByVal dest As Rectangle, _
   ByVal destClip As Rectangle, _
   ByVal paintProperties As RasterPaintProperties _
) 
Visual Basic (Usage)Copy Code
Dim instance As RasterDocumentEngine
Dim graphics As Graphics
Dim pageIndex As Integer
Dim src As Rectangle
Dim srcClip As Rectangle
Dim dest As Rectangle
Dim destClip As Rectangle
Dim paintProperties As RasterPaintProperties
 
instance.DrawPage(graphics, pageIndex, src, srcClip, dest, destClip, paintProperties)
C# 
public void DrawPage( 
   Graphics graphics,
   int pageIndex,
   Rectangle src,
   Rectangle srcClip,
   Rectangle dest,
   Rectangle destClip,
   RasterPaintProperties paintProperties
)
Managed Extensions for C++ 
public: void DrawPage( 
   Graphics graphics,
   int pageIndex,
   Rectangle src,
   Rectangle srcClip,
   Rectangle dest,
   Rectangle destClip,
   RasterPaintProperties paintProperties
) 
C++/CLI 
public:
void DrawPage( 
   Graphics graphics,
   int pageIndex,
   Rectangle src,
   Rectangle srcClip,
   Rectangle dest,
   Rectangle destClip,
   RasterPaintProperties paintProperties
) 

Parameters

graphics
Graphics object specified the device that contains the drawing.
pageIndex
Specifies the index of the page to be drawn. This index is zero-based.
src
The coordinates for the source drawing area
srcClip
The coordinates for the source clipping drawing area
dest
The coordinates for the destination drawing area
destClip
The coordinates for the destination clipping drawing area
paintProperties
Gets or sets the RasterPaintProperties which control the display

Example

Visual BasicCopy Code
Public Sub DrawPageExample(ByVal graph As Graphics)
   ' Note that this is a sample key, which will not work in your toolkit
   RasterSupport.Unlock(Leadtools.RasterSupportType.Ocr, "TestKey")

   Dim rasterDocument As RasterDocumentEngine
   rasterDocument = RasterDocumentEngine.Instance
   rasterDocument.Startup()
   'assume page is added, refer to AddPage example for more information

   rasterDocument.ActivePage = 0
   Dim drawZoneOpts As RasterDocumentDrawZoneOptions = rasterDocument.DrawZoneOptions
   drawZoneOpts.Visible = True

   Dim zonePen As Pen = New Pen(System.Drawing.Color.Blue, 3)
   zonePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid

   Dim selZonePen As Pen = New Pen(System.Drawing.Color.Red, 3)
   selZonePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid

   drawZoneOpts.Pen = zonePen
   drawZoneOpts.SelectedPen = selZonePen
   drawZoneOpts.Offset = New Point(0, 0)
   drawZoneOpts.ZoomPercent = 100
   rasterDocument.DrawZoneOptions = drawZoneOpts

   Dim srcRect As Rectangle = New Rectangle(0, 0, rasterDocument.GetPageInfo(0).Size.Width, rasterDocument.GetPageInfo(0).Size.Height)
   Dim srcClipRect As Rectangle = New Rectangle(0, 0, 0, 0)
   Dim dstRect As Rectangle = New Rectangle(0, 0, rasterDocument.GetPageInfo(0).Size.Width, rasterDocument.GetPageInfo(0).Size.Height)
   Dim dstClipRect As Rectangle = New Rectangle(0, 0, 0, 0)

   rasterDocument.DrawPage(graph, 0, srcRect, srcClipRect, dstRect, dstClipRect, RasterPaintProperties.Default)
   rasterDocument.SelectZone(graph, 0, 0, True)

   rasterDocument.Shutdown()
End Sub
C#Copy Code
public void DrawPageExample(Graphics graph) 

   // Note that this is a sample key, which will not work in your toolkit 
   RasterSupport.Unlock(Leadtools.RasterSupportType.Ocr, "TestKey"); 
 
   RasterDocumentEngine rasterDocument; 
   rasterDocument = RasterDocumentEngine.Instance; 
   rasterDocument.Startup(); 
 
   // assume page is added, refer to AddPage example for more information 
 
   rasterDocument.ActivePage = 0; 
   RasterDocumentDrawZoneOptions drawZoneOpts = rasterDocument.DrawZoneOptions; 
   drawZoneOpts.Visible = true; 
 
   Pen zonePen = new Pen(System.Drawing.Color.Blue, 3); 
   zonePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid; 
 
   Pen selZonePen = new Pen(System.Drawing.Color.Red, 3); 
   selZonePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid; 
 
   drawZoneOpts.Pen = zonePen; 
   drawZoneOpts.SelectedPen = selZonePen; 
   drawZoneOpts.Offset = new Point(0, 0); 
   drawZoneOpts.ZoomPercent = 100; 
   rasterDocument.DrawZoneOptions = drawZoneOpts; 
 
   Rectangle srcRect = new Rectangle(0, 0, rasterDocument.GetPageInfo(0).Size.Width, rasterDocument.GetPageInfo(0).Size.Height); 
   Rectangle srcClipRect = new Rectangle(0, 0, 0, 0); 
   Rectangle dstRect = new Rectangle(0, 0, rasterDocument.GetPageInfo(0).Size.Width, rasterDocument.GetPageInfo(0).Size.Height); 
   Rectangle dstClipRect = new Rectangle(0, 0, 0, 0); 
 
   rasterDocument.DrawPage(graph, 0, srcRect, srcClipRect, dstRect, dstClipRect, RasterPaintProperties.Default); 
   rasterDocument.SelectZone(graph, 0, 0, true); 
   rasterDocument.Shutdown(); 
}

Remarks

Before calling this method, you must specify the active page to be drawn using the ActivePage property. If the ActivePage property is not set, then this method will fail.
For more information, refer to Drawing Pages and Zones.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Leadtools.Documentrequires a Document or Medical toolkit license and unlock key. For more information, refer to: Raster Pro/Document/Medical Features