MainMenu item and Controls.Remove()

I am trying to learn about forms in .NET and can't figure out a couple of things:
I have a MainMenu item that serves File Help and other things on the top of the application. The whole application window has a background image but the line with the MainMenu is still of control color. Is there any way to make the background image cover the whole application window but (or even and) the top bar with the close, maximaze and minimize buttons?

Another question is how to remove controls (Buttons) ?
when I get a list of all my controls:
int cc = Controls.Count;
then I can do
for(int i = 0;i<cc;i++){
Controls[i]hide;
}

but I can't actually remove them getting "Specified argument was out of the range of valid values.'' in return.

Any help would be great.
Simpler the examples, the better - I'm a newbie to C#.

[861 byte] By [codefund.com] at [2007-12-16]
# 1
I don't see a reasonable way to accomplish the first goal without drawing all the menubars and buttons yourself, but perhaps someone else will have an idea.

For your second problem, if you want to remove ALL the controls, you could use code like this:
int i;
for (i = this.Controls.Count - 1; i >= 0; i--)
{
this.Controls.Remove(this.Controls[i]);
}
The reason you can't simply count <i>up</i> is that the size of the collection changes as you remove controls, and the looper gets "confused". Don't know if this is what you need, but it certainly works to remove all the controls on a form.

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 2
Hi,

About your first question:
MainMenu is part of the so-called non-client area of a window and it is unreachable through the .NET Framework for painting(only the MenuItems). I myself tried making a custom caption form and did a lot of work and win32 API calls:)). But you may play around with the code from RegionMaster Controls, where a very good example is given for assigning new region(painting area) to a form.
You may also set the FormBorderStyle property to FormBorderStyle.None and then you will have only client area.

Another way to remove all the controls:
while(this.Controls.Count > 0)
this.Controls.RemoveAt(0)

Cheers,
Gogou

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...