Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //g = this.CreateGraphics();
            //BufferBitmap = new Bitmap(Properties.Resources.豌豆射手,this.Width, this.Height);
            BufferedGraphicsContext = BufferedGraphicsManager.Current;
            BufferedGraphics        = BufferedGraphicsContext.Allocate(this.CreateGraphics(), this.ClientRectangle);
            //BufferedGraphics.Graphics.FillRectangle(new SolidBrush(Color.Transparent), this.ClientRectangle);
            //BufferBitmap.MakeTransparent(Color.Black);
            g = BufferedGraphics.Graphics;

            shooterbitmap = new Bitmap[12];
            timer         = new System.Timers.Timer(300);
            for (int i = 0; i <= 11; i++)
            {
                shooterbitmap[i] = new Bitmap(@".\bitmaps\Peashooter\" + i.ToString() + ".Png");
                //shooterbitmap[i].MakeTransparent(Color.Black);
            }
        }
Beispiel #2
0
 /// <inheritdoc />
 /// <summary>
 ///     Initializes a new instance of the <see cref="T:VisualPlus.Toolkit.Controls.Interactivity.VisualRating" />
 ///     class.
 /// </summary>
 public VisualRating()
 {
     SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
     _bufferedContext = BufferedGraphicsManager.Current;
     _toggleHalfStar  = true;
     _maximum         = 5;
     _mouseOverIndex  = -1;
     _ratingType      = StarType.Thick;
     _starBrush       = new SolidBrush(Color.Yellow);
     _starDullStroke  = new Pen(Color.Gray, 3f);
     _starDullBrush   = new SolidBrush(Color.Silver);
     _starSpacing     = 1;
     _starStroke      = new Pen(Color.Gold, 3f);
     _starWidth       = 25;
     SetPenBrushDefaults();
     Size = new Size(200, 100);
     UpdateGraphicsBuffer();
 }
Beispiel #3
0
        public static void Init(Form form)
        {
            Graphics g;

            _context = BufferedGraphicsManager.Current;
            g        = form.CreateGraphics();
            Width    = form.ClientSize.Width;
            Height   = form.ClientSize.Height;

            Buffer = _context.Allocate(g, new Rectangle(0, 0, Width, Height));
            Load();
            Timer timer = new Timer {
                Interval = 100
            };

            timer.Start();
            timer.Tick += Timer_Tick;
        }
Beispiel #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            GameView       = new View();
            GameController = new Controller(this, GameView);
            int   form1_width  = this.Width;
            int   form1_height = this.Height;
            Point btnStartPosition;
            Point btnPausePosition;

            GameView.setForm(out form1_width, out form1_height, out btnStartPosition, out btnPausePosition);
            this.Width         = form1_width;
            this.Height        = form1_height;
            btn_start.Location = btnStartPosition;
            btn_pause.Location = btnPausePosition;

            bufferedGraphicsContext = BufferedGraphicsManager.Current;
            g = bufferedGraphicsContext.Allocate(pictureBox1.CreateGraphics(), pictureBox1.DisplayRectangle);
        }
Beispiel #5
0
        /// <summary>
        /// Метод инициализирует игровое пространство, вызывает метод наполнения объектов,
        /// запускает таймер игры
        /// </summary>
        /// <param name="form">Базовая форма игры</param>
        public static void Init(Form form)
        {
            context = BufferedGraphicsManager.Current;
            var graficSurface = form.CreateGraphics();

            GameWindowWidth             = form.ClientSize.Width;
            GameWindowHeight            = form.ClientSize.Height;
            graficSurface.SmoothingMode = SmoothingMode.HighQuality;
            buffer = context.Allocate(graficSurface, new Rectangle(0, 0, GameWindowWidth, GameWindowHeight));

            Load();
            var timer = new Timer {
                Interval = 150
            };

            timer.Start();
            timer.Tick += Timer_Tick;
        }
        /// <summary>
        /// Update all View components
        /// </summary>
        public void Update()
        {
            // Double Buffered Drawing Initialized
            BufferedGraphicsContext currentBufferedGraphicsContext = BufferedGraphicsManager.Current;
            BufferedGraphics        bufferedGraphics = currentBufferedGraphicsContext.Allocate(_drawingGraphics, _wigetSize);
            Graphics drawingGrphics = bufferedGraphics.Graphics;

            // Draw background
            // drawingGrphics.FillRectangle(new SolidBrush(Color.White), _wigetSize);
            // Draw all views
            foreach (var viewComponent in _allViews)
            {
                viewComponent.Paint(drawingGrphics);
            }
            // Render the composed screen and Dispose the Buffer
            bufferedGraphics.Render();
            bufferedGraphics.Dispose();
        }
