vucko Posted July 1, 2003 Posted July 1, 2003 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�t work well as it did in an application written in C++(MFC). Things likes better when I use SetSyle but not quite good yet. I read that DrawImage use BitBlt in internally . Why DrawImage is slower then? What about hardware acceleration in GDI+ Quote
*Experts* mutant Posted July 1, 2003 *Experts* Posted July 1, 2003 GDI+ and GDI are not hardware accelerated, BitBlt is a little faster than DrawImage as some say so maybe you could try that. Quote
*Experts* Volte Posted July 1, 2003 *Experts* Posted July 1, 2003 DrawImage does not use BitBlt internally (at least I don't 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. You'll 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. There's information on declaring APIs in C# in the MSDN. Quote
*Experts* Volte Posted July 1, 2003 *Experts* Posted July 1, 2003 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 .NET's 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.