简体   繁体   中英

c# custom layout for GridDataView

Here my question: How can I make a custom layout for a DataGridView in C# ?

I try to work with the object DataGridView and I think it's the best for making what i want but I can't find how I can merge 2 cells or more from one column. I'm sure that is already exist but I can't find something on the web. What I want, is a excel like grid

Here a example of what I want to make.

Example of array:

Group = 
[
    Cell 1, [Cell 1, Cell 2],
    Cell 2, [Cell 1, Cell 2, Cell 3],
    Cell 3, []
];

Example of what I want to do :
图片范例

I think it's better to use a custom grid control. Or you may want to use the XL sheet control of devexpress which is not free. Another option is to use EPPlus → ( http://epplus.codeplex.com ).

The only way I know of to accomplish this is by either one of the following options:

  1. A third-party control which has cell merging built in. I do not have personal recommendations on this.
  2. Handling the CellPaint events properly. I've personally done this in projects where I need basic cell merging capabilities.
  3. Find another way to report the data, such as exporting to Excel which does support merging cells.

There is no built-in method of performing a merge-cells option in a WinForms DataGridView.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM