如何在c#winforms中的datagridview中合并四/五/六/列。 [英] How to merge four/five/ six/ columns in datagridview in c# winforms.
问题描述
任何人都可以说如何在datagridview中合并3/4/5/6列。在winforms中
i需要以下输出
---------------------------- --------------------------------------
---- ----------姓名------------- | --------主题-------- |
------------------------------------------ ------------------------
名字|中间名|姓氏|英语|科学|社交|
---------------------------------------- --------------------------
在这6列我要去添加来自Datatable的数据
作为gridview源码
------------------------------------ ------------------------------
Hi,
Can anyone say how to merge 3/4/5/6 columns in a datagridview. in winforms
i need the following output
------------------------------------------------------------------
-------------- Name ------------- | -------- Subjects -------- |
------------------------------------------------------------------
First Name| Middle Name | Last Name | English | Science | Social |
------------------------------------------------------------------
In this 6 columns i am going to add data from Datatable
as a gridview sourcce
------------------------------------------------------------------
推荐答案
是啊.. .DataGridView与Web控件网格不同。我从来没有找到一种非常优雅的方式来做到这一点。我所做的基本上是创建一个标签,并将其放在我想要合并的列的列标题的顶部。它需要重新调整大小或者将列大小设置为常量。然后格式化网格和标签看起来更好。如果您找到更好的方法,请告诉我。
Yeah...The DataGridView is not like the web control grid. I've never found a very elegant way to do this. What I did was basically create a label and put it over the top of the column headers of the columns I wanted to "merge". It requires either a re-sizing method or that you've set the column sizes to a constant size. And then formatting the grid and label to look nicer. If you find a better way, please let me know.
这篇关于如何在c#winforms中的datagridview中合并四/五/六/列。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!