示例#1
0
        private void IconListRow_Paint(object sender, PaintEventArgs e)
        {
            m_dbgMemGraphics.g.TextRenderingHint = TextRenderingHint.AntiAlias;
            m_dbgMemGraphics.g.SmoothingMode     = SmoothingMode.AntiAlias;

            if (bSelected)
            {
                for (int i = 0; i < this.Height; i++)
                {
                    m_pGradientPen.Color = m_acGradientColors[i];
                    m_dbgMemGraphics.g.DrawLine(m_pGradientPen, 0, i, this.Width, i);
                }
            }
            else
            {
                m_dbgMemGraphics.g.FillRectangle(BackBrush, -1, -1, this.Width + 1, this.Height + 1);
            }

            if (pIcon != null)
            {
                m_dbgMemGraphics.g.DrawImage((Image)pIcon, (m_iTextLeft / 2) - (pIcon.Width / 2), (this.Height / 2) - (pIcon.Height / 2), pIcon.Width, pIcon.Height);
                m_dbgMemGraphics.g.DrawString(SizeLbl.Text, pFont, m_sbTextBrush, m_iTextLeft, ((this.Height / 2) - (SizeLbl.Height / 2)) - 1);
            }
            else
            {
                m_dbgMemGraphics.g.DrawString(SizeLbl.Text, pFont, m_sbTextBrush, ((this.Width / 2) - (SizeLbl.Width / 2)) + 3, ((this.Height / 2) - (SizeLbl.Height / 2)) - 1);
            }

            //memGraphics.g.DrawLine(new Pen(Color.White), 0, this.Height - 1, this.Width, this.Height - 1);
            m_dbgMemGraphics.g.DrawLine(m_pnSeparatorPen, 0, this.Height - 1, this.Width, this.Height - 1);

            m_dbgMemGraphics.Render(e.Graphics);
        }
示例#2
0
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            SolidBrush brush = new SolidBrush(Color.Gray);

            if (memGraphics.CanDoubleBuffer())
            {
                // Fill in Background (for effieciency only the area that has been clipped)
                memGraphics.g.FillRectangle(new SolidBrush(SystemColors.Window),
                                            e.ClipRectangle.X, e.ClipRectangle.Y,
                                            e.ClipRectangle.Width, e.ClipRectangle.Height);

                // Do our drawing using memGraphics.g instead e.Graphics

                memGraphics.g.FillRectangle(brush, this.ClientRectangle);

                if (myPane != null)
                {
                    myPane.Draw(memGraphics.g);
                }

                // Render to the form
                memGraphics.Render(e.Graphics);
            }
            else                // if double buffer is not available, do without it
            {
                e.Graphics.FillRectangle(brush, this.ClientRectangle);
                if (myPane != null)
                {
                    myPane.Draw(e.Graphics);
                }
            }
        }
        private void VerticalScrollHandle_Paint(object sender, PaintEventArgs e)
        {
            memGraphics.g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            FindDiameter();

            //Gradient.DrawGradient(memGraphics.g, Gradient.GradientDirection.Horizontal, BackgroundGradientStart, BackgroundGradientFinish, this.Width, this.Height);
            memGraphics.g.DrawImage((Image)m_bgImage, 0, 0);

            //draw gradient
            float RadiusSquared = (float)Math.Pow(Radius - 1, 2);
            float HalfWidth     = (float)(this.Width - 2) / 2.0f;
            float ChordWidth;

            for (double i = 0; i < this.Width; i++)
            {
                ChordWidth        = (float)Math.Sqrt(RadiusSquared - Math.Pow(HalfWidth - i, 2));
                GradientPen.Color = GradientColors[(int)i];
                memGraphics.g.DrawLine(GradientPen, (float)i + 1, Radius - ChordWidth, (float)i + 1, this.Height - ((Radius - ChordWidth) + 2));
            }

            //draw visible border
            memGraphics.g.DrawArc(BorderPen, 1, 1, Diameter - 2, Diameter - 2, 0, -180);
            memGraphics.g.DrawArc(BorderPen, 1, this.Height - (Diameter + 1), Diameter - 2, Diameter - 2, 0, 180);
            memGraphics.g.DrawLine(BorderPen, 1, Radius, 1, this.Height - (Radius + 2));
            memGraphics.g.DrawLine(BorderPen, this.Width - 2, Radius + 2, this.Width - 2, this.Height - (Radius + 2));

            memGraphics.Render(e.Graphics);
            CreateDoubleBuffer();
        }
        private void OptionButton_Paint(object sender, PaintEventArgs e)
        {
            memGraphics.g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            memGraphics.g.TextRenderingHint = TextRenderingHint.AntiAlias;

            float RadiusSquared = (float)Math.Pow(Radius - 1, 2);
            float HalfHeight    = (float)(this.Height - 2) / 2.0f;
            float ChordWidth;

            for (double i = 0; i < this.Height; i++)
            {
                ChordWidth        = (float)Math.Sqrt(RadiusSquared - Math.Pow(HalfHeight - i, 2));
                GradientPen.Color = GradientColors[(int)i];
                memGraphics.g.DrawLine(GradientPen, Radius - ChordWidth, (float)i + 1, Radius + ChordWidth, (float)i + 1);
            }

            //Border
            memGraphics.g.DrawEllipse(BorderPen, 0, 0, Diameter - 1, Diameter - 1);

            if (pChecked)
            {
                memGraphics.g.FillEllipse(new SolidBrush(Color.Black), ((CIRCLEDIM / 2) - (CHECKED_CIRCLEDIM / 2)) - 1, ((CIRCLEDIM / 2) - (CHECKED_CIRCLEDIM / 2)) - 1, CHECKED_CIRCLEDIM, CHECKED_CIRCLEDIM);
            }

            memGraphics.g.DrawString(pText, pFont, TextBrush, Diameter + 5, -2);

            memGraphics.Render(e.Graphics);
            CreateDoubleBuffer();
        }
        private void SimpleListRow_Paint(object sender, PaintEventArgs e)
        {
            memGraphics.g.SmoothingMode     = SmoothingMode.AntiAlias;
            memGraphics.g.TextRenderingHint = TextRenderingHint.AntiAlias;

            memGraphics.g.FillRectangle(new SolidBrush(this.BackColor), 0, 0, this.Width, this.Height);
            memGraphics.g.DrawString(SizeLbl.Text, pFont, TextBrush, 3, (this.Height / 2) - (SizeLbl.Height / 2));

            memGraphics.Render(e.Graphics);
            CreateDoubleBuffer();
        }
