Hi,
We're displaying a logo in the right top corner of the report, but we can't find an alignment property.
Can you please advice?
Thanks.
We have closed this ticket because another page addresses its subject:
XRPictureBox - Provide the capability to specify image alignment
Hi,
I believe we've already discussed a similar issue: How specify XRPictureBox alignment. Please refer to the S134710 ticket and let us know if you need any clarification. We will be glad to help you.
Thanks,
Alex
Hi,
Ok … I thought that maybe there would be a better solution at this moment.
There is only one thing I can't really figure out.
How can I get the size of the image after it has been resized?
Thanks.
Hi,
Thank you for your response. As an alternative solution, use the PictureEdit control, as described in the XRPictureBox Alignment Property Existence ticket.
Thanks,
Alex
Hi,
This is my current solution, which works pretty good, except for the fact that I don't get the correct size estimates - a few pixels difference.
Can you please have a look and tell me where I am wrong?
private static void PictureBoxBeforePrint(object sender, PrintEventArgs e)
{
var pb = sender as XRPictureBox;
if (pb == null) return;
var anchor = pb.Tag as string;
if (string.IsNullOrWhiteSpace(anchor) == true) return;
var img = pb.Image;
if (img == null) return;
var parentSize = pb.SizeF;
var parentLocation = pb.LocationF;
// set XRPictureBox size to the image size
if (img.Width > parentSize.Width || img.Height > parentSize.Height)
{
// estimate image size
var wr = img.Width / (float)parentSize.Width;
var hr = img.Height / (float)parentSize.Height;
var r = Math.Max(wr, hr);
var size = new SizeF(img.Width / r, img.Height / r);
pb.SizeF = size;
}
else
{
var w = Math.Min(img.Width, parentSize.Width);
var h = Math.Min(img.Height, parentSize.Height);
pb.SizeF = new SizeF(w, h);
}
if (anchor.Contains("Left"))
pb.LeftF = parentLocation.X;
else if (anchor.Contains("Right"))
pb.LeftF = parentLocation.X + parentSize.Width - pb.SizeF.Width;
else if (anchor.Contains("Center"))
pb.LeftF = parentLocation.X + ((parentSize.Width - pb.SizeF.Width) / 2);
if (anchor.Contains("Top"))
pb.TopF = parentLocation.Y;
else if (anchor.Contains("Bottom"))
pb.TopF = parentLocation.Y + parentSize.Height- pb.SizeF.Height;
else if (anchor.Contains("Middle"))
pb.TopF = parentLocation.Y + ((parentSize.Height - pb.SizeF.Height) / 2);
}
Thanks.
Hi,
Please update your code and use the XRConvert.Convert method to convert pixel units to report units (see the SetSizing method in the sample project provided in the How specify XRPictureBox alignment ticket). This should resolve the issue.
Thanks,
Alex