Class Snippet
Base class of code snippets for testing.
public abstract class Snippet : FeatureAndSnippetBase
- Inheritance
-
Snippet
- Derived
- Inherited Members
Constructors
Snippet()
Initializes a new instance of the Snippet class.
protected Snippet()
Properties
BoxOption
Gets or sets the box option.
protected FeatureAndSnippetBase.BoxOptions BoxOption { get; set; }
Property Value
Cleanroom
Gets or sets a value indicating how this Snippet is drawn. If it is true, all describing graphics like title and boxes are omitted. Use this option to produce a clean PDF for debugging purposes. If it is false, all describing graphics like title and boxes are drawn. This is the regular case.
public bool Cleanroom { get; set; }
Property Value
FontHeader
Gets the header font in snippets.
public XFont FontHeader { get; }
Property Value
FontNameStd
The standard font name used in snippet.
public static string FontNameStd { get; }
Property Value
FontStd
Gets the standard font in snippets.
public XFont FontStd { get; }
Property Value
NoGraphic
Gets or sets a value indicating whether all graphics output is omitted.
public bool NoGraphic { get; set; }
Property Value
NoText
Gets or sets a value indicating whether all text output is omitted.
public bool NoText { get; set; }
Property Value
PathName
Gets or sets the path or name where to store the PDF file.
public string PathName { get; set; }
Property Value
Pentagram
Gets the points of a pentagram in a unit circle.
protected static XPoint[] Pentagram { get; }
Property Value
- XPoint[]
RectBox
Gets the rectangle of a box.
protected static XRect RectBox { get; }
Property Value
Title
Gets or sets the title of the snipped
public string Title { get; set; }
Property Value
Methods
BeginBox(XGraphics, int)
Begins rendering the content of a box.
protected void BeginBox(XGraphics gfx, int boxNumber)
Parameters
BeginBox(XGraphics, int, BoxOptions)
Begins rendering the content of a box.
protected void BeginBox(XGraphics gfx, int boxNumber, FeatureAndSnippetBase.BoxOptions options)
Parameters
gfx
XGraphicsThe XGraphics object.
boxNumber
intThe box number.
options
FeatureAndSnippetBase.BoxOptionsThe box options.
BeginBox(XGraphics, int, BoxOptions, string?)
Translates origin of coordinate space to a box of size 220pp x 140pp.
protected void BeginBox(XGraphics gfx, int n, FeatureAndSnippetBase.BoxOptions options, string? description)
Parameters
gfx
XGraphicsn
intoptions
FeatureAndSnippetBase.BoxOptionsdescription
string
CreatePdfPage(PdfDocument)
Creates a PDF page for the specified document.
public PdfPage CreatePdfPage(PdfDocument doc)
Parameters
doc
PdfDocumentThe document.
Returns
DrawAlignmentGrid(XGraphics, bool, bool)
Draws the alignment grid.
protected static void DrawAlignmentGrid(XGraphics gfx, bool highlightHorizontal = false, bool highlightVertical = false)
Parameters
gfx
XGraphicsThe XGraphics object.
highlightHorizontal
boolif set to
true
[highlight horizontal].highlightVertical
boolif set to
true
[highlight vertical].
DrawArtBox(XGraphics)
Draws a dotted line showing the art box.
protected void DrawArtBox(XGraphics gfx)
Parameters
gfx
XGraphicsThe XGraphics object.
DrawCenterPoint(XGraphics)
Draws the center point of a box.
protected static void DrawCenterPoint(XGraphics gfx)
Parameters
gfx
XGraphicsThe XGraphics object.
DrawHeader(XGraphics, string)
Draws the header.
public void DrawHeader(XGraphics gfx, string renderTarget)
Parameters
DrawHeader(string)
Draws the header.
public void DrawHeader(string renderTarget)
Parameters
renderTarget
string
DrawNotSupportedFeature(XGraphics)
Draws a text that states that a feature is not supported in a particular build.
protected void DrawNotSupportedFeature(XGraphics gfx)
Parameters
gfx
XGraphics
DrawPdfHeader()
Draws the header for a PDF document.
public void DrawPdfHeader()
DrawPngHeader()
Draws the header for a PNG image.
public void DrawPngHeader()
DrawTiledBox(XGraphics, double, double, double, double, double)
Draws a tiled box.
protected void DrawTiledBox(XGraphics gfx, double x, double y, double width, double height, double delta)
Parameters
gfx
XGraphicsThe XGraphics object.
x
doubleThe left position of the box.
y
doubleThe top position of the box.
width
doubleThe width of the box.
height
doubleThe height of the box.
delta
doubleThe size of the grid square.
EndBox(XGraphics)
Ends rendering of the current box.
protected void EndBox(XGraphics gfx)
Parameters
gfx
XGraphicsThe XGraphics object.
GetPentagram(double, XPoint)
Gets the points of a pentagram relative to a center and scaled by a size factor.
protected static XPoint[] GetPentagram(double size, XPoint center)
Parameters
Returns
- XPoint[]
GfxForLastPage(PdfDocument)
Gets a XGraphics object for the last page of the specified document.
public static XGraphics GfxForLastPage(PdfDocument doc)
Parameters
doc
PdfDocumentThe PDF document.
Returns
HelloWorldFactory(string?, bool)
Creates a HelloWorld document, optionally with custom message.
public static PdfDocument HelloWorldFactory(string? message = null, bool unicode = false)
Parameters
Returns
RenderSnippet()
When implemented in a derived class renders the snippet in an XGraphic object.
public void RenderSnippet()
RenderSnippet(XGraphics)
When implemented in a derived class renders the snippet in the specified XGraphic object.
public abstract void RenderSnippet(XGraphics gfx)
Parameters
gfx
XGraphicsThe XGraphics where to render the snippet.
RenderSnippetAsPdf()
Renders a snippet as PDF document.
public void RenderSnippetAsPdf()
RenderSnippetAsPdf(XUnit, XUnit, XGraphicsUnit, XPageDirection)
Renders a snippet as PDF document.
public void RenderSnippetAsPdf(XUnit width, XUnit height, XGraphicsUnit graphicsUnit, XPageDirection pageDirection)
Parameters
width
XUnitheight
XUnitgraphicsUnit
XGraphicsUnitpageDirection
XPageDirection
RenderSnippetAsPng()
Renders a snippet as PNG image.
public void RenderSnippetAsPng()