示例#6
0
        private void CheckBox_Paint(object sender, PaintEventArgs e)
        {
            float RadiusSquared = (float)Math.Pow(Radius, 2);
            float ChordWidth;
            float Height = (float)this.Height - 1;

            memGraphics.g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            memGraphics.g.TextRenderingHint = TextRenderingHint.AntiAlias;

            for (double i = 0; i < this.Height; i++)
            {
                if (i <= Radius)
                {
                    ChordWidth = (float)Math.Sqrt(RadiusSquared - Math.Pow(Radius - i, 2));
                }
                else if ((Height - i) <= Radius)
                {
                    ChordWidth = (float)Math.Sqrt(RadiusSquared - Math.Pow(i - (Height - Radius), 2));
                }
                else
                {
                    ChordWidth = Radius;
                }

                GradientPen.Color = GradientColors[(int)i];
                memGraphics.g.DrawLine(GradientPen, Radius - ChordWidth, (float)i, BOXDIM - ((Radius - ChordWidth) + 1), (float)i);
            }

            //rounded corners
            memGraphics.g.DrawArc(BorderPen, 0, 0, Diameter, Diameter, -90, -90);
            memGraphics.g.DrawArc(BorderPen, BOXDIM - Diameter, 0, Diameter, Diameter, -90, 90);
            memGraphics.g.DrawArc(BorderPen, 0, BOXDIM - (Diameter + 1), Diameter, Diameter, 90, 90);
            memGraphics.g.DrawArc(BorderPen, BOXDIM - Diameter, BOXDIM - (Diameter + 1), Diameter, Diameter, 90, -90);

            //border lines
            memGraphics.g.DrawLine(BorderPen, Radius, 0, BOXDIM - Radius, 0);
            memGraphics.g.DrawLine(BorderPen, Radius, this.Height - 1, BOXDIM - Radius, this.Height - 1); //bottom
            memGraphics.g.DrawLine(BorderPen, 0, Radius, 0, this.Height - (Radius + 1));
            memGraphics.g.DrawLine(BorderPen, BOXDIM, Radius, BOXDIM, this.Height - (Radius + 1));

            if (pChecked)
            {
                memGraphics.g.DrawLine(CheckPen, 2, 2, BOXDIM - 2, BOXDIM - 3);
                memGraphics.g.DrawLine(CheckPen, BOXDIM - 2, 2, 2, BOXDIM - 3);
                //memGraphics.g.DrawLine(CheckPen, 2, BOXDIM / 3, BOXDIM / 2, BOXDIM - 3);
                //memGraphics.g.DrawLine(CheckPen, BOXDIM / 2, BOXDIM - 3, BOXDIM + 2, 0);
            }

            memGraphics.g.DrawString(pText, pFont, TextBrush, BOXDIM + 5, -2);

            memGraphics.Render(e.Graphics);
            CreateDoubleBuffer();
        }
