Class PrintOutNet
This is the base class for all Report processing drivers working in Reportman.Drawing space, that is print to printer, preview on screen or exporting to bitmap, provides basic functionality to measure texts, bitmaps and shapes, but still not work with printers (System.Drawing.Printing) or printer dialogs (Windows Forms). So it's a step forward to the implementation of some Report processing drivers, useful for preview, becuase it can use bitmap as output Variant
Implements
Inherited Members
Namespace: Reportman.Drawing
Assembly: Reportman.Drawing.Windows.dll
Syntax
public class PrintOutNet : PrintOut, IDisposable
Constructors
PrintOutNet()
Constructor and initialization of graphics objects required for the driver
Declaration
public PrintOutNet()
Fields
HardMarginX
This variables can be used as an offset, this is used by print preview to represent the non-printable area of the page
Declaration
protected int HardMarginX
Field Value
| Type | Description |
|---|---|
| int |
HardMarginY
This variables can be used as an offset, this is used by print preview to represent the non-printable area of the page
Declaration
protected int HardMarginY
Field Value
| Type | Description |
|---|---|
| int |
OptimizeWMF
Optimization selection. Variant
Declaration
public WMFOptimization OptimizeWMF
Field Value
| Type | Description |
|---|---|
| WMFOptimization |
Output
The output in this driver is a bitmap, the output can be used to preview or convert it to serve in a web application
Declaration
public Bitmap Output
Field Value
| Type | Description |
|---|---|
| Bitmap |
Scale
This property allows scaling, usefull for drawing a preview inside a sized bitmap
Declaration
public float Scale
Field Value
| Type | Description |
|---|---|
| float |
UseHardMargin
Because HardMargins are non-printable area, when printing to the device with this limitation, the offsets must be disabled
Declaration
protected bool UseHardMargin
Field Value
| Type | Description |
|---|---|
| bool |
Methods
Dispose()
Free memory consumed by graphics resources
Declaration
public override void Dispose()
Overrides
DrawObject(Graphics, MetaPage, MetaObject)
Draws an object, into a Graphics surface
Declaration
public void DrawObject(Graphics graph, MetaPage page, MetaObject obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Graphics | graph | The grapchis surface |
| MetaPage | page | The MetaFilePage that contains the object |
| MetaObject | obj | The object to be drawn |
DrawPage(MetaFile, MetaPage)
Draws all the objects inside a page to the Bitmap Output
Declaration
public override void DrawPage(MetaFile meta, MetaPage page)
Parameters
| Type | Name | Description |
|---|---|---|
| MetaFile | meta | MetaFile containing the page |
| MetaPage | page | MetaFilePage to be drawn into Output |
Overrides
DrawString(Graphics, string, Font, Brush, Rectangle, StringFormat)
Declaration
public virtual void DrawString(Graphics gr, string atext, Font font, Brush brush, Rectangle arec, StringFormat sformat)
Parameters
| Type | Name | Description |
|---|---|---|
| Graphics | gr | |
| string | atext | |
| Font | font | |
| Brush | brush | |
| Rectangle | arec | |
| StringFormat | sformat |
DrawString(Graphics, string, Font, Brush, float, float, StringFormat)
Declaration
public virtual void DrawString(Graphics gr, string atext, Font font, Brush brush, float posx, float posy, StringFormat sformat)
Parameters
| Type | Name | Description |
|---|---|---|
| Graphics | gr | |
| string | atext | |
| Font | font | |
| Brush | brush | |
| float | posx | |
| float | posy | |
| StringFormat | sformat |
FontFromObject(MetaPage, MetaObjectText)
Create a Font object from a MetaObjectText structure
Declaration
public Font FontFromObject(MetaPage page, MetaObjectText obj)
Parameters
| Type | Name | Description |
|---|---|---|
| MetaPage | page | MetaFilePage |
| MetaObjectText | obj | MetaObjectText, containing information to create the font |
Returns
| Type | Description |
|---|---|
| Font | A Font object, created with parameter information |
FontFromStruct(TextObjectStruct)
Create a Font object from a TextObjectStruct structure
Declaration
public Font FontFromStruct(TextObjectStruct objt)
Parameters
| Type | Name | Description |
|---|---|---|
| TextObjectStruct | objt | TextObjectStruct structure with text parameters like font name, size and style |
Returns
| Type | Description |
|---|---|
| Font | Returns a Font object created from parameter information |
GetPageSize(out int)
Obtain current page size and also an index to the PageSizeArray
Declaration
public override Point GetPageSize(out int indexqt)
Parameters
| Type | Name | Description |
|---|---|---|
| int | indexqt | Output parameter, it will be filled with the index inside the PageSizeArray |
Returns
| Type | Description |
|---|---|
| Point | Returns the size of the page in twips |
Overrides
GraphicExtent(MemoryStream, Point, int)
Calculate graphic extent using System.Drawing, the stream must be a valid bitmap
Declaration
public override Point GraphicExtent(MemoryStream astream, Point extent, int dpi)
Parameters
| Type | Name | Description |
|---|---|---|
| MemoryStream | astream | Memory stream containing a valid bitmap |
| Point | extent | Initial extent in twips of the drawing box) |
| int | dpi | Dots per inch, resolution of the bitmap |
Returns
| Type | Description |
|---|---|
| Point | Final size of the bitmap in twips |
Overrides
IntAlignToStringFormat(int, bool, bool, bool)
Generate Stringformat from align properties
Declaration
public static StringFormat IntAlignToStringFormat(int Alignment, bool CutText, bool WordWrap, bool RightToLeft)
Parameters
| Type | Name | Description |
|---|---|---|
| int | Alignment | |
| bool | CutText | |
| bool | WordWrap | |
| bool | RightToLeft |
Returns
| Type | Description |
|---|---|
| StringFormat |
MeasureString(Graphics, string, Font, SizeF, StringFormat, out int, out int)
Declaration
public virtual SizeF MeasureString(Graphics gr, string atext, Font font, SizeF layoutarea, StringFormat sformat, out int charsfit, out int linesfit)
Parameters
| Type | Name | Description |
|---|---|---|
| Graphics | gr | |
| string | atext | |
| Font | font | |
| SizeF | layoutarea | |
| StringFormat | sformat | |
| int | charsfit | |
| int | linesfit |
Returns
| Type | Description |
|---|---|
| SizeF |
MetStructToStringFormat(TextObjectStruct)
Generates a StringFormat from formatting information at TextObjectStruct structure
Declaration
public static StringFormat MetStructToStringFormat(TextObjectStruct obj)
Parameters
| Type | Name | Description |
|---|---|---|
| TextObjectStruct | obj | TextObjectStruct structure containint CutText,WordWrap and Alignment |
Returns
| Type | Description |
|---|---|
| StringFormat | Returns a StringFormat usable in any System.Drawing function |
MetaObjectToStringFormat(MetaObjectText)
Generates a StringFormat from formatting information at MetaObjectText structure
Declaration
public StringFormat MetaObjectToStringFormat(MetaObjectText obj)
Parameters
| Type | Name | Description |
|---|---|---|
| MetaObjectText | obj | MetaObjectText structure containint CutText,WordWrap and Alignment |
Returns
| Type | Description |
|---|---|
| StringFormat | Returns a StringFormat usable in any System.Drawing function |
SetPageSize(PageSizeDetail)
Set page size
Declaration
public override Point SetPageSize(PageSizeDetail psize)
Parameters
| Type | Name | Description |
|---|---|---|
| PageSizeDetail | psize | Customized page size description |
Returns
| Type | Description |
|---|---|
| Point | Returns the size in twips of the page |
Overrides
TextExtent(TextObjectStruct, Point)
Calculate text size, font rotation is ignored
Declaration
public override Point TextExtent(TextObjectStruct aobj, Point extent)
Parameters
| Type | Name | Description |
|---|---|---|
| TextObjectStruct | aobj | Structure containing text properties like font, size and style |
| Point | extent | Text box in twips where the text will be drawn |
Returns
| Type | Description |
|---|---|
| Point | Returns the extent in twips of the text, it can be larger than the input extent |
Overrides
TextRectJustify(Graphics, Rectangle, TextObjectStruct, Font, SolidBrush)
Draws the text full justified
Declaration
protected void TextRectJustify(Graphics gr, Rectangle arect, TextObjectStruct atext, Font nfont, SolidBrush sbrush)
Parameters
| Type | Name | Description |
|---|---|---|
| Graphics | gr | |
| Rectangle | arect | |
| TextObjectStruct | atext | |
| Font | nfont | |
| SolidBrush | sbrush |