Printing tiny controls, when painting

Joined
Feb 10, 2006
Messages
1
Reaction score
0
Hi,

I have a problem in printing, when I paint a control. It displays properly in screen. But when I am printing, the control appears tiny. I am using the following code block:
private void PaintCtrl(Control ctrl, Graphics graphics, RectangleF rectF)
{
Bitmap bitmap = null;
PictureBox pic = ctrl as PictureBox;
if (pic != null)
{
if (pic.Image != null)
{
bitmap = pic.Image as Bitmap;
}
}
if (bitmap == null)
{
bitmap = new Bitmap(ctrl .Width, ctrl .Height);
win32.CaptureWindow(ctrl , ref bitmap);
}

// Make the rectF the size of the bitmap.
PointF[] points =
{ new PointF(rectF.Location.X, rectF.Location.Y) };
graphics.TransformPoints(
CoordinateSpace.Device, CoordinateSpace.Page, points);
points[0].X += bitmap.Width;
points[0].Y += bitmap.Height;
graphics.TransformPoints(
CoordinateSpace.Page, CoordinateSpace.Device, points);
RectangleF bMapRect = new RectangleF(rectF.Location, rectF.Size);
bMapRect.Height = points[0].Y - rectF.Top;
bMapRect.Width = points[0].X - rectF.Left;

graphics.DrawImage(bitmap, bMapRect);
}


Can any one help me to fix it? Thanks in advance!

jjohn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top