Esempio n. 1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (Controller?.MatrixModel != null)
            {
                using (Graphics g = e.Graphics) // FIXME - is using necessary ?
                {
                    _hLayout.Clear();
                    _vLayout.Clear();

                    using (Bitmap image = new Bitmap(ViewRectangle.Width, ViewRectangle.Height))
                    {
                        using (Graphics g1 = Graphics.FromImage(image))
                        {
                            g1.Clip = new Region(ViewRectangle);

                            try
                            {
                                Draw(g1);
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.StackTrace);
                            }
                            g.DrawImageUnscaled(image, 0, 0);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            if (Controller?.MatrixModel != null)
            {
                using (Graphics g = e.Graphics)
                {
                    _layout.Clear();

                    using (Bitmap image = new Bitmap(ViewRectangle.Width, ViewRectangle.Height))
                    {
                        using (Graphics g1 = Graphics.FromImage(image))
                        {
                            g1.Clip = new Region(ViewRectangle);

                            Draw(g1);

                            g.DrawImageUnscaled(image, 0, 0); //already clipped
                        }
                    }
                }
            }
        }