
This is not about a DataGridView or something else, it is just about drawing a simple grid in a form window.
Googled a bit but found not much of my liking. A Grid as a BitMap in a PictureBox?
Come on! Must have been some of those GUI guys I guess. I find it easier to draw in a Form or a Panel in a Form, so I have total control over where to draw a chess piece or a Sudoku number or whatever. Or I could draw a graph with a grid; think it’s harder to do that with a BitMap.
So I decided to make my own simple grid class.
And so, here is the third part of my “any” code snippets, the other two being:
http://www.daniweb.com/software-development/csharp/code/217206
http://www.daniweb.com/software-development/csharp/code/360165
Make a new Forms application, drop a Panel control on the Form. Make the Panel Size about 350,350 and set its BorderStyle to FixedSingle(just to see where it is in the form).
Add the code for the Grid class to your project and fill in the code for the Form.cs file.
I use the Paint event handler of the Panel control.
Enjoy!