DatagridView添加三个标题行 [英] DatagridView Add Three Header Row
问题描述
我想向DatagridView添加三个标题行。
Row1 - > ;列标题 - > 2013,2014,2015年(合并月数= 12)
第2行 - >列标题 - > 1,2,3,...,12个月(合并日期= 28,30或31)
第3行 - >列标题 - > 1,2,3,...,28,29,30,31个月的天数(我用DayInMonth(年,月)来计算
| - ---------------------------------------- 2015年--------- --------------------------------- | Row1 Header
| ----- --------------------------------------- 1 ---------- ---------------------------------- | Row2 Header
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |第3行标题
| --------------- -------------------------- 2015年----------------------- ---------- | Row1标题继续
| --------------------------- ----------------- 2 -------------------------------- - |第2行标题继续
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |第3行标题继续
我想要这些行和标题。< br $> b $ b
我使用VB.NET 2012
谢谢
Hi,
I want to add three header row to DatagridView.
Row1 -> Columns Header -> 2013,2014,2015 Years (Merge Months Count = 12)
Row2 -> Columns Header -> 1,2,3,...,12 Months (Merge Days of Month = 28,30, or 31)
Row3 -> Columns Header -> 1,2,3,...,28,29,30,31 Days of Month (I calculate this with DayInMonth(Years,Months)
|------------------------------------------2015------------------------------------------| Row1 Header
|--------------------------------------------1--------------------------------------------| Row2 Header
|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31| Row3 Header
|-----------------------------------------2015---------------------------------| Row1 Header Continue
|--------------------------------------------2----------------------------------| Row2 Header Continue
|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28| Row3 Header Continue
I want to like these rows and headers.
I use VB.NET 2012
Thanks
推荐答案
DatagridView有只有1个HeaderRow。
但你可以做些什么来解决这个问题:
- 你只能在DGV中显示一个月
- 您在DGV上设置了一个标签,向用户显示所选的月份和年份。或许你可以用2个标签来做 - 一个用于年度,一个用于本月。
剩下的必须由后面的逻辑完成。
也许您将所需的所有部件放在UserControl中,为其提供数据库,UserControl具有为可视化执行必要部件的逻辑......
The DatagridView has only 1 HeaderRow.
But what you can do to solve the issue :
- you only display one month at time in the DGV
- you set a Label over the DGV which shows the user the selected Month and Year. Or perhaps you do it with 2 Labels - one for the Year and one for the Month.
The remaining must be done by the logic behind.
Perhaps you put all parts you need in a UserControl, give it the database and the UserControl has the logic to do the necessary parts for the visualisation ...
这篇关于DatagridView添加三个标题行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!