Jump to content
Xtreme .Net Talk

andolsson

Members
  • Posts

    1
  • Joined

  • Last visited

andolsson's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi, I am constructing a usercontrol that displays a zoomed part of an image. The user can grab the image and zoom to different parts, Adobe Acrobat-style. I call e.Graphics.DrawImage, in OnPaint(e), to draw the zoomed piece of the bitmap onto the control. This is currently the bottleneck of my app. I am experimenting with letting DirectDraw to the blitting instead, but cannot get it to work fast enough without flickering - it seems that the built-in double buffering for Surfaces in DirectDraw is only available in full-screen mode. Does anyone know of a way to circumvent/fix this? I've tried public void Draw(Graphics g, Rectangle sourceRect) { System.IntPtr ptrHdc = g.GetHdc(); _surfaceBitmap.DrawToDc(ptrHdc, this.ClientRectangle, sourceRect); g.ReleaseHdc(ptrHdc); } and enabling the DoubleBuffering Style for the control. This works and does not produce any flicker, but results in compression artifacts in the image when zooming out beyond a certain level, and is really not faster than e.Graphics.DrawImage at all! Any tips or tricks? Regards AndreasO
×
×
  • Create New...