What would be the best way to display & program simple game board (say chess, checkers and such) in C#? In terms of controls and underlying game logic.
An idea that came to my mind was to use Picture Box (or class inheriting from it) with Board & Field classes.
Googling some also brought me to solutions using button/label for each game field. But back to Board, Field and PictureBox.
Extendability - designing it properly would easily allow to implement any other board game (or even card game) as it's all about board with modifiable fields after all.
In an object-oriented approach, think about the objects involved in your game (e.g. the board, the pieces) … let them each provide a drawing method that takes a Graphics
object and draws itself on it.
The drawing itself could be done on a PictureBox
– this is the ideal control for such purpose – but this isn't really all that important because once your drawing logic is in place, it won't depend on the kind of control.
In general, don't use workarounds with different controls. These might be nice for a conventional GUI. Not so much for games (or any kind of graphics-heavy application).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With