Ejemplo n.º 1
0
            /// <summary>
            /// Destroys the current buffer and creates a new buffered graphics
            /// sized to the client area of the owner control.
            /// </summary>
            internal bool RecreateBuffer()
            {
                if (creatingGraphics)
                {
                    return(false);
                }

                creatingGraphics = true;

                bufferContext = BufferedGraphicsManager.Current;

                if (disposed)
                {
                    throw (new ObjectDisposedException("bufferContext"));
                }

                int width  = System.Math.Max(mImageListView.Width, 1);
                int height = System.Math.Max(mImageListView.Height, 1);

                bufferContext.MaximumBuffer = new Size(width, height);

                if (bufferGraphics != null)
                {
                    bufferGraphics.Dispose();
                }
                bufferGraphics = bufferContext.Allocate(mImageListView.CreateGraphics(), new Rectangle(0, 0, width, height));

                creatingGraphics = false;

                InitializeGraphics(bufferGraphics.Graphics);

                return(true);
            }