2011-05-17 65 views

回答

7

您必须订阅CellPaint事件。 作为一个例子:

private void tableLayoutPanel_CellPaint(object sender, TableLayoutCellPaintEventArgs e) 
    { 
     if (e.Row == 0 && e.Column == 1) 
     { 
      e.Graphics.FillRectangle(new SolidBrush(Color.Black), e.CellBounds); 
     } 
    } 
+2

变化'e.ClipRectangle'到'e.CellBounds',这将是正确的答案;)(ClipRectangle指整个面板) – digEmAll 2011-05-17 13:19:04

+0

@digEmAll,谢谢你的建议。发布编辑。 +1 – 2011-05-17 13:35:04

+0

谢谢,很棒的工作!!!!!!!!! – gooteis 2011-05-17 14:24:51