Results 1 to 5 of 5

Thread: MenuStrip's MdiWindowListItem

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2005
    Location
    Cebu
    Posts
    607

    MenuStrip's MdiWindowListItem

    More or less we do set our windowToolStripItem for this. Now, if all the MdiChilren are closed, why is it that there's a separator on the sub item of out window ToolStripItem? Is there any other property I should set for this? Something I missed or bug?

    Thanks.
    Attached Images Attached Images  

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2005
    Location
    Cebu
    Posts
    607

    Re: MenuStrip's MdiWindowListItem

    Bump?

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: MenuStrip's MdiWindowListItem

    That would appear to be a bit of a bug. You could work around that by only having the MdiWindowListItem set if there is at least one child showing. I wrote the code in VB by accident but you should be able to get the idea and implement it yourself in C#.
    vb Code:
    1. Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
    2.     Dim f As New Form
    3.  
    4.     f.Text = "Child " & (Me.MdiChildren.Length + 1)
    5.     Me.ShowMdiChildForm(f)
    6. End Sub
    7.  
    8. Private Sub ShowMdiChildForm(ByVal f As Form)
    9.     'There is at least one child form.
    10.     Me.MenuStrip1.MdiWindowListItem = Me.WindowToolStripMenuItem
    11.  
    12.     f.MdiParent = Me
    13.     AddHandler f.FormClosed, AddressOf Child_FormClosed
    14.     f.Show()
    15. End Sub
    16.  
    17. Private Sub Child_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs)
    18.     If Me.MdiChildren.Length = 1 Then
    19.         'This is the last child form.
    20.         Me.MenuStrip1.MdiWindowListItem = Nothing
    21.     End If
    22. End Sub
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2005
    Location
    Cebu
    Posts
    607

    Re: MenuStrip's MdiWindowListItem

    So it's a hack. Thanks JM, will look at it.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: MenuStrip's MdiWindowListItem

    Quote Originally Posted by nebulom
    So it's a hack.
    It's a workaround!
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width