Currently I am trying to make mouse driven game of Reversi/Othello. I've made a UserControl called ucSquare which is used to manage the colour change of the squares on the board. When the form loads I I programmatically generate the board and initial state. Up to now everything seems good. To show I've done at least something here's the function on the form to load the board while the attached picture shows it generated.
Public Sub PopulateSquares() squareDimension = (SmallestNumber(Me.Width, Me.Height) \ 9) Dim pt As Point For i = 0 To 7 For j = 0 To 7 pt = New Point(i * squareDimension, j * squareDimension) squares(i, j) = New ucSquare(squareDimension) squares(i, j).Location = pt squares(i, j).BorderStyle = BorderStyle.FixedSingle Me.Controls.Add(squares(i, j)) Next Next squares(3, 3).State = ucSquare.enumState.White squares(4, 4).State = ucSquare.enumState.White squares(3, 4).State = ucSquare.enumState.Black squares(4, 3).State = ucSquare.enumState.Black End Sub
In an attempt to keep the square Control as dumb as possible(only changing colour) I want to manage all the tests for appropriate moves from the form (or another parent control at a later date) but whenever I click on the squares the ClickEvent is picked up by the userControl.
is there a way force this click to the form (force the event handler)?
If already in the clickEvent of the userControl what is the best way(or a way) to allow the form to take over and/or obtain he curser/array position for calculation?