Ejemplo n.º 1
0
        private BufferedGraphics AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle)
        {
            BufferedGraphicsContext tempContext = null;
            BufferedGraphics        tempBuffer  = null;

            try {
                tempContext = new BufferedGraphicsContext();
                if (tempContext != null)
                {
                    tempBuffer = tempContext.AllocBuffer(targetGraphics, targetDC, targetRectangle);
                    tempBuffer.DisposeContext = true;
                }
            }
            finally {
                if (tempContext != null && (tempBuffer == null || (tempBuffer != null && !tempBuffer.DisposeContext)))
                {
                    tempContext.Dispose();
                }
            }

            return(tempBuffer);
        }
        private BufferedGraphics AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle)
        {
            BufferedGraphicsContext context  = null;
            BufferedGraphics        graphics = null;

            try
            {
                context = new BufferedGraphicsContext();
                if (context != null)
                {
                    graphics = context.AllocBuffer(targetGraphics, targetDC, targetRectangle);
                    graphics.DisposeContext = true;
                }
            }
            finally
            {
                if ((context != null) && ((graphics == null) || ((graphics != null) && !graphics.DisposeContext)))
                {
                    context.Dispose();
                }
            }
            return(graphics);
        }
 private BufferedGraphics AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle) {
     BufferedGraphicsContext tempContext = null;
     BufferedGraphics tempBuffer = null;
     
     try {
         tempContext = new BufferedGraphicsContext();
         if (tempContext != null) {                
             tempBuffer = tempContext.AllocBuffer(targetGraphics, targetDC, targetRectangle);
             tempBuffer.DisposeContext = true;
         }
     }
     finally {
         if (tempContext != null && (tempBuffer == null || (tempBuffer != null && !tempBuffer.DisposeContext))) {
             tempContext.Dispose();
         }
     }
         
     return tempBuffer;
 }
 private BufferedGraphics AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle)
 {
     BufferedGraphicsContext context = null;
     BufferedGraphics graphics = null;
     try
     {
         context = new BufferedGraphicsContext();
         if (context != null)
         {
             graphics = context.AllocBuffer(targetGraphics, targetDC, targetRectangle);
             graphics.DisposeContext = true;
         }
     }
     finally
     {
         if ((context != null) && ((graphics == null) || ((graphics != null) && !graphics.DisposeContext)))
         {
             context.Dispose();
         }
     }
     return graphics;
 }