Public Class tile Inherits PictureBox Dim xloc As Int16 Dim yloc As Int16 Dim parentForm As Form1 Dim datilestate As tilestateenum = tilestateenum.none Property tilestate() As tilestateenum Get Return datilestate End Get Set(ByVal Value As tilestateenum) datilestate = Value setImage() End Set End Property Enum tilestateenum black = 0 white = 1 none = 2 End Enum Public Sub setImage() If datilestate = tilestateenum.none Then Me.Image = Nothing ElseIf datilestate = tilestateenum.black Then Me.Image = parentForm.blackimage ElseIf datilestate = tilestateenum.white Then Me.Image = parentForm.whiteImage End If Me.BorderStyle = BorderStyle.Fixed3D Me.Refresh() End Sub Public Sub New(ByVal x As Int16, ByVal y As Int16, ByVal size As Int16, ByVal pform As Form1) parentForm = pform Me.BorderStyle = BorderStyle.Fixed3D xloc = x yloc = y Me.Width = size Me.Height = size Me.Location = New Point(x * size, y * size) End Sub Public Sub clickedMe(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Click If tilestate = tilestateenum.none Then parentForm.tileClicked(Me) End If End Sub Public Sub mouseOver(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.MouseHover End Sub Public Sub mouseOver() If tilestate = tilestateenum.none Then If parentForm.whosTurn = tilestateenum.black Then Me.Image = parentForm.blackimage Else Me.Image = parentForm.whiteImage End If Me.BorderStyle = BorderStyle.None Me.Refresh() End If End Sub Public Function getXLoc() Return xloc End Function Public Function getYLoc() Return yloc End Function Public Sub mouseOut(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.MouseLeave 'If False Then setImage() 'End If End Sub Public Sub mouseMoved(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseMove mouseOver() 'parentForm.mouseMoved() End Sub End Class