且构网

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

的WinForms怎么画(fillRectangle)在TableLayoutPanel中的单个单元格?

更新时间:2023-12-06 10:24:10

您必须订阅CellPaint事件。
为例:

You have to subscribe to the CellPaint event. As an example:

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