Creating a Chess Board using Windows Forms

前端 未结 4 1303
情歌与酒
情歌与酒 2021-01-23 07:19

What is the best way to create chess board using Windows Forms?

I am still new to graphics coding in winforms and I am not sure, which control to use for that?

4条回答
  •  误落风尘
    2021-01-23 07:31

    In the controls OnPaint eventhandler, you start out by drawing the chessboard pattern either implicitly using the formula (floor(x * 8) mod 2) = (floor(y * 8) mod 2) or by just drawing the squares with Graphics.FillRectangle. The second step would be to draw the pieces on top with Graphics.DrawImage.

提交回复
热议问题