示例#7
0
        private void SmoothToggleSwitch_Paint(object sender, PaintEventArgs e)
        {
            float RadiusSquared = (float)Math.Pow(Radius, 2);
            float ChordWidth;
            float Height = (float)this.Height - 1;
            int   Offset = 0;

            memGraphics.g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            memGraphics.g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

            CurGradient = UpperGradient;

            for (double i = 0; i < this.Height; i++)
            {
                if (i <= Radius)
                {
                    ChordWidth = (float)Math.Sqrt(RadiusSquared - Math.Pow(Radius - i, 2));
                }
                else if ((Height - i) <= Radius)
                {
                    ChordWidth = (float)Math.Sqrt(RadiusSquared - Math.Pow(i - (Height - Radius), 2));
                }
                else
                {
                    ChordWidth = Radius;
                }

                if (i >= UPPER_GRADIENT_HEIGHT)
                {
                    CurGradient = LowerGradient;
                    Offset      = UPPER_GRADIENT_HEIGHT;
                }

                GradientPen.Color = CurGradient[(int)i - Offset];
                memGraphics.g.DrawLine(GradientPen, Radius - ChordWidth, (float)i, this.Width - ((Radius - ChordWidth) + 1), (float)i);
            }

            //rounded corners
            memGraphics.g.DrawArc(BorderPen, 0, 0, Diameter, Diameter, -90, -90);                                                     //top left
            memGraphics.g.DrawArc(BorderPen, this.Width - (Diameter + 1), 0, Diameter, Diameter, -90, 90);                            //top right
            memGraphics.g.DrawArc(BorderPen, 0, this.Height - (Diameter + 1), Diameter, Diameter, 90, 90);                            //bottom left
            memGraphics.g.DrawArc(BorderPen, this.Width - (Diameter + 1), this.Height - (Diameter + 1), Diameter, Diameter, 90, -90); //bottom right

            //border lines
            memGraphics.g.DrawLine(BorderPen, Radius, 0, this.Width - Radius, 0);                             //top
            memGraphics.g.DrawLine(BorderPen, Radius, this.Height - 1, this.Width - Radius, this.Height - 1); //bottom
            memGraphics.g.DrawLine(BorderPen, 0, Radius, 0, this.Height - (Radius + 1));                      //left
            memGraphics.g.DrawLine(BorderPen, this.Width - 1, Radius, this.Width - 1, this.Height - (Radius + 1));

            memGraphics.Render(e.Graphics);
            CreateDoubleBuffer();
        }
示例#8
0
        private void SmoothToggle_Paint(object sender, PaintEventArgs e)
        {
            float RadiusSquared = (float)Math.Pow(Radius, 2);
            float ChordWidth;
            float Height = (float)this.Height - 1;

            memGraphics.g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            memGraphics.g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

            for (double i = 0; i < this.Height; i++)
            {
                if (i <= Radius)
                {
                    ChordWidth = (float)Math.Sqrt(RadiusSquared - Math.Pow(Radius - i, 2));
                }
                else if ((Height - i) <= Radius)
                {
                    ChordWidth = (float)Math.Sqrt(RadiusSquared - Math.Pow(i - (Height - Radius), 2));
                }
                else
                {
                    ChordWidth = Radius;
                }

                GradientPen.Color = GradientColors[(int)i];
                memGraphics.g.DrawLine(GradientPen, Radius - ChordWidth, (float)i, this.Width - ((Radius - ChordWidth) + 1), (float)i);
            }

            //rounded corners
            memGraphics.g.DrawArc(BorderPen, 0, 0, Diameter, Diameter, -90, -90);                                                     //top left
            memGraphics.g.DrawArc(BorderPen, this.Width - (Diameter + 1), 0, Diameter, Diameter, -90, 90);                            //top right
            memGraphics.g.DrawArc(BorderPen, 0, this.Height - (Diameter + 1), Diameter, Diameter, 90, 90);                            //bottom left
            memGraphics.g.DrawArc(BorderPen, this.Width - (Diameter + 1), this.Height - (Diameter + 1), Diameter, Diameter, 90, -90); //bottom right

            //border lines
            memGraphics.g.DrawLine(BorderPen, Radius, 0, this.Width - Radius, 0);                             //top
            memGraphics.g.DrawLine(BorderPen, Radius, this.Height - 1, this.Width - Radius, this.Height - 1); //bottom
            memGraphics.g.DrawLine(BorderPen, 0, Radius, 0, this.Height - (Radius + 1));                      //left
            memGraphics.g.DrawLine(BorderPen, this.Width - 1, Radius, this.Width - 1, this.Height - (Radius + 1));

            if (pIcon != null)
            {
                memGraphics.g.DrawImage((Image)pIcon, (this.Width / 2) - (pIcon.Width / 2), (this.Height / 2) - (pIcon.Height / 2));
            }

            memGraphics.Render(e.Graphics);
            CreateDoubleBuffer();
        }