Beispiel #7
0
 public SequencePanel()
 {
     _indexRow             = 1;
     _zoom                 = 1.0f;
     _glyphHash            = new Dictionary <Glyph, object>(100);
     textBox.KeyDown      += OnEditKeyDown;
     context               = BufferedGraphicsManager.Current;
     context.MaximumBuffer = new Size(Width + 1, Height + 1);
     _timer                = new Timer();
     _timer.Interval       = 200;
     _timer.Tick          += OnProperty;
     _toolTip              = new ToolTip((IContainer) new System.ComponentModel.Container( ));
     _toolTip.AutoPopDelay = 5000;
     _toolTip.InitialDelay = 1000;
     _toolTip.ReshowDelay  = 250;
     _toolTip.ShowAlways   = true;
     _toolTip.IsBalloon    = true;
 }
Beispiel #8
0
        public View()
        {
            InitializeComponent();

            model.Images[0] = Properties.Resources.Bush.GetThumbnailImage(23, 23, null, IntPtr.Zero);
            model.Images[1] = Properties.Resources.Grass.GetThumbnailImage(23, 23, null, IntPtr.Zero);
            model.Images[2] = Properties.Resources.box.GetThumbnailImage(25, 25, null, IntPtr.Zero);
            model.Images[3] = Properties.Resources.tree2.GetThumbnailImage(32, 32, null, IntPtr.Zero);
            model.Images[4] = Properties.Resources.marker.GetThumbnailImage(23, 12, null, IntPtr.Zero);
            model.Images[5] = Properties.Resources.marker2.GetThumbnailImage(23, 12, null, IntPtr.Zero);

            graphics = map.CreateGraphics();
            bufferedGraphicsContext = new BufferedGraphicsContext();
            bufferedGraphics        = bufferedGraphicsContext.Allocate(graphics, new Rectangle(0, 0, map.Width, map.Height));
            bufferedGraphics.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            timerPaint.Start();
        }
        private void UpdateBackBuffer()
        {
            if (this.Width > 0 && this.Height > 0)
            {
                BufferedGraphicsContext bufContext = BufferedGraphicsManager.Current;
                bufContext.MaximumBuffer = new Size(this.Width + 1, this.Height + 1);
                _bufGraphics             = bufContext.Allocate(this.CreateGraphics(), this.ClientRectangle);

                if (OptimizeForTransparency)
                {
                    DecreaseGraphicsQuality();
                }
                else
                {
                    IncreaseGraphicsQuality();
                }
            }
        }
        /// <summary>Initializes a new instance of the <see cref="VisualProgressIndicator" /> class.</summary>
        public VisualProgressIndicator()
        {
            SetStyle(ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);

            graphicsContext = BufferedGraphicsManager.Current;
            diameter        = 7.5F;
            circleSize      = new Size(15, 15);
            circles         = 45F;
            baseColor       = new SolidBrush(Color.DarkGray);
            animationSpeed  = new Timer();
            animationColor  = new SolidBrush(Color.DimGray);

            Size        = new Size(80, 80);
            MinimumSize = new Size(0, 0);
            SetPoints();
            animationSpeed.Interval = 100;
            UpdateStyles();
        }
Beispiel #11
0
        protected virtual void initializeGraphics()
        {
            Graphics         graphics;
            BufferedGraphics buffer;

            graphics = CreateGraphics();
            graphics.FillRectangle(SystemBrushes.Control, graphics.VisibleClipBounds);

            context = BufferedGraphicsManager.Current;
            context.MaximumBuffer = new Size(Width + 1, Height + 1);

            buffer = context.Allocate(graphics, new Rectangle(0, 0, Width, Height));
            buffer.Graphics.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            buffer.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

            this.graphics = graphics;
            this.buffer   = buffer;
        }
