protected override void OnMouseUp(MouseEventArgs e)
 {
     base.OnMouseUp(e);
     mCloserColumn = null;
     mCloserLeftColumn = null;
     this.Invalidate();
 }
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            int closer = CalculateCloser(e.X);
            mCloserColumn = mColumns[closer];

            if (e.Button == MouseButtons.Right)
            {
                mPosMouseDown = e.Location;
                cmnuOptions.Show(this, e.Location);
                txtColumnName.Text = mCloserColumn.Name;
            }
            else if (e.Button == MouseButtons.Left)
            {
                if (closer > 0)
                {
                    mCloserLeftColumn = mColumns[closer - 1];
                    mOriginalLeftWidth = mCloserLeftColumn.Width;
                }

                mCloserToLeft = mCloserColumn.CloserToLeft(e.X);
                mCloserInitialX = e.X;
                mOriginalWidth = mCloserColumn.Width;
                this.Invalidate();
            }
        }
 public void AddColumn(ColumnInfo column)
 {
 }
 public void AddColumn(ColumnInfo column)
 {
 }
        protected override void OnPaint(PaintEventArgs e)
        {
            CalculateCharWidth(e.Graphics);

            int width;
            int left           = mTextLeft;
            int rulesTop       = mTextTop - 2;
            int rulesNumberTop = rulesTop - 15;

            bool even = true;

            for (int i = 0; i < mColumns.Count; i++)
            {
                width = mCharWidth * mColumns[i].Width;

                Brush backBrush;

                if (i == mOverColumn)
                {
                    backBrush = new SolidBrush(ColorOverColumn);
                }
                else
                {
                    backBrush = new SolidBrush(mColumns[i].Color);
                }

                e.Graphics.FillRectangle(backBrush, left, 0, width, this.Height - 1);
                backBrush.Dispose();

                Pen rulePen;

                rulePen = even ? PenEvenRule : PenOddRule;
                even    = !even;

                if (i == mOverColumn)
                {
                    rulePen = PenOverRule;
                }

                e.Graphics.DrawLine(rulePen, left + 1, rulesTop, left + width - 1, rulesTop);

                Brush widthBrush;

                if (i == mOverColumn)
                {
                    widthBrush = new SolidBrush(Color.Black);
                }
                else
                {
                    widthBrush = Brushes.DarkRed;
                }

                e.Graphics.DrawString(mColumns[i].Width.ToString(), this.Font, widthBrush, left + width / 2 - 10, rulesNumberTop);

                left += width;
            }

            Brush b = new SolidBrush(this.ForeColor);

            e.Graphics.DrawString(Text, this.Font, b, mTextLeft, mTextTop);
            b.Dispose();

            int closer = CalculateCloser(Control.MousePosition.X);

            if (closer >= 0)
            {
                ColumnInfo col = mColumns[closer];

                if (closer > 0)
                {
                    if (col.CloserToLeft(Control.MousePosition.X))
                    {
                        col = mColumns[closer - 1];
                    }
                }
                Pen p = new Pen(Color.Red, 3);
                e.Graphics.DrawLine(p, col.mControlLeft + col.mControlWith, 0, col.mControlLeft + col.mControlWith, this.Height);
                p.Dispose();
            }
        }