WinForms datagrid inverted so that column headers become (repeating) row labels

假如想象 提交于 2019-12-11 11:41:19

问题


I'm looking to display multiple records in a data-aware WinForms grid control, such that the column-headers become (repeating) row-labels. Does the grid of any of the major third-party WinForms control vendors have this feature, or can it be done with the built-in grid control? Or is there a way to simulate it using labels and textboxes and datepickers in a control that offers repeating vertical groups?

City   xxxxxxxxxxxxxxxxxxxxxx
State  xx
Zip    xxxxx 
Note   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
       xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-------
City   xxxxxxxxxxxxxxxxxxxxxx
State  xx
Zip    xxxxx 
Note   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
       xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-------
City   xxxxxxxxxxxxxxxxxxxxxx
State  xx
Zip    xxxxx 
Note   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
       xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

回答1:


Is there a way to simulate it using labels and textboxes and datepickers in a control that offers repeating vertical groups?

You can use either of these options:

  • DataReapter
    You can use a DataRepeater control.

    The Visual Basic Power Packs DataRepeater control is a scrollable container for controls that display repeated data, for example, rows in a database table. It can be used as an alternative to the DataGridView control when you need more control over the layout of the data. The DataRepeater "repeats" a group of related controls by creating multiple instances in a scrolling view. This enables users to view several records at the same time.

  • Custom UserControl shown in TableLayoutPanel or FlowLayoutPanel
    You can create a custom UserControl which shows a record this way and then using a TableLayoutPanel or FlowLayoutPanel show all records.

  • Custom DataGridViewColumn
    You can create a custom DataGridViewColumn hosting a complex (user control) which shows the whole object behind the row this way.



来源:https://stackoverflow.com/questions/36941509/winforms-datagrid-inverted-so-that-column-headers-become-repeating-row-labels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!