Beispiel #12
0
        public RingSlider()
        {
            this.Resize += DoubleBufferControl_Resize;
            InitializeComponent();
            mRingForePen = new Pen(this.ForeColor, mRingWidth);
            mRingBackPen = new Pen(this.RingBackColor, mRingWidth);
            mBackBrush   = new SolidBrush(this.BackColor);
            mTextBrush   = new SolidBrush(this.TextColor);


            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
            this.DoubleBuffered          = false;
            Application.ApplicationExit += MemoryCleanup;
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            mGraphicManager = BufferedGraphicsManager.Current;
            mGraphicManager.MaximumBuffer = new Size(this.Width, this.Height);
            mManagedBackBuffer            = mGraphicManager.Allocate(this.CreateGraphics(), ClientRectangle);
        }
Beispiel #13
0
        /// <summary>
        /// Override OnTemplateListDrawItem to supply an off-screen buffer to event
        /// handlers.
        /// </summary>
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            BufferedGraphicsContext currentContext = BufferedGraphicsManager.Current;

            Rectangle newBounds = new Rectangle(0, 0, e.Bounds.Width, e.Bounds.Height);

            using (BufferedGraphics bufferedGraphics = currentContext.Allocate(e.Graphics, newBounds))
            {
                DrawItemEventArgs newArgs = new DrawItemEventArgs(
                    bufferedGraphics.Graphics, e.Font, newBounds, e.Index, e.State, e.ForeColor, e.BackColor);

                // Supply the real OnTemplateListDrawItem with the off-screen graphics context
                base.OnDrawItem(newArgs);

                // Wrapper around BitBlt
                GDI.CopyGraphics(e.Graphics, e.Bounds, bufferedGraphics.Graphics, new Point(0, 0));
            }
        }
Beispiel #14
0
        private void Cube_show_Paint(object sender, PaintEventArgs e)
        {
            if (paintCube.bInit)
            {
                Rectangle rect = e.ClipRectangle;
                BufferedGraphicsContext currentContext = BufferedGraphicsManager.Current;
                BufferedGraphics        myBuffer       = currentContext.Allocate(e.Graphics, e.ClipRectangle);
                Graphics g = myBuffer.Graphics;
                g.SmoothingMode   = SmoothingMode.HighQuality;
                g.PixelOffsetMode = PixelOffsetMode.HighSpeed;
                g.Clear(BackColor);
                paintCube.Paint(cube_show.Width, g);
                myBuffer.Render(e.Graphics);
                g.Dispose();

                myBuffer.Dispose();                //释放资源
            }
        }
Beispiel #15
0
        private void Form1_Load(object sender, EventArgs e)
        {
            XY_BackBitmap  = new Bitmap(pictureBox2.Width, pictureBox2.Height);
            XY_FrontBitmap = new Bitmap(pictureBox2.Width, pictureBox2.Height);

            XY_Context = BufferedGraphicsManager.Current;
            XY_Context.MaximumBuffer = new Size(pictureBox2.Width, pictureBox2.Height);
            XY_Graphics = pictureBox2.CreateGraphics();
            XY_Grafx    = XY_Context.Allocate(pictureBox2.CreateGraphics(), new Rectangle(0, 0, pictureBox2.Width, pictureBox2.Height));
            XY_Grafx.Graphics.Clear(Color.DarkGray);


            XY_BackBufferGraphics = Graphics.FromImage(XY_BackBitmap);
            XY_BackBufferGraphics.Clear(Color.DarkGray);

            XY_FrontBufferGraphics = Graphics.FromImage(XY_FrontBitmap);
            XY_FrontBufferGraphics.Clear(Color.DarkGray);
        }
        public static void Initialize(Form form)
        {
            //запоминаем размер формы
            Width  = form.ClientSize.Width;
            Height = form.ClientSize.Height;

            contex = BufferedGraphicsManager.Current;  // Предоставляет доступ к главному буферу графического контекста для текущего приложения
            Graphics graphics = form.CreateGraphics(); // Создаем объект (поверхность рисования) и связываем его с формой

            // Связываем буфер в памяти с графическим объектом, чтобы рисовать в буфере
            buffer = contex.Allocate(graphics, new Rectangle(0, 0, Width, Height));
            Load();//Выполняем загрузку обьектов
            timer = new Timer {
                Interval = 100
            };                        //Добавляем таймер, задаём интервал для вызова события
            timer.Tick += Timer_Tick; //Создаём событие для таймера
            timer.Start();
        }
Beispiel #17
0
        public B10432008(TetrisController controller)
        {
            InitializeComponent();

            //get畫布
            graphics = this.CreateGraphics();

            //塗白底
            graphics.Clear(Color.WhiteSmoke);

            //double buffer
            m_CurrentContext = BufferedGraphicsManager.Current;
            m_Graphics       = m_CurrentContext.Allocate(this.CreateGraphics(), this.DisplayRectangle);

            drawBackGround();
            this.controller = controller;
            //this.model = model;
        }
