|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Layout MDI problems with more than 3 windowsWhen i use LayoutMdi with TileHorizontal or TileVertical and more than 3 windows the result is not the expected one and is the same. When i TileVertical 4 windows i want them === =1= === =2= === =3= === =4= === (like ALL windows application does) but i got them : ====== =1==2= ====== =3==4= ====== If TileHorizontal : the result is the same. Example VB Code : You open a new windows application and paste this in Form1.vb Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Me.MdiParent Is Nothing Then Me.IsMdiContainer = True For i As Integer = 1 To 4 Dim f As Form1 = New Form1 f.MdiParent = Me f.Show() Next i Me.LayoutMdi(MdiLayout.TileVertical) End If End Sub Thanks, Olivier Hi Olivier,
I performed a test based on your sample code and saw the same result as you did. If I change the sample code as follows, i.e. show 6 child forms in the MDI parent form, these child forms are displayed differently: For i As Integer = 1 To 6 Dim f As Form = New Form ' show the value of the variable i in the child form's title bar f.Text = i.ToString() f.MdiParent = Me f.Show() Next i If I use LayoutMdi with TileHorizontal, these child forms are arranged into 3 rows and 2 columns, something like: 6 3 5 2 4 1 If I use LayoutMdi with TileVertical, these child forms are arranged into 2 rows and 3 columns, something like: 6 4 2 5 3 1 As you can see, when using LayoutMdi with TileHorizontal, the child forms are arranged horizontally by the greatest extent, and on the contrary, when using LayoutMdi with Vertical, the child forms are arranged verically by the greatest extent. This makes sense, doesn't it? I hope I make some clarifications. If you have any question, please feel free to let me know. Sincerely, Linda Liu Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Hello Linda,
Thanks for your reply but in fact the problem is that is way of tilling is really not the same than the excel one (when you tileVertical there are nether 2 workbooks that are side by side) and that i m porting my major application from VB6 to VB.NET and i have a hundred of users that use tilling a lot (horizontal and vertical) to compare datas from differents windows. Is there a way to mimics the excel tilling (an obscure parameter, an undocumented function, api call ???) from a .NET MDI application ? Reagrds, Olivier "Linda Liu [MSFT]" <v-l***@online.microsoft.com> a écrit dans le message de news: SlGSt%23%23$HHA.5***@TK2MSFTNGHUB02.phx.gbl...Show quote > Hi Olivier, > > I performed a test based on your sample code and saw the same result as > you > did. > > If I change the sample code as follows, i.e. show 6 child forms in the MDI > parent form, these child forms are displayed differently: > > For i As Integer = 1 To 6 > Dim f As Form = New Form > ' show the value of the variable i in the child form's > title bar > f.Text = i.ToString() > f.MdiParent = Me > f.Show() > Next i > > If I use LayoutMdi with TileHorizontal, these child forms are arranged > into > 3 rows and 2 columns, something like: > > 6 3 > 5 2 > 4 1 > > If I use LayoutMdi with TileVertical, these child forms are arranged into > 2 > rows and 3 columns, something like: > > 6 4 2 > 5 3 1 > > As you can see, when using LayoutMdi with TileHorizontal, the child forms > are arranged horizontally by the greatest extent, and on the contrary, > when > using LayoutMdi with Vertical, the child forms are arranged verically by > the greatest extent. > > This makes sense, doesn't it? > > I hope I make some clarifications. > > If you have any question, please feel free to let me know. > > Sincerely, > Linda Liu > Microsoft Online Community Support > > ================================================== > Get notification to my posts through email? Please refer to > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif > ications. > > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues > where an initial response from the community or a Microsoft Support > Engineer within 1 business day is acceptable. Please note that each follow > up response may take approximately 2 business days as the support > professional working with you may need further investigation to reach the > most efficient resolution. The offering is not appropriate for situations > that require urgent, real-time or phone-based interactions or complex > project analysis and dump analysis issues. Issues of this nature are best > handled working with a dedicated Microsoft Support Engineer by contacting > Microsoft Customer Support Services (CSS) at > http://msdn.microsoft.com/subscriptions/support/default.aspx. > ================================================== > > This posting is provided "AS IS" with no warranties, and confers no > rights. > Hi Olivier,
Thank you for your prompt reply! > Is there a way to mimics the excel tilling (an obscure parameter, an undocumented function, api call ???) from a .NET MDI application ?Yes, we could do that in a .NET MDI application. A solution is to calculate the proposed location and size for each MDI child form and then rearrange them in the MDI parent form. Since MDI child forms are displayed within MdiClient control, we need to get this control first to get its size so as to make the calculation accurate. The following is a sample code. You could call it in your program to tile the MDI child forms horizontally or vertically. Private Sub ArrangeChildForms(ByVal style As MdiLayout) Dim mc As MdiClient For i As Integer = 0 To Me.Controls.Count - 1 If (Me.Controls(i).GetType().Equals(GetType(MdiClient))) Then mc = Me.Controls(i) End If Next If (style = MdiLayout.TileHorizontal) Then Dim frmheight As Integer = (mc.Size.Height - 4) / Me.MdiChildren.Length For i As Integer = 0 To Me.MdiChildren.Length - 1 Me.MdiChildren(i).Top = i * frmheight Me.MdiChildren(i).Left = 0 Me.MdiChildren(i).Width = mc.Size.Width - 4 Me.MdiChildren(i).Height = frmheight Me.MdiChildren(i).WindowState = FormWindowState.Normal Next ElseIf (style = MdiLayout.TileVertical) Then Dim frmwidth As Integer = (mc.Size.Width - 4) / Me.MdiChildren.Length For i As Integer = 0 To Me.MdiChildren.Length - 1 Me.MdiChildren(i).Top = 0 Me.MdiChildren(i).Left = i * frmwidth Me.MdiChildren(i).Width = frmwidth Me.MdiChildren(i).Height = mc.Size.Height - 4 Me.MdiChildren(i).WindowState = FormWindowState.Normal Next End If End Sub Hope this helps. If you have any question, please feel free to let me know. Sincerely, Linda Liu Microsoft Online Community Support Hi Linda,
Thanks a lot. I hoped another response (a "secret" framework function :-) ) because it would be eaysier to use in different applications than to copy/paste each time code or to add it to my libraries, but this one is statisfying and i'll start to implement it in my projects. Again thanks a lot. Regards, See you, Olivier "Linda Liu [MSFT]" <v-l***@online.microsoft.com> a écrit dans le message de news: 1oZ4sjCAIHA.***@TK2MSFTNGHUB02.phx.gbl...Show quote > Hi Olivier, > > Thank you for your prompt reply! > >> Is there a way to mimics the excel tilling (an obscure parameter, an > undocumented function, api call ???) from a .NET MDI application ? > > Yes, we could do that in a .NET MDI application. A solution is to > calculate > the proposed location and size for each MDI child form and then rearrange > them in the MDI parent form. > > Since MDI child forms are displayed within MdiClient control, we need to > get this control first to get its size so as to make the calculation > accurate. > > The following is a sample code. You could call it in your program to tile > the MDI child forms horizontally or vertically. > > Private Sub ArrangeChildForms(ByVal style As MdiLayout) > Dim mc As MdiClient > For i As Integer = 0 To Me.Controls.Count - 1 > If (Me.Controls(i).GetType().Equals(GetType(MdiClient))) Then > mc = Me.Controls(i) > End If > Next > > If (style = MdiLayout.TileHorizontal) Then > Dim frmheight As Integer = (mc.Size.Height - 4) / > Me.MdiChildren.Length > For i As Integer = 0 To Me.MdiChildren.Length - 1 > Me.MdiChildren(i).Top = i * frmheight > Me.MdiChildren(i).Left = 0 > Me.MdiChildren(i).Width = mc.Size.Width - 4 > Me.MdiChildren(i).Height = frmheight > Me.MdiChildren(i).WindowState = FormWindowState.Normal > Next > ElseIf (style = MdiLayout.TileVertical) Then > Dim frmwidth As Integer = (mc.Size.Width - 4) / > Me.MdiChildren.Length > For i As Integer = 0 To Me.MdiChildren.Length - 1 > Me.MdiChildren(i).Top = 0 > Me.MdiChildren(i).Left = i * frmwidth > Me.MdiChildren(i).Width = frmwidth > Me.MdiChildren(i).Height = mc.Size.Height - 4 > Me.MdiChildren(i).WindowState = FormWindowState.Normal > Next > End If > > End Sub > > Hope this helps. > If you have any question, please feel free to let me know. > > > Sincerely, > Linda Liu > Microsoft Online Community Support > |
|||||||||||||||||||||||