Image display : a problem of size ?

Jan 31 2008 4:08 AM

Hello,

I wish to display a bitmap image in a windows; I specify its size. I don't obtain a single image, but 4 times the same image in my windows, and those images are one quarter the size i want them to be. (I want a 2000 * 2000 sized image, and I have four 500*500 sized images, displayed on the same line, not even filling up my windows). I can't find why this happen, has anyone an idea ?

TIA

here is my code :

Bitmap bmp = new Bitmap(2000, 2000);

// Lock the bitmap's bits.

Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);

System.Drawing.Imaging.BitmapData bmpData = bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, bmp.PixelFormat);

// Get the address of the first line.

IntPtr ptr = bmpData.Scan0;

// Declare an array to hold the bytes of the bitmap.

// This code is specific to a bitmap with 24 bits per pixels.

int bytes = bmp.Width * bmp.Height;

// Copy the RGB values back to the bitmap

System.Runtime.InteropServices.Marshal.Copy(myObject.Image, 0, ptr, bytes);

// Unlock the bits.

bmp.UnlockBits(bmpData);

m_dlgMyObject.ShowPicture(bmp);

public void ShowPicture(Bitmap pict)

{

if (myObjectPBx.Image != null)

myObjectPBx.Image.Dispose();

myObjectPBx.Image = pict;

myObjectPBx.Refresh();

}