There are problems with that approach: particularly in January, March, May, July, August, October, and December which do not fit in your scheme - having 31 days in each!
So enlarge your "calendar" to a 12 by 31 matrix for starters (and actually, make it 13 by 32 so you have room for the headers: a row for 1...31 and a column for "Jan"..."Dec"
There are several ways you could do this, but the easiest is probably to create a UserControl: Right click your project in the Solution Explorer and select "Add"..."User Control...".
Call it "MyCalendar" and click the "Add" button.
You will get a blank display with some "grab handles" - use them to make it bigger.
Now go to the Properties pane, and select "Events" - it's the "lightening bolt" button.
Double click the "Paint" event and the system will create a blank event in the control for you.
Add this code:
private void MyCalendar_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
int colWidth = Width / 32;
int rowHeight = Height / 13;
Brush b1 = Brushes.Salmon;
Brush b2 = Brushes.Cyan;
bool drawB1 = true;
for (int x = colWidth; x < Width; x += colWidth)
{
for (int y = rowHeight; y < Height; y += rowHeight)
{
g.FillRectangle(drawB1 ? b1 : b2, new Rectangle(x, y, colWidth, rowHeight));
drawB1 = !drawB1;
}
}
}
Now compile you app, then drag a MyCalendar instance from the Toolbox onto your form. See all the pretty squares? :laugh:
That won't do exactly what you want, but it's a place to start - so use that as a "template" for getting your actual calendar to work. First try to change it so it draws 14 pink squares, and 14 cyan ones. Then get it to draw the right number of days in each month. and so on. Do it in little stages, and you'll get there!