#### Archived

This topic is now archived and is closed to further replies.

# drawing board

This topic is 5621 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Im trying to draw a checkers board, but for some reason the first column of blocks are a little wider than the rest
for(i=0;i<8;i++)
{
for(j=0;j<8;j++)
{
if (i == 0 || i == 2 || i == 4 || i == 6 || i == 8)
{
if (j == 0)
fl = 0;
else
fl +=200;

ft = (71*i);

fr = fl + 100;
fb = ft+71;

rc.left = fl;
rc.right = fr;
rc.bottom = fb;
rc.top = ft;
FillRect(hdc, &rc, black_brush);
}
else
{
if (j == 0)
fl = 100;
else
fl +=200;

ft = (71 * i);
fr = fl +100;
fb = ft +71;
rc.left = fl;
rc.right = fr;
rc.bottom = fb;
rc.top = ft;
FillRect(hdc, &rc, black_brush);
}
}
}

I initially tried the if statement as if(i%2 || i == 0) but it didnt work so I did it that long way. Anyways the board comes out perfect except for that first column.

##### Share on other sites
I found my own problem. The edges of the screen are black and that makes all the blocks on the edges look bigger. I fixed it by making a white border around the window. I''m still wondering why if(i%2 || i == 0) didnt work though.

##### Share on other sites
quote:

I''m still wondering why if(i%2 || i == 0) didnt work though.

I think you want:
if ( i % 2 == 0 )

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 23
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631766
• Total Posts
3002235
×