public override void PaintBuffer() { IntPtr destDC; if (targetGraphics != null) { destDC = targetGraphics.GetHdc(); } else { destDC = targetDC; } try { int rop = 0xcc0020; // RasterOp.SOURCE.GetRop(); SafeNativeMethods.BitBlt(new HandleRef(targetGraphics, destDC), targetX, targetY, virtualWidth, virtualHeight, new HandleRef(this, compatDC), 0, 0, rop); } finally { if (targetGraphics != null) { targetGraphics.ReleaseHdcInternal(destDC); } } }