ActiveReports.Viewer3 Request technical support
DrawText(String,RectangleF) Method
See Also  Example


strText
Text string to be drawn on the page.
text
Bounds of the text.
Draws the specified string within the specified bounds.

Syntax

Visual Basic (Declaration) 
Overloads Public Sub DrawText( _
   ByVal strText As String, _
   ByVal text As RectangleF _
) 
Visual Basic (Usage)Copy Code
Dim instance As Page
Dim strText As String
Dim text As RectangleF
 
instance.DrawText(strText, text)
C# 
public void DrawText( 
   string strText,
   RectangleF text
)

Parameters

strText
Text string to be drawn on the page.
text
Bounds of the text.

Example

C#Copy Code
private void arv_Load(object sender, System.EventArgs e)
{
   rptDocument rpt =
new rptDocument();
   rpt.Run();
   arv.Document=rpt.Document;

   System.Drawing.Font f =
new System.Drawing.Font("Times New Roman", 36);
   arv.Document.Pages[0].ForeColor = System.Drawing.Color.YellowGreen;
   arv.Document.Pages[0].Font = f;
   arv.Document.Pages[0].TextAlignment = DataDynamics.ActiveReports.TextAlignment.Center;
   arv.Document.Pages[0].TextAngle = 900;
   arv.Document.Pages[0].VerticalTextAlignment = DataDynamics.ActiveReports.VerticalTextAlignment.Middle;

   Single x = 1.0F;
   Single y = 1.0F;
   Single width = 6.5F;
   Single height = 9.0F;
   RectangleF drawRect =
new RectangleF(x,y,width,height);

   arv.Document.Pages[0].DrawText(
"Confidential", drawRect);
}
Visual BasicCopy Code
Private Sub arv_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles arv.Load
    Dim rpt As New rptDocument
    rpt.Run()
    arv.Document = rpt.Document

    Dim f As New System.Drawing.Font("Times New Roman", 36)
    Dim x As Single = 1.0F
    Dim y As Single = 1.0F
    Dim width As Single = 6.0F
    Dim height As Single = 9.0F
    Dim drawRect As New RectangleF(x, y, width, height)

    With arv.Document.Pages(0)
        .Font = f
        .ForeColor = System.Drawing.Color.YellowGreen
        .TextAlignment = DataDynamics.ActiveReports.TextAlignment.Center
        .TextAngle = 900
        .VerticalTextAlignment = DataDynamics.ActiveReports.VerticalTextAlignment.Middle
        .DrawText("Confidential", drawRect)
    End With
End Sub

Remarks

Uses the page's Font, ForeColor, BackColor, TextAlignment, TextAngle and VerticalTextAlignment properties to draw the string.

See Also