Beispiel #18
0
        /// <summary>
        /// Инициализация и обновление графического буфера
        /// </summary>
        public static void Init(Form form)
        {
            Load();
            form.KeyDown  += Form_KeyDown;
            timer.Interval = 30;
            timer.Start();
            timer.Tick      += Timer_Tick;
            Ship.MessageDie += Finish;

            Graphics g;

            _context          = BufferedGraphicsManager.Current;
            g                 = form.CreateGraphics();
            Width             = form.Width;
            Height            = form.Height;
            Buffer            = _context.Allocate(g, new Rectangle(0, 0, Width, Height));
            form.FormClosing += delegate { BestScore(); };
        }
        //FIXME: THIS OVERRIDE OF MAIN FORM MIGHT NOT BE NEEDED AND PROBABLY CAN BE DELETED
        public MainForm(string path)
        {
            InitializeComponent();

            DrawingTextPanel.DragEnter += new DragEventHandler(DrawingTextPanel_DragEnter);
            DrawingTextPanel.DragDrop  += new DragEventHandler(DrawingTextPanel_DragDrop);


            textDoc.AddText(txt);
            fileNameWithFullPath = path;
            //used for buffering
            bufferContext = new BufferedGraphicsContext();
            bufferContext.MaximumBuffer = this.ClientRectangle.Size;

            saveToolStripMenuItem.Enabled = false;

            openTextFile(fileNameWithFullPath);
        }
Beispiel #20
0
        public UserGrid()
        {
            InitializeComponent();

            mContext = BufferedGraphicsManager.Current;
            mContext.MaximumBuffer = new Size(Width + 1, Height + 1);

            this.SetStyle(ControlStyles.SupportsTransparentBackColor |
                          ControlStyles.Opaque, true);
            this.BackColor = Color.Transparent;

            mInfo.Add("Realtime");
            mInfo.Add("Intelligent");
            mInfo.Add("Visualization");
            mInfo.Add("Multiple terminals");
            mInfo.Add("Script Supported");
            mInfo.Add("High Performance");
        }
Beispiel #21
0
        //static Game()
        //{
        //
        //}

        public static void Initialize(Form form)
        {
            Width  = form.Width;
            Height = form.Height;


            __Context = BufferedGraphicsManager.Current;
            Graphics g = form.CreateGraphics();

            __Buffer = __Context.Allocate(g, new Rectangle(0, 0, Width, Height));

            var timer = new Timer {
                Interval = __FrameTimeout
            };

            timer.Tick += OnTimerTick;
            timer.Start();
        }
Beispiel #22
0
        private void RenderGraphics(List <Point> cells)
        {
            using (Graphics gridGraphics = PanGrid.CreateGraphics())
            {
                using (BufferedGraphicsContext bgc = new BufferedGraphicsContext())
                {
                    using (BufferedGraphics bg = bgc.Allocate(gridGraphics, PanGrid.ClientRectangle))
                    {
                        RenderCells(cells, bg);
                        RenderGrid(bg);

                        bg.Render(gridGraphics);
                    }
                }
            }

            OnRender?.Invoke(_cells.Count);
        }
Beispiel #23
0
        public FormXGIS()
        {
            InitializeComponent();
            this.SetStyle(
                System.Windows.Forms.ControlStyles.UserPaint |
                System.Windows.Forms.ControlStyles.AllPaintingInWmPaint |
                System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer,
                true);

            backWindow = BufferedGraphicsManager.Current;

            view = new XView(
                new XExtent(
                    new XVertex(0, 0),
                    new XVertex(1, 1)),
                this.ClientRectangle
                );
        }
Beispiel #24
0
        public B10432028(TetrisController controller)
        {
            sTimer.Tick += new EventHandler(sTimer_Tick);
            InitializeComponent();

            //建立畫布
            graphics = this.CreateGraphics();

            //畫布塗白底
            graphics.Clear(Color.White);

            //double buffer
            m_CurrentContext = BufferedGraphicsManager.Current;
            m_Graphics       = m_CurrentContext.Allocate(this.CreateGraphics(), this.DisplayRectangle);

            drawBackGround();
            this.controller = controller;
        }
