hi all , my challenge is to create a simple tic tac toe , now i have written the code so when you click a square it draws a string into that square but i everytime i click another square the previous dissapears and the newly clicked square gets drawn...
1. i know future modifications will be to stop a square being rewrote once its become drawn.
2. is there anyway of making a string invisible and visible?
i am thinking maybe, when the user(or comp) clicks an empty square i am orignally changing a variable index to match which square was click in order to draw in the X or O , but if i was to have a variable(array) so all boxes are 0 and when its been clicked it becomes a 1 , i could use this to stop a "occupied" square being changed?
as far as my problem with the X and O keep dissapearing i am guessing this is because everytime i invalidates it OnPaint which recreates everything. would this be fixed by creating a eventhandler called newgame for example which draws the game in and then have a seperate void method which adds in the pieces so its all out of OnPaint therefore not keep renewing?
i am not home to send code or try this is just my thoughts at beginning of a 9 hour shift at work so would like to know if im on right track so i know when i get home if ill be wasting my time trying this thanks
1. i know future modifications will be to stop a square being rewrote once its become drawn.
2. is there anyway of making a string invisible and visible?
i am thinking maybe, when the user(or comp) clicks an empty square i am orignally changing a variable index to match which square was click in order to draw in the X or O , but if i was to have a variable(array) so all boxes are 0 and when its been clicked it becomes a 1 , i could use this to stop a "occupied" square being changed?
as far as my problem with the X and O keep dissapearing i am guessing this is because everytime i invalidates it OnPaint which recreates everything. would this be fixed by creating a eventhandler called newgame for example which draws the game in and then have a seperate void method which adds in the pieces so its all out of OnPaint therefore not keep renewing?
i am not home to send code or try this is just my thoughts at beginning of a 9 hour shift at work so would like to know if im on right track so i know when i get home if ill be wasting my time trying this thanks