Hi all,
How can I change the BACKGROUND color of the MDI FORM in C#?
I changed it using the background color property but the color is not changed.
What should I do to perform this task?
Please help me out!!
Thanks in advance!!
Hi all,
How can I change the BACKGROUND color of the MDI FORM in C#?
I changed it using the background color property but the color is not changed.
What should I do to perform this task?
Please help me out!!
Thanks in advance!!
You can't for sorry change it!
It always defaults to the default background color of a control.
i tried something like this but it didnt work :
protected override void OnPaintBackground(PaintEventArgs e)
{
base.OnPaintBackground(e);
Pen pen = new Pen(Color.Red, 3);
Rectangle rect = new Rectangle(0, 0, 300, 300);
e.Graphics.DrawRectangle(pen, rect);
}
Paste the following code into form_load event.
private void StartForm_Load(object sender, EventArgs e)
{
MdiClient ctlMDI;
foreach (Control ctl in this.Controls)
{
try
{
ctlMDI = (MdiClient)ctl;
ctlMDI.BackColor = this.BackColor;
}
catch (InvalidCastException exc)
{
// Catch and ignore the error if casting failed.
}
}
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.