hi,

just added an mdi form into a tabpage with the following code:

frm_ASN f_New = new frm_ASN(0);
            f_New.Dock = DockStyle.Fill;
            f_New.FormBorderStyle = FormBorderStyle.None;
            f_New.MdiParent = this;
            this.components = new System.ComponentModel.Container();
            ExtremeTabPage tab = new ExtremeTabPage();
            tab.Text = f_New.Text;
            tab.Name = f_New.Name;
            tab.Controls.Add(f_New);
            this.Text = "[" + f_New.Text + "]";
            tbctrlMain.TabPages.Add(tab);
            tbctrlMain.SelectedTab = tbctrlMain.TabPages[f_New.Name];
            f_New.Show();
            f_New.WindowState = FormWindowState.Maximized;

for your information the tabcontrol is docked as fill, and there is another panel called a dashboard docked left.

now the problem comes when i hide the dashboard and the tabcontrol fills the whole page. even though i've set the form inside the tabpage to Fill it still remains as the same size!

i tried the following to refresh it but it still stays the same.

void frm_Main_SizeChanged(object sender, EventArgs e)
        {
            foreach (ExtremeTabPage tabpage in tbctrlMain.TabPages)
            {
                ((Form)tabpage.Controls[0]).Dock = DockStyle.Fill;
                ((Form)tabpage.Controls[0]).Show();
                ((Form)tabpage.Controls[0]).WindowState = FormWindowState.Maximized;
                ((Form)tabpage.Controls[0]).Refresh();
            }
        }

what am i doing wrong!?!?!?!

Recommended Answers

All 2 Replies

Out of interest if you dont set it to maximized, but change the size does it work then?

funny enough. if you substitute the

f_New.WindowState = FormWindowState.Maximized;

with

f_New.Size = Tab.Size

and include a

void tbctrlMain_SizeChanged(object sender, EventArgs e)
        {
            foreach (ExtremeTabPage tabpage in tbctrlMain.TabPages)
            {
                Form form = (Form)tabpage.Controls[0];
                if (form.Size != tabpage.Size)
                {
                    form.Show();
                    form.Size = new Size(tabpage.Width, tabpage.Height);
                    tabpage.Refresh();
                }
            }
        }

everything seems fine. i noticed you CANNOT use the maximize property.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.