Game Development Reference
In-Depth Information
Figure 4.1
Basic layout of the playing field.
Click the File menu and add a class to the project. Name it Square.vb. We need to
make the Square class inherit from Button and we need to control what a Square
object looks like when it is created. We also need to have them make sure that they
are ready to act like buttons. Our Square objects need to knowwhat rowand column
they are at so that they can identify themselves. Add the following code to the class:
Inherits System.Windows.Forms.Button
Dim Row, Col As Integer
Public Sub New(ByVal R As Integer, ByVal C As Integer)
'Get a different font and color for the button
Me.Font = New System.Drawing.Font("Arial", 9, FontStyle.Bold)
Me.BackColor = Color.White
Row = R
Col = C
Height = 30
Width = 30
Text = ""
FlatStyle = Windows.Forms.FlatStyle.Standard
End Sub
Search Nedrilad ::

Custom Search