示例#9
0
        private void pb_graphics_Paint(object sender, PaintEventArgs e)
        {
            memGraphics.g.Clear(Color.Transparent);
            if (velocidade1 > 50 && distancia1 <= distanciaFinal)
            {
                memGraphics.g.DrawImage(arcoiris[spriteCounterArcoIris], rato_branco.X - 10, rato_branco.Y + 20, 60, 30);
            }
            memGraphics.g.DrawImage(Properties.Resources.Rato_branco, rato_branco.X, rato_branco.Y, 120, 130);

            if (velocidade2 > 50 && distancia2 <= distanciaFinal)
            {
                memGraphics.g.DrawImage(arcoiris[spriteCounterArcoIris], rato_preto.X - 10, rato_preto.Y + 90, 60, 30);
            }
            memGraphics.g.DrawImage(Properties.Resources.Rato_preto, rato_preto.X, rato_preto.Y, 120, 130);

            incrementarSpriteArcoIris();


            memGraphics.Render(e.Graphics);
        }
示例#10
0
        private void AlphaListRow_Paint(object sender, PaintEventArgs e)
        {
            memGraphics.g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            memGraphics.g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

            //memGraphics.g.FillRectangle(new SolidBrush(Color.White), 0, 0, this.Width, this.Height);

            for (int i = 0; i < GRADIENT_HEIGHT; i++)
            {
                GradientPen.Color = Gradient[i];
                memGraphics.g.DrawLine(GradientPen, 0, i + 1, this.Width, i + 1);
            }

            memGraphics.g.DrawLine(BorderPen, 0, 0, this.Width, 0);
            memGraphics.g.DrawLine(BorderPen, 0, GRADIENT_HEIGHT + 2, this.Width, GRADIENT_HEIGHT + 2);

            memGraphics.g.DrawString(pText, pFont, TextBrush, 5, 0);

            memGraphics.Render(e.Graphics);
        }
        private void SliderHandle_Paint(object sender, PaintEventArgs e)
        {
            memGraphics.g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            FindDiameter();

            float RadiusSquared = (float)Math.Pow(Radius - 1, 2);
            float HalfHeight    = (float)(this.Height - 2) / 2.0f;
            float ChordWidth;

            for (double i = 0; i < this.Height; i++)
            {
                ChordWidth        = (float)Math.Sqrt(RadiusSquared - Math.Pow(HalfHeight - i, 2));
                GradientPen.Color = GradientColors[(int)i];
                memGraphics.g.DrawLine(GradientPen, Radius - ChordWidth, (float)i + 1, this.Width - ((Radius - ChordWidth) + 2), (float)i + 1);
            }

            memGraphics.g.DrawEllipse(BorderPen, 1, 1, Diameter - 3, Diameter - 3);

            memGraphics.Render(e.Graphics);
            CreateDoubleBuffer();
        }