Beispiel #25
0
        public static void Init(Form form)
        {
            // Графическое устройство для вывода графики
            Graphics g;

            // Предоставляет доступ к главному буферу графического контекста для текущего приложения
            __context = BufferedGraphicsManager.Current;
            g         = form.CreateGraphics();
            // Создаем объект (поверхность рисования) и связываем его с формой
            // Запоминаем размеры формы,
            Width  = form.ClientSize.Width;
            Height = form.ClientSize.Height;
            // Связываем буфер в памяти с графическим объектом, чтобы рисовать в буфере
            __buffer = __context.Allocate(g, new Rectangle(0, 0, Width, Height));
            Load();
            __timer.Start();
            __timer.Tick += Timer_Tick;
        }
Beispiel #26
0
 internal void Release()
 {
     if (Graphics != null)
     {
         Graphics.Dispose();
     }
     if (Surface != null)
     {
         Surface.Dispose();
     }
     if (Context != null)
     {
         Context.Dispose();
     }
     Graphics = null;
     Surface  = null;
     Context  = null;
 }
Beispiel #27
0
        private void BattleForm_Paint(object sender, PaintEventArgs e)
        {
            BufferedGraphicsContext currentContext = BufferedGraphicsManager.Current;
            BufferedGraphics        myBuffer       = currentContext.Allocate(e.Graphics, e.ClipRectangle);
            Graphics g = myBuffer.Graphics;

            g.Clear(this.BackColor);

            g.DrawImage(Properties.Resources.background1, 0, 0, Properties.Resources.background1.Width, Properties.Resources.background1.Height);
            GameFacade.Insance.UpdateRender(g);
            if (isBuild)
            {
                g.DrawImage(currentMap, currentPt);
            }
            myBuffer.Render(e.Graphics);  //呈现图像至关联的Graphics
            myBuffer.Dispose();
            g.Dispose();
        }
        public static void Init(Form form)
        {
            Graphics g = form.CreateGraphics();

            _context             = BufferedGraphicsManager.Current;
            Width                = form.ClientSize.Width;
            Height               = form.ClientSize.Height;
            form.BackgroundImage = Resources.background;
            Buffer               = _context.Allocate(g, new Rectangle(0, 0, Width, Height));

            Load();

            Timer timer = new Timer();

            timer.Interval = 60;
            timer.Tick    += OnTime;
            timer.Start();
        }
Beispiel #29
0
        /*
         * Paint a cell using the progression data
         */
        private void ProgressCellPaint(object sender, DataGridViewCellPaintingEventArgs e)
        {
            if (e.ColumnIndex <= 0 || e.RowIndex < -1)
            {
                e.Handled = false;
                return;
            }

            if (ProgressionData != null)
            {
                if (e.RowIndex == -1)
                {
                    e.PaintBackground(e.CellBounds, false);
                    DrawScale(ProgressionData.StartTime, AgentApplication.Options.VisualiserZoomLevel, e.Graphics, e.CellBounds);
                }
                else
                {
                    string      Machine            = ( string )VisualiserGridView.Rows[e.RowIndex].Cells[0].Value;
                    Progression MachineProgression = null;
                    if (ProgressionData.MachineProgressions.TryGetValue(Machine, out MachineProgression))
                    {
                        BufferedGraphicsContext Current   = BufferedGraphicsManager.Current;
                        BufferedGraphics        Offscreen = Current.Allocate(e.Graphics, e.CellBounds);

                        // Fill the background dependent on whether the machine has finished or not
                        MachineProgression.DrawBackground(Offscreen.Graphics, e.CellBounds);

                        // Draw all the progress bars to the offscreen buffer
                        MachineProgression.Draw(ProgressionData.StartTime, AgentApplication.Options.VisualiserZoomLevel, Offscreen.Graphics, e.CellBounds);

                        // Copy the offscreen buffer to the screen
                        Offscreen.Render();
                        Offscreen.Dispose();
                    }
                }
            }
            else
            {
                // Just clear if there's no progression data
                e.PaintBackground(e.CellBounds, false);
            }

            e.Handled = true;
        }
            public NATIVE_CONSOLE_CONFIG(string sWindowTitle, int iWindowWidthPx, int iWindowHeightPx, bool blApplyOnDemand) : base(sWindowTitle, iWindowWidthPx, iWindowHeightPx)
            {
                if (mnccEmptyConfig == null)
                {
                    mnccEmptyConfig = new NATIVE_CONSOLE_CONFIG( );
                }
                msWindowTitle = sWindowTitle;

                miWindowWidthPx  = iWindowWidthPx;
                miWindowHeightPx = iWindowHeightPx;

                if (mopProcess == null)
                {
                    mopProcess = Process.GetCurrentProcess( );
                }
                if (mogGraphics == null)
                {
                    mogGraphics = Graphics.FromHdc(STR_ConsoleSupport.NATIVE_METHODS.GetDC(mopProcess.MainWindowHandle));
                }
                Console.CursorVisible = false;

                if (mobgcContext == null)
                {
                    mobgcContext = BufferedGraphicsManager.Current;
                }

                this.WindowWidthColumns = Convert.ToInt32(( float )Math.Floor(( decimal )(Console.LargestWindowWidth * (iWindowWidthPx / 1920f))));
                this.WindowHeightRows   = Convert.ToInt32(( float )Math.Floor(( decimal )(Console.LargestWindowHeight * (iWindowHeightPx / 1080f))));

                if (blApplyOnDemand)
                {
                    if (mnccCurrentConfig != null)
                    {
                        miLastWindowWidthColumns = mnccCurrentConfig.WindowWidthColumns;
                        miLastWindowHeightRows   = mnccCurrentConfig.WindowHeightRows;
                        mnccLastConfig           = mnccCurrentConfig;
                    }
                    this.Apply( );
                }
                else
                {
                    mnccCurrentConfig = null;
                }
            }
