Question

I have a method which get a XtraReport as Parameter. It should printing an infoarea on all Pages the Report got. How can i achieve this goal? It must be printed on DetailBand and the LabelText got Angle so i cant use PageInfo Control.

In fact the Problem is: How can i print a XRLabel on all ReportPages of a XtraReport Object. I tried this out but without success:

XRLabel druckinfo = new XRLabel();
druckinfo.Angle = 90F;
druckinfo.Padding = new PaddingInfo(2, 2, 0, 0, 96F);
druckinfo.SizeF = new SizeF(29.16666F, 500F);
druckinfo.Font = new Font(StyleVerwaltung.Instance.Schriftart,
    StyleVerwaltung.Instance.SchriftgroesseDruckInfo);
druckinfo.Text = text;
druckinfo.LocationF = new PointF(0F, 500F);

foreach (Band band in _Report.Bands)
{
    if (band is DetailBand)
    {
        band.Controls.Add(druckinfo);
    }
}
Was it helpful?

Solution

The DevExpress Support show me a way to solve my problem:

Image img = new Bitmap(300, 300);
Graphics g = Graphics.FromImage(img);
Font schriftart = new Font(StyleVerwaltung.Instance.Schriftart,
    StyleVerwaltung.Instance.SchriftgroesseDruckInfo);
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;

_Report.Watermark.ImageAlign = ContentAlignment.BottomLeft;
_Report.Watermark.ImageViewMode = ImageViewMode.Clip;
g.SmoothingMode = SmoothingMode.AntiAlias;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;

g.TranslateTransform(0, g.VisibleClipBounds.Size.Height);
g.RotateTransform(270f);
g.DrawString(text, schriftart, Brushes.Black,
    new Rectangle(0, 0, (int)g.VisibleClipBounds.Size.Width,
                        (int)g.VisibleClipBounds.Height),
    format);
g.ResetTransform();
g.Flush();

_Report.Watermark.Image = img;
_Report.Watermark.ShowBehind = true;

It uses the Watermark to accomplish this task. It just works if you dont use Watermark in other context but for my goal it works as expected.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top