Click here to Skip to main content
14,607,229 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi, I hope you can help me / give me some hints

What I'm intending to do:
I'm implementing my own GUI-Designer and therefore I need a Table/Grid-Control.

To be more specific:
I want to implement a custom Table/Grid-Control, where I can add a user-defined amount of cells and columns. This Control is in a way comparable to the TableLayoutPanel, where every Cell includes a Label-Control. Every single cell should be clickable (in DesignMode) and have their own properties. In addition every single cell should be able to switch between simple Textfield, Radiobutton, Checkbox.

What I have done so far:
I have implemented my own control ("Table") which extends the TableLayoutPanel, where every Cell gets filled with a custom Label-Control. Furthermore I coded my own Designer (extends ParentControlDesigner) to get the Glyph-Functionality for Resizing Cells etc.

This works fine for very small Tables (e.g. 3x5), but the performace for large Tables (20x50) is really awful. I think the reason is, that the TableLayoutPanel is containing that much Labels. The VisualStudio internal Designer has the same (even slower) problems when creating a large TableLayoutPanel and fill every cell with a panel. It's nearly unusable when resizing the Control.

I have deactivated the refresh of my propertygrid already, but still too slow. In my opinion the performace-lack is due to the resize events of every single lable when Resizing the whole table.


Are there better approaches to my problem? Is there a better way to implement a simple but big table/grid where the user is able to modify the properties for each single cell at design time?

Thanks a lot in advance for any hints

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Plenty of table grids are available here. There's even a very popular one[^] by our esteemed leader.

My bad. Didn't realize it had to be in C#. Here's a C# one called SourceGrid[^]. There's probably others. Just use the CP filtering on the language you want.
akamper 18-Jan-11 8:02am
Thank you for your answer. I have already found that, but this is a MFC Control and I need a WinForms Control. Obviously the TableLayoutPanel is far too slow for large Tables (as I have found out (google) that a lot of other people facing similar performance problems, but in none of these discussions I could find a solution for this problem)
Bassam Abdul-Baki 18-Jan-11 8:04am
Did you look at SourceGrid? I updated my answer.
akamper 18-Jan-11 8:12am
Thanks, not until now. I will have a look at it
thatraja 18-Jan-11 10:12am
It's a great control(SourceGrid) BAB, 5!
akamper 19-Jan-11 5:12am
I have tested the grid a little bit now. Its really great and powerful. Unfortunately there is no design time support implemented, which is a big need for my project (where I am trying to implement a small GUI designer).

I will have to try to add some basic design time functionality to the grid, so that the rows and columns get displayed in design time at least. Hope I can handle that.
Bassam Abdul-Baki 19-Jan-11 6:10am
That was a feature when it used to be an OCX in MFC. Why is that an important requirement?
akamper 19-Jan-11 7:04am
My "program" is a grafical designer, where the user can create his own GUI (buttons, textfields, grids.. and connect them to some input/output variables).
I'm therefore hosting the WindowsForms designer provided by the .NET Framework.

So the user should be able to drag the grid out of the Toolbox (of my designer!) and place it on the surface. Then he should be able to add columns/rows via the property grid, put some values in cells and so on. And in this design time environment, I would like that the grid already displays the grid as it would behave in runtime (and not only display the panel frame).

So more or less nearly the full runtime behaviour in design time.
Bassam Abdul-Baki 19-Jan-11 7:10am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100