Beispiel #31
0
            public DrawManager(Game game_m)
            {
                game = game_m;
                formGraphics = game.gameForm.CreateGraphics();
                game.gameForm.Resize += gameForm_Resize;

                Console.WriteLine(formGraphics.DpiX+"   "+formGraphics.DpiY);

                view = new View(20, 20, 1920, 1080);
                context = BufferedGraphicsManager.Current;

                context.MaximumBuffer = new Size((int)view.width + 1, (int)view.height + 1);

                grafx = context.Allocate(formGraphics, new Rectangle(0, 0, game.gameForm.Width, game.gameForm.Height));
                drawBrush = new SolidBrush(Color.Black);
                font = new System.Drawing.Font("Arial", 16);
                watch = new Stopwatch();
                watch.Start();
                fps = 0.0;
                last = 0;
            }
            public void Dispose()
            {
                if (SourceControlObject != null)
                {
                    SourceControlObject.Resize -= new EventHandler(this.OnSourceControlResize);
                    SourceControlObject.Paint -= new PaintEventHandler(this.OnSourceControlPaint);
                    SourceControlObject = null;
                }

                if (GraphicsObject != null)
                {
                    GraphicsObject.Dispose();
                    GraphicsObject = null;
                }

                if (GraphicsContextObject != null)
                {
                    GraphicsContextObject.Dispose();
                    GraphicsContextObject = null;
                }
            }
            private void VerifyGraphicsContext()
            {
                if (SourceControlObject != null)
                {
                    int ClientWidth = (SourceControlObject.ClientSize.Width + 1);
                    int ClientHeight = (SourceControlObject.ClientSize.Height + 1);
                    bool RebuildObjectsFlag = true;

                    if ((GraphicsContextObject != null) && (GraphicsObject != null))
                    {
                        if ((GraphicsContextObject.MaximumBuffer.Width == ClientWidth)
                        && (GraphicsContextObject.MaximumBuffer.Height == ClientHeight))
                        {
                            RebuildObjectsFlag = false;
                        }
                    }

                    if (RebuildObjectsFlag == true)
                    {
                        if (GraphicsObject != null)
                        {
                            GraphicsObject.Dispose();
                            GraphicsObject = null;
                        }

                        if (GraphicsContextObject != null)
                        {
                            GraphicsContextObject.Dispose();
                            GraphicsContextObject = null;
                        }

                        if ((ClientWidth > 1) && (ClientHeight > 1))
                        {
                            GraphicsContextObject = new BufferedGraphicsContext();
                            GraphicsContextObject.MaximumBuffer = new Size(ClientWidth, ClientHeight);

                            Graphics ControlGraphicsObject = SourceControlObject.CreateGraphics();

                            GraphicsObject = GraphicsContextObject.Allocate(ControlGraphicsObject, SourceControlObject.ClientRectangle);
                            GraphicsObject.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                            GraphicsObject.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                        }
                    }
                }
            }
		static BufferedGraphicsManager ()
		{
			graphics_context = new BufferedGraphicsContext ();
		}