The top coordinate is y1.
So you could use this:
For col = 0 To 255
x = x0 + col * dx
cvsGraph.DrawRect(x, y1, dx, dy, RowColors(col), True, 1)
Next
And MoveRows:
You must change the values below in the Private Sub InitGraph routine.
MoveWidth = 256 * dx
MoveHeigth = 59 * dy
MoveSourceTop = y1
MoveDestTop = y1 + dy
The MoveRows routine remains the same:
Private Sub MoveRows
cvsGraph.DrawImage2(cvsGraph.Snapshot, x0, MoveSourceTop, MoveWidth, MoveHeigth, x0, MoveDestTop, MoveWidth, MoveHeigth)
End Sub
cvsGraph.DrawImage2(Image, SourceLeft, SourceTop, SourceWidth, SourceHeigth, DestLeft, DestTop, DestWidth, DestHeigth)
cvsGraph.DrawImage2 copies a part of a source image, cvsGraph.Snapshot in your case, with the coordinates of the source rectangle to the cvsGraph Canvas in a rectangle with the destination coordinates.
So in your case, you want to copy the upper 59 rows one row below, therefore:
MoveWidth = 256 * dx : the width of the 256 samples
MoveHeigth = 59 * dy : height of 59 rows
MoveSourceTop = y1 : source top is the top line coordinate
MoveDestTop = y1 + dy : destination top is one row below the top line
SourceLeft = DestLeft = x0 : left coordinate of the image
SourceTop = MoveSourceTop = y1: top line
DestTop = MoveDestTop + y1 + dy one row below the top line
SourceWidth = DestWidth = MoveWidth = 256 * dx the width of the 256 samples
SourceHeight = DestHeight = MoveHeigth = 59 * dy the height of 59 rows
I hope that this is clear.