|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
MDI Child start positionWhy is my mdichild form not starting in the "centerparent" position? I'm using the following: Public Class frmCAD Private Sub MakeNewCallToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MakeNewCallToolStripMenuItem.Click Dim frmNew As New frmMakeNewCall() frmNew.MdiParent = Me frmNew.StartPosition = FormStartPosition.CenterParent frmNew.Show() End Sub End Class Thanks Michael Bond MDI children ignore the StartPosition property, as well as any other
attempt to set their position prior to .Show. Put this in the Load event of every MDI child form you want centered: CenterInParent(Me) And this in a module: Sub CenterInParent(ByRef frm As Object) frm.Left = Higher((frm.Parent.ClientSize.Width - frm.Width) / 2, 0) frm.Top = Higher((frm.Parent.ClientSize.Height - frm.Height) / 2, 0) End Sub Function Higher(ByRef x, ByRef y) Higher = IIf(x > y, x, y) End Function Hi
thanks for that....... suppose I shouldn't ask, but if the MDI children ignore the StartPosition property why provide a "centreparent" option for the startposition ????. Answers on a postcard to Microsoft.com please Thanks again Michael Show quoteHide quote "tesla***@hotmail.com" wrote: > MDI children ignore the StartPosition property, as well as any other > attempt to set their position prior to .Show. > > Put this in the Load event of every MDI child form you want centered: > > CenterInParent(Me) > > And this in a module: > > Sub CenterInParent(ByRef frm As Object) > frm.Left = Higher((frm.Parent.ClientSize.Width - frm.Width) / 2, 0) > frm.Top = Higher((frm.Parent.ClientSize.Height - frm.Height) / 2, > 0) > End Sub > > Function Higher(ByRef x, ByRef y) > Higher = IIf(x > y, x, y) > End Function > >
Drop your pants and grab your ankles..its VISTA!
Combo Boxes in Datagrids vb.net 2003 ... Global Formatting ? Detecting the browser once IE7 comes out Seeking info on httpweblistener.... Can we determine at runtime if app is Console or Windows? How to lock a text file? Merge VB.NET and C# How to debug program error on Windows with another language? Prompting for an IP address |
|||||||||||||||||||||||