p_davis
asked on
Control to bitmap
i have a control that i am drawing to a bitmap. The problem that i am having is scaling the bitmap to a certain size. No matter what i have tried, after the control is drawn to the bitmap i cannot scale it down. When i view the bitmap in paint or window picture/fax viewer it isn't scaled, it is the original control drawn to bitmap size.
the factor variable is about .75 and is calculated in another method.
i have also tried the Graphics.DrawImage with the destination rectangle equally what it would be if the .75 scaling was applied in the scaletransform. the drawimage does scale it down but it draws over the original control.drawtobitmap so i have both and the bitmap is still the same height.
the factor variable is about .75 and is calculated in another method.
i have also tried the Graphics.DrawImage with the destination rectangle equally what it would be if the .75 scaling was applied in the scaletransform. the drawimage does scale it down but it draws over the original control.drawtobitmap so i have both and the bitmap is still the same height.
Control s = (Control)control;
Bitmap bmp = new Bitmap((Image)new Bitmap(1, 1), control.Size);
s.DrawToBitmap(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
Graphics g = Graphics.FromImage(bmp);
g.ScaleTransform(1F,(float)factor);
g.SmoothingMode = SmoothingMode.HighQuality;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.CompositingQuality = CompositingQuality.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
bmp.Save(path + "myBitmap.Bmp", ImageFormat.Bmp);
g.Dispose();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER