Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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+

  • *Experts*
Posted
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.
  • *Experts*
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...