scrolling a large bitmap

vucko

New member
Joined
Jun 27, 2003
Messages
4
Hi everybody
I have a little problem when I scroll a large bitmap (2000x2000px)in my C# application. I use AutoScroll = true (AutoScrollMinSize = Image.SIze) of the form as well as DrawImage method of Graphics object in overrided OnPaint method. But scrolling doesn
 
GDI+ and GDI are not hardware accelerated, BitBlt is a little faster than DrawImage as some say so maybe you could try that.
 
DrawImage does not use BitBlt internally (at least I dont think is does), although it does use the same basic functions that BitBlt does. GDI+ is slower than GDI32 in general, although it is much, much more flexible. If you are doing something as simple as painting an image onto a Form, using GDI32 (e.g. BitBlt) would do fine. Youll need to use P/Invoke to do it. P/Invoke (platform invoke) just means that you can call the unmanaged code in GDI32.DLL from your managed .NET app. Theres information on declaring APIs in C# in the MSDN.
 
There is no "problem"; the reason the GDI+ is slower than if you made the program in MFC is because MFC uses native Windows GDI32, rather than .NETs GDI+.

Since GDI32 is faster than GDI+ (for simple things, at very least), using P/Invoke to use the GDI32 APIs would be a good solution to speed up drawing. Look at this thread for information about that.
 
Back
Top