A
Andrew
Hi,
I'm trying to blit small bitmaps onto a larger bitmap, and I've got a
few issues wrt positioning and output size.
I think my problems are due to DPI differences...
My small images are 72 DPI
My Large image (which i need to create in code) needs to be 300 DPI.
My code as it stands (with no accounting for dpi) is:
Bitmap bmp = new Bitmap(600, 600);
Graphics gfx = Graphics.FromImage(bmp);
Bitmap bmpTemp = new Bitmap(strPath);
gfx.DrawImage(bmpTemp, 0, 0);
pictureBox1.Image = bmp;
That works, but if i add the line:
bmp.SetResolution(300, 300);
the displayed image becomes massive. Is this because setting the
picturebox's image property with a bitmap object, does not take dpi into
account? If so, (or otherwise) how do i get the image to display correctly?
Also, the coordinates at which I place smaller image within the larger,
do not appear to take dpi into account. What adjustment do i need to
perform to place things in the correct place?
For example, If i place a 60x60 image at 0,0; and another 60x60 image at
60,60; the second overlaps the first
How do i correct this?
Thanks
Andrew
I'm trying to blit small bitmaps onto a larger bitmap, and I've got a
few issues wrt positioning and output size.
I think my problems are due to DPI differences...
My small images are 72 DPI
My Large image (which i need to create in code) needs to be 300 DPI.
My code as it stands (with no accounting for dpi) is:
Bitmap bmp = new Bitmap(600, 600);
Graphics gfx = Graphics.FromImage(bmp);
Bitmap bmpTemp = new Bitmap(strPath);
gfx.DrawImage(bmpTemp, 0, 0);
pictureBox1.Image = bmp;
That works, but if i add the line:
bmp.SetResolution(300, 300);
the displayed image becomes massive. Is this because setting the
picturebox's image property with a bitmap object, does not take dpi into
account? If so, (or otherwise) how do i get the image to display correctly?
Also, the coordinates at which I place smaller image within the larger,
do not appear to take dpi into account. What adjustment do i need to
perform to place things in the correct place?
For example, If i place a 60x60 image at 0,0; and another 60x60 image at
60,60; the second overlaps the first
How do i correct this?
Thanks
Andrew