Simulate the "DEMO" text

Stimulsoft Reports.NET discussion
Post Reply
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Simulate the "DEMO" text

Post by Fabio Pagano »

I would like to simulate the "DEMO" text that you make appear in your demo version.

How can i do this?

Thanks.
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

Simulate the "DEMO" text

Post by Brendan »

Hi Fabio,

The Watermark and Watermark.Text property of a Page should allow you to do this
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Simulate the "DEMO" text

Post by Fabio Pagano »

Thanks.

I need to set the Watermark.Text on a report compiled but not rendered yet.

Alternatively i need to set the Watermark.Text on a loaded template.

Thanks.
EDV Gradl
Posts: 228
Joined: Sat Jun 17, 2006 9:50 am
Location: Germany

Simulate the "DEMO" text

Post by EDV Gradl »

Something like this?

Code: Select all

StiPage.PagePainted += new Stimulsoft.Report.Events.StiPagePaintEventHandler(DrawCopyright);
StiPage.PagePainting += new Stimulsoft.Report.Events.StiPagePaintEventHandler(DrawCopyright);

private void DrawCopyright(StiPage sender, Stimulsoft.Report.Events.StiPagePaintEventArgs e)
        {
            if (!e.IsDesigning)
            {
                StiPage page = sender as StiPage;
                Rectangle rect = e.FullRectangle;
                using (Font font = new Font("Arial", 20 * (float)page.Zoom))
                {
                    using (StringFormat sf = new StringFormat())
                    {
                        sf.Alignment = StringAlignment.Center;
                        sf.LineAlignment = StringAlignment.Center;
                        e.Graphics.DrawString("(c) 2006/2007 Demo EDV Gradl Berlin", font, Brushes.Red, rect, sf);
                    }
                }
            }
        }
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Simulate the "DEMO" text

Post by Fabio Pagano »

Thanks. I've noticed that you don't use Watermark property but use DrawString directly.

Actually i'm not able to manage report events, so i'm trying the following way (after loading template and before compiling and rendering) and seems to work (test in progress):

Code: Select all

For Each page As Stimulsoft.Report.Components.StiPage In Report.Pages
      page.Watermark.Text = "D E M O"

      'The following lines adjust the font to make appear 
      'the full string so that it occupies the full space available.
      '(Code taken from another thread)

      Dim text As New Stimulsoft.Report.Components.StiText
      text.ClientRectangle = page.ClientRectangle
      text.Text.Value = page.Watermark.Text
      text.Angle = page.Watermark.Angle
      text.Page = page
      text.Font = New System.Drawing.Font(page.Watermark.Font.FontFamily, 1020)
      page.Watermark.Font = text.GetActualFont(page.Watermark.Text)
Next
Thanks.
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

Simulate the "DEMO" text

Post by Brendan »

Fabio wrote:Thanks.

I need to set the Watermark.Text on a report compiled but not rendered yet.

Alternatively i need to set the Watermark.Text on a loaded template.

Thanks.

If your report is already compiled you can just use the report.CompiledReport.Pages.Watermark.Text property instead.
Post Reply