现在有一tableLayoutPanel 控件,包含8X15=120个单元格,可是每次加载那个控件都需要跑CellPaint事件的次数都是120的倍数,好的情况下是240次,有时候就480次。始终不明白!!!
        /// <summary>
        /// tableLayoutPanel边框重绘
        /// </summary>
        /// <param name="pSender"></param>
        /// <param name="pE"></param>
        private void tableLayoutPanelBet_CellPaint(object pSender, TableLayoutCellPaintEventArgs pE)
        {
            i++;
            //记录日志
            writeInLog("第"+i.ToString()+"次");
            writeInLog(pE.Column.ToString()+"列"+pE.Row.ToString()+"行");
            Color color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(127)))), ((int)(((byte)(0)))));
            Pen pp = new Pen(color);
            pE.Graphics.DrawRectangle(pp, pE.CellBounds.X, pE.CellBounds.Y, pE.CellBounds.Width, pE.CellBounds.Height);
            pE.Graphics.DrawRectangle(pp, pE.ClipRectangle.X, pE.ClipRectangle.Y, pE.ClipRectangle.Width - 1, pE.ClipRectangle.Height - 1);  
        }日志:
=======================================
执行时间: 2012-5-29 14:43:14
日志内容: 第240次
========================================
=======================================
执行时间: 2012-5-29 14:43:14
日志内容: 7列14行
========================================