mdi form restricted within the parent form space

G

Guest

Is it possible to restrict where an mdi form can go within the parent
form....for example, what if I wanted the parent form to have a panel with a
listbox on the left hand side of the form......would it be possible to
somehow code it so that any mdi forms would not be allowed to be dragged over
the panel. (Or when cascaded, the mdi forms wouldn't overlap the panel?)
 
B

Bob Powell [MVP]

OTTOMH the MDI area is managed by an MdiClient control in the main form.
Find it and change it's size...

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
B

Bob Powell [MVP]

This seems to work...

public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();

//

// TODO: Add any constructor code after InitializeComponent call

//

Control mdic=null;

foreach(Control c in this.Controls)

if(c is MdiClient)

{

mdic=c;

}

this.Controls.Remove(mdic);

TreeView tv=new TreeView();

tv.Location=new Point(0,0);

tv.Size=new Size(100,100);

tv.Dock=DockStyle.Left;

this.Controls.Add(tv);

this.Controls.Add(mdic);

mdic.Dock=DockStyle.Fill;

Form f=new Form();

f.MdiParent=this;

f.Show();

f=new Form();

f.MdiParent=this;

f.Show();

}


--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top