Large bitmap and Win32 API

  • Thread starter Thread starter Ivan Vickovic
  • Start date Start date
I

Ivan Vickovic

I use BitBlt for scrolling a large bitmap (3200x2600)px but problem is
because HBITMAP takes too much memory.

After loading of images:
bmp = new Bitmap("c:\\Bitmaps\\3200x2600Gif.gif");

takes about 8Mb and after executing following line:
handleBitmap = bmp.GetHbitmap();

my application increase used memory for about 30Mb

How can I avoid this?

Note: When I open the same image in WebMatrix for example( because it is
written in c#) results are excellent: image takes about 8Mb and scrolling
works nice

Thanks
 
WebMatrix is probably using a basic trick to use GDI+ Bitmaps and not
BitBlt:

You can place a PictureBox with SizeMode set to AutoSize inside of a
scrollable control like a Panel and set AutoScroll to true. Hope this helps
you out. I've done this trick to get images to scroll a number of times.
 
I tried your trick and memory consuming is nice. It's grate. But scrolling
is too slow again. The main reason for using GDI API instead of GDI+ is
scrolling Another question about your trick: when scrolling memory
consumption rise to 20Mb and when scrolling ends it falls to 11Mb. WebMatrix
doesn't work that. Memory consumption is constant. This have me hope that
some improvements are possible. Any idea?

Thanks anyway Justin
 
Back
Top