Bitmaps on monochrome device throw ArgumentException

M

MountainJoy

In a C# application, I want to use a Bitmap loaded from a file, but the
Constructor "new Bitmap("filename.bmp")" keeps throwing an
ArgumentException, when using it on a device with monochrome display (1
bpp).
The exact same routine, used on the same device, but with color display
(8 bpp), works perfectly.
I tried loading the Bitmap in a native application, built with eVC4,
using the native API call "SHLoadDIBitmap", and it loads without
problems on both devices and can be displayed.
Unfortunately, I cannot use this function in C#, since it returns a
HBITMAP, which NETCF does not know of, and I have no idea as how to
wrap this in a Bitmap-derived class.

So, the bitmap file seems to be OK, and the display driver of the
terminal as well.
What remains, is that NETCF seems to have a problem with monochrome
displays with color depth 1 bpp.

Can anyone verify this, or even has a solution for the problem? Someone
from Microsoft, perhaps?

I am using Windows CE .NET 4.2 with NETCF 1.0 (v1.0.5000). CPU is an
ARM9.

Kind regards
Dirk
 
P

Paul G. Tobey [eMVP]

There just aren't that many monochrome devices out there. We have a mono
screen on one of our devices, but run it at 8bpp grayscale because there are
so many problems with trying to get real 1-bit color to work consistently
with higher color devices.

Paul T.
 
M

MountainJoy

Thanks, Paul.

I am afraid that you are right.
Neverteheless, after fiddling around a while with the fantastic
OpenNETCF library, and "digging a back door" into the C# Bitmap object,
I found out that obviously the Bitmap ctor on the color device
internally constructs a DIBSECTION whereas on the monochrom device it
constructs a BITMAP.
I am wondering if this is the root of the problem, because the CE API
does not support the "LoadBitmap" function, but it does support
"SHLoadDIBitmap".
Anyone out there having more information or a suggestion as to how the
Bitmap ctor can be forced to construct a DIBSECTION instead?

Thanks for your suggestions.

Kind regards
Dirk
 

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