问题给一个MDI父母形式的背景色 [英] problem giving backcolor of a mdi parent form
本文介绍了问题给一个MDI父母形式的背景色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试给mdi父表单提供背景色,但是我看不到效果…….plz help
i m trying to give backcolor to a mdi parent form,but i can not see the effect.......plz help
推荐答案
另一种选择:
private void Form1_Load(object sender, EventArgs e)
{
// store the result in a class-scoped variable
// if you need to change the color again, or
// whatever
//
// note that here we assume the Form IsMdiContainer property is 'true;
// no checking that is true
//
this.Controls.OfType<MdiClient>().First().BackColor = Color.Red;
//
//
}
尝试类似的事情
Try something like this
foreach (Control c in this.Controls)
{
if (c is MdiClient)
{
c.BackColor = Color.Blue;
break;
}
}
添加了"break;"
Added "break;"
这还不清楚,或很明显,但是...
This is not clear, or obvious, but...
foreach (Control control in Controls)
{
MdiClient client = control as MdiClient;
if (client != null)
{
client.BackColor = Color.Red;
}
}
相信我-试试吧!
这篇关于问题给一个MDI父母形式的背景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文