示例#12
0
        private void RoundButton_Paint(object sender, PaintEventArgs e)
        {
            memGraphics.g.SmoothingMode     = SmoothingMode.AntiAlias;
            memGraphics.g.TextRenderingHint = TextRenderingHint.AntiAlias;

            switch (pState)
            {
            case ButtonState.NotPressed:
                GradientColors = NotPressedColors;
                break;

            case ButtonState.Pressed:
                GradientColors = PressedColors;
                break;
            }

            FindDiameter();

            //draw gradient
            float RadiusSquared = (float)Math.Pow(m_fRadius - 1, 2);
            float HalfHeight    = (float)(this.Height - 2) / 2.0f;
            float ChordWidth;

            for (double i = 0; i < this.Height; i++)
            {
                ChordWidth        = (float)Math.Sqrt(RadiusSquared - Math.Pow(HalfHeight - i, 2));
                GradientPen.Color = GradientColors[(int)i];
                memGraphics.g.DrawLine(GradientPen, m_fRadius - ChordWidth, (float)i + 1, this.Width - ((m_fRadius - ChordWidth) + 2), (float)i + 1);
            }

            //draw visible border
            memGraphics.g.DrawArc(BorderPen, 1, 1, m_fDiameter - 2, m_fDiameter - 2, 90, 180);
            memGraphics.g.DrawArc(BorderPen, this.Width - (m_fDiameter + 1), 1, m_fDiameter - 2, m_fDiameter - 2, 90, -180);
            memGraphics.g.DrawLine(BorderPen, m_fRadius, 1, this.Width - (m_fRadius + 2), 1);
            memGraphics.g.DrawLine(BorderPen, m_fRadius, this.Height - 2, this.Width - (m_fRadius + 1), this.Height - 2);

            float Top       = 0;
            float Left      = 0;
            int   LblHeight = SizeLbl.Height + 1; //a little tweaking...
            int   LblWidth  = SizeLbl.Width - 5;

            switch (SizeLbl.TextAlign)
            {
            case ContentAlignment.BottomCenter:
            case ContentAlignment.BottomLeft:
            case ContentAlignment.BottomRight:
                Top = this.Height - Height;
                break;

            case ContentAlignment.MiddleCenter:
            case ContentAlignment.MiddleLeft:
            case ContentAlignment.MiddleRight:
                Top = (this.Height / 2) - (LblHeight / 2);
                break;

            case ContentAlignment.TopCenter:
            case ContentAlignment.TopLeft:
            case ContentAlignment.TopRight:
                Top = 0;
                break;
            }

            switch (SizeLbl.TextAlign)
            {
            case ContentAlignment.BottomCenter:
            case ContentAlignment.MiddleCenter:
            case ContentAlignment.TopCenter:
                Left = (this.Width / 2) - (LblWidth / 2);
                break;

            case ContentAlignment.BottomLeft:
            case ContentAlignment.MiddleLeft:
            case ContentAlignment.TopLeft:
                Left = 0;
                break;

            case ContentAlignment.BottomRight:
            case ContentAlignment.MiddleRight:
            case ContentAlignment.TopRight:
                Left = this.Width - LblWidth;
                break;
            }

            if (m_bmpIcon == null)
            {
                memGraphics.g.DrawString(SizeLbl.Text, pFont, TextBrush, Left, Top);
                SizeF TextSize = memGraphics.g.MeasureString(SizeLbl.Text, pFont);

                if (this.Focused)
                {
                    memGraphics.g.DrawLine(FocusDashedLine, Left + 3, (Top + TextSize.Height) - 3, (Left + TextSize.Width) - 4, (Top + TextSize.Height) - 3);
                }
            }
            else
            {
                memGraphics.g.DrawImage((Image)m_bmpIcon, (this.Width / 2) - ((m_bmpIcon.Width / 2) + 1), (this.Height / 2) - (m_bmpIcon.Height / 2));
            }

            memGraphics.Render(e.Graphics);
            CreateDoubleBuffer();
        }
