Adds a text to the Body of the current document
at a specific position on the current page, with auto height, and resolves it.
Namespace:
C1.C1PreviewAssembly: C1.C1Report.2 (in C1.C1Report.2.dll)
Syntax
C# |
---|
public void RenderDirectText( Unit x, Unit y, string text, Object width, Font font, Color textColor, AlignHorzEnum horzAlign ) |
Visual Basic |
---|
Public Sub RenderDirectText ( _ x As Unit, _ y As Unit, _ text As String, _ width As Object, _ font As Font, _ textColor As Color, _ horzAlign As AlignHorzEnum _ ) |
Parameters
- x
- Type: C1.C1Preview..::..Unit
The horizontal (X) coordinate at which to render the image (cannot be auto).
- y
- Type: C1.C1Preview..::..Unit
The vertical (Y) coordinate at which to render the image (cannot be auto).
- text
- Type: System..::..String
The string to render.
- width
- Type: System..::..Object
The width of the text area (if null, auto is used).
- font
- Type: System.Drawing..::..Font
The font to use.
- textColor
- Type: System.Drawing..::..Color
The text color.
- horzAlign
- Type: C1.C1Preview..::..AlignHorzEnum
The horizontal text alignment.
Remarks
This method can only be used between calls to StartDoc()()()() and EndDoc()()()() methods on the current document. For details, see RenderDirect(Unit, Unit, RenderObject, Object, Object).
Examples
The following code uses the RenderDirectText(Unit, Unit, String, Object, Font, Color, AlignHorzEnum) method to render the text to a specific position on the print document and then applies the font style, text color, and alignment of the text:
Copy CodeVisual Basic
Me.C1PrintDocument1.StartDoc() Me.C1PrintDocument1.RenderDirectText("2.5cm", "5cm", "Hello World", "100%", New Font("Arial", 12, FontStyle.Bold), Color.Black, C1.C1Preview.AlignHorzEnum.Center) Me.C1PrintDocument1.EndDoc() |
Copy CodeC#
this.c1PrintDocument1.StartDoc(); this.c1PrintDocument1.RenderDirectText("2.5cm", "5cm", "Hello World", "100%", new Font("Arial", 12, FontStyle.Bold), Color.Black, C1.C1Preview.AlignHorzEnum.Center); this.c1PrintDocument1.EndDoc(); |