Page 1 of 1

Simulate the "DEMO" text

Posted: Mon Jan 07, 2008 5:28 am
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.

Simulate the "DEMO" text

Posted: Mon Jan 07, 2008 5:51 am
by Brendan
Hi Fabio,

The Watermark and Watermark.Text property of a Page should allow you to do this

Simulate the "DEMO" text

Posted: Tue Jan 08, 2008 8:37 am
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.

Simulate the "DEMO" text

Posted: Tue Jan 08, 2008 9:37 am
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);
                    }
                }
            }
        }

Simulate the "DEMO" text

Posted: Tue Jan 08, 2008 9:47 am
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.

Simulate the "DEMO" text

Posted: Tue Jan 08, 2008 10:15 am
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.