Take the 2-minute tour ×

Okey, so I'm working on a pathfinding program, where I would test various pathfinding algorithms. For this I prefer use a grid control, whereat I can interract with each square, marking them as an obstacle, or a valid path. Here is a picture to demonstrate :


As far as I know, there is no built in control like this in C# WinForms. The only possible solution that came into my mind is using a picturebox, and divide that into squares, but that would not be what I want. So what would you use here to build this?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Well, you could set up a square of panels, then assign each one into a two dimensional array (the array holds a pointer or reference to a panel). therefore creating a xy style grid to test your path finding algorithm on, when the algorithm goes on a certain panel, just change it's color.

share|improve this answer
yeah it's a nice solution. What do you think, will it work smoothly with bigger statespaces like 200x200? =/ –  Dominik Dec 10 '11 at 21:45
You can also add controls to a form dynamically (I mean programmatically). So a large number of squares should not be a problem. –  Olivier Jacot-Descombes Dec 10 '11 at 22:25
Yea, since this is simple, its easy to scale, and can be implemented as big as needed. So it should work rather smoothly. –  Link Dec 10 '11 at 23:45
add comment

Your Answer


