Computers - PixelFormat

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello
I want to draw in a System.Drawing.Bitmap and then represent this bitmap with a
System.Windows.Forms.PictureBox. The PixelFormat of the bitmap should be compatibl
with the adjustment in the Computer-Control-Panel, because I think, that this guarantees best performance

In Non-DotNet-Software we have the Win32-API functions CreateCompatibleDC and
CreateCompatibleBitmap

With DotNet, how can I get the current pixel format of the computer, to create a compatible System.Drawing.Bitmap

The Win32-function GetDeviceCaps(HDC,BITSPIXELS) returns an integer, (16 for example), but with thi
information I can't distinguish between PixelFormat::Format16bppRgb555 and PixelFormat::Format16bppRgb565 for example

Michae
 
Hello Michael,

Thanks for your post.
create a compatible System.Drawing.Bitmap?

In .NET, you can use P/Invoke to call the unmanaged function. The following
article and its corresponding demonstrates using the CreateCompatibleDC and
CreateCompatibleBitmap from withing C#.

Flicker Free Drawing in C#
http://www.codeproject.com/csharp/flicker_free.asp?print=true

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top