示例#13
0
        private void SmoothTable_Paint(object sender, PaintEventArgs e)
        {
            m_dbgGraphics.CreateDoubleBuffer(e.Graphics, this.Width, this.Height);

            System.Drawing.Point ptDrawStart  = new Point(0, m_iColumnHeight);
            System.Drawing.Point ptDrawFinish = new Point(0, 0);
            System.Drawing.Point ptLabelPoint = new Point();
            System.Drawing.SizeF sfLabelSize;
            Region m_rgOrigRegion = m_dbgGraphics.g.Clip;

            m_dbgGraphics.g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            m_dbgGraphics.g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

            m_iTotalHeight = 0;
            m_iTotalWidth  = 0;

            //draw rows, but not row lines - we don't know how wide the table is yet
            //while drawing, keep track of total height
            //also draw row labels
            for (int i = 0; i < m_lsRowLabels.Count; i++)
            {
                //draw background gradient of row label
                Gradient.DrawGradient(m_dbgGraphics.g, Gradient.GradientDirection.Vertical, m_cGradientStart, m_cGradientFinish, m_iRowWidth, m_lsRowLabels[i].Height, ptDrawStart);

                //draw row label
                m_lsRowLabels[i].Region = new Rectangle(ptDrawStart.X, ptDrawStart.Y, m_iRowWidth, m_lsRowLabels[i].Height);
                sfLabelSize             = m_dbgGraphics.g.MeasureString(m_lsRowLabels[i].Text, m_fntLabelFont);
                ptLabelPoint.X          = ptDrawStart.X + ((m_lsRowLabels[i].Region.Width / 2) - ((int)sfLabelSize.Width / 2));
                ptLabelPoint.Y          = ptDrawStart.Y + ((m_lsRowLabels[i].Region.Height / 2) - ((int)sfLabelSize.Height / 2));

                m_dbgGraphics.g.Clip = new Region(m_lsRowLabels[i].Region);
                m_dbgGraphics.g.DrawString(m_lsRowLabels[i].Text, m_fntLabelFont, m_bshLabelTextBrush, ptLabelPoint);
                m_dbgGraphics.g.Clip = m_rgOrigRegion;

                ptDrawStart.Y += m_lsRowLabels[i].Height;
            }

            //prepare start and end points
            m_iTotalHeight = ptDrawStart.Y;
            ptDrawFinish.Y = m_iTotalHeight;
            ptDrawStart.Y  = 0;
            ptDrawStart.X  = m_iRowWidth;

            //draw columns and column lines, build total width while you're at it
            for (int i = 0; i < m_lsColumnLabels.Count; i++)
            {
                Gradient.DrawGradient(m_dbgGraphics.g, Gradient.GradientDirection.Vertical, m_cGradientStart, m_cGradientFinish, m_lsColumnLabels[i].Width, m_iColumnHeight, ptDrawStart);

                //draw column label
                m_lsColumnLabels[i].Region = new Rectangle(ptDrawStart.X, ptDrawStart.Y, m_lsColumnLabels[i].Width, m_iColumnHeight);
                sfLabelSize    = m_dbgGraphics.g.MeasureString(m_lsColumnLabels[i].Text, m_fntLabelFont);
                ptLabelPoint.X = ptDrawStart.X + ((m_lsColumnLabels[i].Region.Width / 2) - ((int)sfLabelSize.Width / 2));
                ptLabelPoint.Y = ptDrawStart.Y + ((m_lsColumnLabels[i].Region.Height / 2) - ((int)sfLabelSize.Height / 2));

                m_dbgGraphics.g.Clip = new Region(m_lsColumnLabels[i].Region);
                m_dbgGraphics.g.DrawString(m_lsColumnLabels[i].Text, m_fntLabelFont, m_bshLabelTextBrush, ptLabelPoint);
                m_dbgGraphics.g.Clip = m_rgOrigRegion;

                //draw grid line
                ptDrawFinish.X = ptDrawStart.X;
                m_dbgGraphics.g.DrawLine(m_pGridPen, ptDrawStart, ptDrawFinish);

                ptDrawStart.X += m_lsColumnLabels[i].Width;
            }

            //prepare start and end points.
            //start point will be all the way to the right of the table,
            //end point will be on the left
            m_iTotalWidth  = ptDrawStart.X;
            ptDrawStart.Y  = m_iColumnHeight;
            ptDrawFinish.X = 0;
            ptDrawFinish.Y = ptDrawStart.Y;

            //draw final row lines now that total width has been calculated
            for (int i = 0; i < m_lsRowLabels.Count; i++)
            {
                m_dbgGraphics.g.DrawLine(m_pGridPen, ptDrawStart, ptDrawFinish);
                ptDrawStart.Y += m_lsRowLabels[i].Height;
                ptDrawFinish.Y = ptDrawStart.Y;
            }

            //final border around everything
            m_dbgGraphics.g.DrawRectangle(m_pGridPen, 0, 0, m_iTotalWidth, m_iTotalHeight);

            //final resize to match size of drawn table
            this.SmoothTable_Resize(this, EventArgs.Empty);

            Fill(m_dbgGraphics.g);

            m_dbgGraphics.Render(e.Graphics);
        }