Results 1 to 7 of 7

Thread: [RESOLVED] How to handle MenuStripBar Layout?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2012
    Posts
    166

    Resolved [RESOLVED] How to handle MenuStripBar Layout?

    Hello again folks.
    I know the title sounds vague, so I'll cut to the chase.

    I have a MenuStripBar control, that holds several items. I'm able to show them all if I keep my main form window maximized at all times, but if I resize it (i.e. check several windows), a few of those items will be hidden.

    So, what's the best approach to handle this situation? Add a button when there's items that are hidden and when you press that button, the remaining menus will be displayed as a submenu from that button? Add buttons to navigate the MenuStripBar control?
    None of the mentioned before?

    I'm up for any ideas, preferably the most efficiente ones

    Note: If my explanation or questions weren't clear enough, let me know and I'll post a few images.
    Last edited by Simbiose; Sep 16th, 2014 at 04:35 AM. Reason: Messed up the contents of the thread ...

  2. #2
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: How to handle ToolStripBar Layout?

    what's the best approach to handle this situation? Add a button when there's items that are hidden and when you press that button, the remaining menus will be displayed as a submenu from that button?
    This is what the ToolStrip control do by default! when the form resized and there isn't enough space to show all button, a dropdown button appears which show the hidden buttons as menu.

    Yo can also change that by setting the property LayoutStyle to Flow



  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2012
    Posts
    166

    Re: How to handle ToolStripBar Layout?

    Quote Originally Posted by 4x2y View Post
    This is what the ToolStrip control do by default! when the form resized and there isn't enough space to show all button, a dropdown button appears which show the hidden buttons as menu.

    Yo can also change that by setting the property LayoutStyle to Flow
    Oh crap I messed up!

    I meant about the MenuStripBar control, not the ToolStripBar control.
    Sorry about that. I've fixed my post and thread x.x

  4. #4
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: How to handle MenuStripBar Layout?

    Try CanOverflow , Overflow ?
    Code:
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    
        MenuStrip1.CanOverflow = True
        For i = 0 To MenuStrip1.Items.Count - 1
            MenuStrip1.Items(i).Overflow = ToolStripItemOverflow.AsNeeded
        Next
    
    End Sub

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2012
    Posts
    166

    Re: How to handle MenuStripBar Layout?

    Quote Originally Posted by Edgemeal View Post
    Try CanOverflow , Overflow ?
    Code:
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    
        MenuStrip1.CanOverflow = True
        For i = 0 To MenuStrip1.Items.Count - 1
            MenuStrip1.Items(i).Overflow = ToolStripItemOverflow.AsNeeded
        Next
    
    End Sub
    Oh wow, I had no idea there was such a method built-in for MenuStripBar control O.o
    Thanks a lot

    Now I just need to apply the same logic to the StatusStripBar control :P

  6. #6
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: How to handle MenuStripBar Layout?

    Quote Originally Posted by Simbiose View Post
    Oh wow, I had no idea there was such a method built-in for MenuStripBar control O.o
    Thanks a lot

    Now I just need to apply the same logic to the StatusStripBar control :P
    The sizing grip makes it really hard to select the button in the StatusStrip, if I disable that it seems to work pretty good,
    Code:
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    
        MenuStrip1.CanOverflow = True
        MenuStrip1.LayoutStyle = ToolStripLayoutStyle.HorizontalStackWithOverflow
        For Each item As ToolStripItem In MenuStrip1.Items
            item.Overflow = ToolStripItemOverflow.AsNeeded
        Next
    
        StatusStrip1.SizingGrip = False
        StatusStrip1.CanOverflow = True
        StatusStrip1.LayoutStyle = ToolStripLayoutStyle.HorizontalStackWithOverflow
    
    End Sub
    Last edited by Edgemeal; Sep 16th, 2014 at 05:08 AM. Reason: REPOST

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2012
    Posts
    166

    Re: How to handle MenuStripBar Layout?

    Quote Originally Posted by Edgemeal View Post
    The sizing grip makes it really hard to select the button in the StatusStrip, if I disable that it seems to work pretty good,
    Code:
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    
        MenuStrip1.CanOverflow = True
        MenuStrip1.LayoutStyle = ToolStripLayoutStyle.HorizontalStackWithOverflow
        For Each item As ToolStripItem In MenuStrip1.Items
            item.Overflow = ToolStripItemOverflow.AsNeeded
        Next
    
        StatusStrip1.SizingGrip = False
        StatusStrip1.CanOverflow = True
        StatusStrip1.LayoutStyle = ToolStripLayoutStyle.HorizontalStackWithOverflow
    
    End Sub
    Yep, that works. However it's not suitable for my case, as I have a mute/unmute sound button on the farther right side on the StatusStripBar control.
    If apply your code, it'll be flowed along with all the other items as close as possible to the left

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