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

标签 c# winforms

嗨 在 winforms 中如何在 TableLayoutPanel 中绘制 (fillRectangle) 单个单元格? 请不要使用其他面板。

最佳答案

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

关于c# - winforms如何在TableLayoutPanel中绘制(fillRectangle)单个单元格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6031245/

相关文章:

c# - MVP 依赖注入(inject)

c# - 如何向 UserControl 添加属性?

c# - 如何从资源对象中获取资源名称?

c# - 系统线程: Cross-thread operation not valid

c# - 带有光滑圆角的标签

c# - 如何使用 Win2D 模拟 DeviceLost 事件?

c# - MVC Model.IsValid 用于枚举

c# - C# 中对象的不同实例的数组的优雅平均

c# - 在泛型类 C# 中继承

c# - Jquery 模态未调整大小