Full fill the background using small rectangle

There is a big rectangle,size(1000,600),I want to full fill it with many small ones,size(20,20),please tell me how to implement?

There are some code I've tried,is there any thing wrong?
code:
int bgw, bgh;
bgw = 1000;
bgh = 600;
GoRectangle background = new GoRectangle();
background.Location = new PointF(0, 0);
background.Size = new SizeF(bgw, bgh);
background.BrushColor = Color.Gray;
myView.Document.Add(background);
// Big rectangle


int i = 0;
int j = 0;
for (;i<=bgw/20;i++)
{
for(;j<=bgh/20;j++)

{
GoRectangle cm = new GoRectangle();
cm.Location = new PointF(i*20,j*20);

cm.Size = new SizeF(20,20);

cm.BrushColor = Color.LightBlue;
myView.Document.Add(cm);
}
}

//full fill--small rectangle
the result as:

looks like that code should fill a 20 x 20 grid with squares.



Are you just trying to get a background pattern? that would be easier with grids, which are built into GoView.



myView.Background = Color.LightBlue;

myView.GridStyle = GoViewGridStyle.Line;

myView.GridCellSize = new SizeF (20,20);



will look like this:







(note the settings in the property grid. I set this up without writing any code. NodeLinkDemo makes it easy to play with options like this. Just pick “View” at the top of the property grid.)

Also, have you tried stepping through your code? Take a look at what happens to the value of the “j” variable after the first iteration of the “i” variable.

Thanks ,Jake,walter!

I just want to learn control/alter the position of the graphic .
"j"has altered in turn before "i",but it doesn't work.
You know ,if I changed "j++" to "j+=2" ,the graphic is as below: