What can be wrong with the followings:
Consider only first if in draw function first
'In a Propery
If Value.X > 0 Then
redraw.direction = Position.FirstColumn
Else
redraw.direction = Position.LastColumn
End If
If Value.Y > 0 Then
redraw.direction = redraw.direction Or Position.FirstRow
Else
redraw.direction = redraw.direction Or Position.LastRow
End If
......
'in a draw function
If redraw.direction = Position.FirstColumn Or Position.FirstRow Then
DrawCroppedMap(redraw.cols, redraw.rows, cols - redraw.cols,
rows - redraw.rows, redraw.cols, redraw.rows)
DrawNewRowsAndCols(0, cols - 1, 0, redraw.rows - 1) 'draw
rows at top
DrawNewRowsAndCols(0, redraw.cols - 1, redraw.rows, rows -
1) 'draw remaining of cols at left
ElseIf redraw.direction = Position.LastColumn Or
Position.LastRow Then
'draw cropped here... not implemented yet IGNORE
DrawNewRowsAndCols(0, cols - 1, 0, redraw.rows - 1) 'draw
rows at top
DrawNewRowsAndCols(cols - 1 - redraw.cols, cols - 1,
redraw.rows, rows - 1) 'draw remaining of cols at right
ElseIf redraw.direction = Position.FirstColumn Or
Position.LastRow Then
'draw cropped here... not implemented yet IGNORE
DrawNewRowsAndCols(0, cols - 1, rows - 1 - redraw.rows,
rows - 1)
DrawNewRowsAndCols(0, redraw.cols - 1, 0, rows - 1 -
redraw.rows)
ElseIf redraw.direction = Position.LastColumn Or
Position.FirstRow Then
'draw cropped here... not implemented yet IGNORE
DrawNewRowsAndCols(0, cols - 1, rows - 1 - redraw.rows,
rows - 1)
DrawNewRowsAndCols(cols - 1 - redraw.cols, cols - 1, 0,
rows - 1 - redraw.rows) 'draw remaining cols at right
End If
........
Private Sub DrawNewRowsAndCols(ByVal xStart As Integer, ByVal xEnd As
Integer, ByVal yStart As Integer, ByVal yEnd As Integer)
For x As Integer = xStart To xEnd
For y As Integer = yStart To yEnd
grBuffer.DrawImage(GetCompleteTile(x, y), New Rectangle(x *
tile.Width, y * tile.Width, tile.Width, tile.Height), New Rectangle(0, 0,
tile.Width, tile.Height), GraphicsUnit.Pixel)
Next
Next
End Sub
Private Sub DrawCroppedMap(ByVal x As Integer, ByVal y As Integer, ByVal
width As Integer, ByVal height As Integer, ByVal newX As Integer, ByVal newY
As Integer)
Dim CropBuff As Bitmap = New Bitmap(bufferMap)
grBuffer.DrawImage(CropBuff, New Rectangle(newX * tile.Width, newY *
tile.Height, width * tile.Width, height * tile.Height), New Rectangle(x *
tile.Width, y * tile.Height, width * tile.Width, height * tile.Height),
GraphicsUnit.Pixel)
End Sub