Example #1
0
        //protected override void OnPaint(PaintEventArgs pe)
        //{
        //    //SolidBrush brush = new SolidBrush(_backColor);
        //   // pe.Graphics.FillRectangle(brush, this.ClientRectangle);
        //    using (Bitmap bufferimage = new Bitmap(this.Width, this.Height))
        //    {
        //        Graphics g = Graphics.FromImage(bufferimage);
        //        if (objList != null)
        //        {
        //            ObjList.Draw(g, this);
        //        }
        //        using (Graphics tg = pe.Graphics)
        //        {
        //            tg.DrawImage(bufferimage, 0, 0);  //把画布贴到画面上
        //        }
        //        g.Dispose();

        //    }
        //   // brush.Dispose();
        //    // Calling the base class OnPaint
        //    base.OnPaint(pe);
        //}
        private void VisualGraph_Paint(object sender, PaintEventArgs e)
        {
            SolidBrush brush = new SolidBrush(_backColor);

            e.Graphics.FillRectangle(brush, this.ClientRectangle);
            if (ShowGrid)
            {
                //   ControlPaint.DrawGrid(e.Graphics, this.ClientRectangle, gridSize, this.BackColor);
            }
            if (objList != null)
            {
                ObjList.Draw(e.Graphics, this);
            }

            brush.Dispose();
        }
Example #2
0
        private void VisualGraph_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.PageUnit  = GraphicsUnit.Pixel;
            e.Graphics.PageScale = M_Scalef;

            SolidBrush brush = new SolidBrush(_backColor);

            e.Graphics.FillRectangle(brush, this.ClientRectangle);
            if (ShowGrid)
            {
                ControlPaint.DrawGrid(e.Graphics, this.ClientRectangle, gridSize, this.BackColor);
            }
            if (objList != null)
            {
                ObjList.Draw(e.Graphics, this);
            }
            DrawSelectAll(e.Graphics);
            brush.Dispose();
        }
Example #3
0
 protected override void OnPaint(PaintEventArgs pe)
 {
     using (Bitmap bufferimage = new Bitmap(this.Width, this.Height))
     {
         Graphics   g     = Graphics.FromImage(bufferimage);
         SolidBrush brush = new SolidBrush(_backColor);
         g.FillRectangle(brush, this.ClientRectangle);
         brush.Dispose();
         if (objList != null)
         {
             ObjList.Draw(g, this);
         }
         using (Graphics tg = pe.Graphics)
         {
             tg.DrawImage(bufferimage, 0, 0);   //把画布贴到画面上
         }
         g.Dispose();
     }
     base.OnPaint(pe);
 }