H there,
I fill a Canvas with squares (it’s a map with primes):
Var BlockWidth As Integer = 2
Var BlockHeight As Integer = 2
Var Space As Integer = 1
NumberTeller = 1
PrimeCounter = 0
PrimeMap = New Picture(CanvasWidth,CanvasHeight)
For X As Integer = 0 To CanvasHeight Step (BlockWidth + Space)
For Y As Integer = 0 To CanvasWidth Step (BlockWidth + Space)
If IsPrime(NumberTeller) Then
PrimeMap.Graphics.DrawingColor = PrimeColor
PrimeCounter = PrimeCounter + 1
Else
PrimeMap.Graphics.DrawingColor = NonPrimeColor
End If
PrimeMap.Graphics.FillRectangle(Y,X, BlockWidth,BlockHeight)
NumberTeller = NumberTeller + 1
Next
Next
In the Canvas.MouseOver event, how can I determine on which square the mouse pointer actually is?