且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

tablelayoutpanel中特定单元格的背景色

更新时间:2023-12-06 10:19:16

以下内容会将单元格的背景颜色设置为1、1到棕色:


The following will set the background color of the cell at 1, 1 to brown:


private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e) {
       if (e.Column == 1 && e.Row == 1) {
           e.Graphics.FillRectangle(Brushes.brown, e.CellBounds);
       }
   }


检查这些

TableLayoutPanel-手动编辑列和行样式 [单击TableLayoutPanel中的特定单元格 [
Check these

TableLayoutPanel - Editing Column and Row Styles manually[^]
Clicking a Specific Cell in a TableLayoutPanel[^]