Simulate the "DEMO" text
- Fabio Pagano
- Posts: 355
- Joined: Mon Apr 16, 2007 12:38 pm
- Location: Bari (Italy)
Simulate the "DEMO" text
I would like to simulate the "DEMO" text that you make appear in your demo version.
How can i do this?
Thanks.
How can i do this?
Thanks.
Simulate the "DEMO" text
Hi Fabio,
The Watermark and Watermark.Text property of a Page should allow you to do this
The Watermark and Watermark.Text property of a Page should allow you to do this
- Fabio Pagano
- Posts: 355
- Joined: Mon Apr 16, 2007 12:38 pm
- Location: Bari (Italy)
Simulate the "DEMO" text
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.
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
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);
}
}
}
}
- Fabio Pagano
- Posts: 355
- Joined: Mon Apr 16, 2007 12:38 pm
- Location: Bari (Italy)
Simulate the "DEMO" text
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):
Thanks.
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
Simulate the "DEMO" text
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.