简体   繁体   English

winforms如何在TableLayoutPanel中绘制(fillRectangle)一个单元格?

[英]winforms how to paint (fillRectangle) a single cell in TableLayoutPanel?

hi in winforms how to paint (fillRectangle) a single cell in TableLayoutPanel ? 您好在winforms中如何在TableLayoutPanel中绘制(fillRectangle)一个单元格? without using other panels please. 请不要使用其他面板。

You have to subscribe to the CellPaint event. 您必须订阅CellPaint事件。 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);
        }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM