问题
I have 4x4 table. How to make that the first row will have 2 cells only?
Tried with ColumnSpan
but it's still drawing borders between cells.
Example:
----------------------
| A | B |
----------------------
| 1 | 2 | 3 | 4|
----------------------
回答1:
You can Dock
a Panel
with Margin=0
in a cell and then span that Panel
to the desired size and use it as the container of the objects in the cell.
Alternatively, you can set AutoSize
of a Label
to false
and then set its Dock
to Fill
and then span that Label
to the desired size.
(The Panel is shown in Green, the Labels are shown in Yellow)
The only problem when using borders with 2 pixels width (like inset) is it makes one pixel to appear at the top. This can be avoided using 1-pixel wide border type (like Single)
来源:https://stackoverflow.com/questions/53923078/hide-the-border-between-two-combined-cells-in-tablelayoutpanel