Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Popout Window from MDI Parent

Status
Not open for further replies.

MadJock

Programmer
May 25, 2001
318
GB
Hi All,

I have a WinForms application where I have a very simple MDI parent window into which users can load other windows (gadgets as I call them). Ideally, I would like for the user to be able to pop the gadget out from the container, for example to fullscreen it on another monitor.

Can anyone point me in the correct direction to achieve the pop-out functionality? Ideally, this would be an option in the control box menu of the child window.

Any advice much appreciated.

Thanks,

Graeme


"Just beacuse you're paranoid, don't mean they're not after you
 
VB solution - crude, but seems to work. You will need to handle multiple children more carefully.

Code:
Public Class Form1
	'Form1 is the MDIParent

	Private f2 As Form2
	Private f2a As Form2

	Private Sub UnlinkToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UnlinkToolStripMenuItem.Click

		f2.WindowState = FormWindowState.Maximized
		f2.MdiParent = Nothing
		f2a = Form2

	End Sub

	Private Sub LinkToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkToolStripMenuItem.Click

		f2 = New Form2
		f2.MdiParent = Me
		f2.Show()

	End Sub
End Class

If you need to relink then you could communicate that with the MDIParent via a monitored Event Raised in the child.


Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top