You have obviously misunderstood the way LockBits works. Take a look at my
explanation and pay attention to the different layouts for the different
pixel formats. You will see that the full pixel depth is catered for.
It's unlikely your array will have the required stride so it will only be by
coincidence that you can copy the memory to the BitmapData buffer directly
as Nick suggests.
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
<ma*********@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Thank you all for your quick reply. I've tried the LockBit option
(using unsafe code anyway), but I've another problem:
to set a pixel value, I don't have enough space using a byte, because
I've three bytes for every pixel (R, G and B). How do I set a pixel
value on the bitmap then? Using one byte per pixel only allows me to
have a grayscale picture, and I need a color one.
Thank you again