Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8175029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:37:12+00:00 2026-06-06T22:37:12+00:00

I have a program with a MenuStrip at the top, it currently has 4

  • 0

I have a program with a MenuStrip at the top, it currently has 4 items. What I’m essentially trying to do is make sure that all 4 of these menu items are visible if the user shrinks the width.

My initial attempt was to get the total number of items on the MenuStrip by simply grabbing the item collection then grab the bounds of the last item on the strip. After retrieving the bounds variable, I then do a quick calculation of the bounds.x + bounds.width to make sure that the form.width is not less than that, if so, it resizes. All of this takes place within the ResizeEnd event for the form.

private void F_Main_ResizeEnd(object sender, EventArgs e)
    {
        ToolStripItemCollection t_col = menuStrip1.Items;
        int _howMany = t_col.Count;
        var mi_bounds = t_col[_howMany - 1].Bounds;
        if (this.Width < (mi_bounds.X + mi_bounds.Width))
           this.Width = (mi_bounds.X + mi_bounds.Width);
    }

Now, the code seems to work, most of the time. I found that if I shrunk the form so that either the 2nd or 3rd item dissapeared, it resized too thin and left the 4th menu invisible. At that point, interestingly enough, if I simply clicked on the right edge of the form – as if I would be resizing but not moving the form, it would then recover to the correct width and display all 4 menu items.

What I found was that the bounds property of the toolstripmenuitem changed and was value {a} when I started resizing with all 4 showing and value {b} when only 3 were showing.

I’m now trying to figure out a more reliable way to make sure that all my menu items are visible and the form resize to the proper width.

Sorry if this doesn’t explain it properly as this is a weird problem for me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:37:13+00:00Added an answer on June 6, 2026 at 10:37 pm

    “I’m now trying to figure out a more reliable way to make sure that all my menu items are visible and the form resize to the proper width.”

    Using resize events to prevent the form being too small is a clunky way of doing it.

    I highly recommend you set the Forms Minimum Width and Height Properties.

    Edit:

    I’m suggesting these properties be set at run-time after the menu’s have been created &/or after new ones are added execute this (pseudo) code:

    ToolStripItemCollection t_col = menuStrip1.Items;
    int _howMany = t_col.Count;
    var mi_bounds = t_col[_howMany - 1].Bounds;
    if (this.Width < (mi_bounds.X + mi_bounds.Width))
    {
    var minimumFormHeight = 20;
    this.MinimumSize = new Size((mi_bounds.X + mi_bounds.Width), minimumFormHeight);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have program that has a variable that should never change. However, somehow, it
I have program, that has structure defined like this: struct foo { int magic;
I have a program that I'm trying to distribute with py2app. When I run
I have program with two files; main.py that has my main logic and class.py
I have program, that must interact with a console program before my program can
I have program that runs fast enough. I want to see the number of
I have a program that works with a variety of files on both the
I have a program that only allows one instance of itself to run. I
I have a program that looks something like this: public partial class It {
I have a program that receives real time data on 1000 topics. It receives

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.