的WinForms怎么画(fillRectangle)在TableLayoutPanel中的单个单元格? [英] winforms how to paint (fillRectangle) a single cell in TableLayoutPanel?

查看:203
本文介绍了的WinForms怎么画(fillRectangle)在TableLayoutPanel中的单个单元格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


中的WinForms怎么画(fillRectangle)在TableLayoutPanel中的单个单元格?
,而无需使用其他面板请。

hi in winforms how to paint (fillRectangle) a single cell in TableLayoutPanel ? without using other panels please.

推荐答案

您必须订阅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);
        }
    }

这篇关于的WinForms怎么画(fillRectangle)在TableLayoutPanel中的单个单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