• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1578
  • Last Modified:

.NET Context Menu Scroll Bars

I have an application that dynamically adds values to create a context menu.  This context menu at times can become large...  When it is too large to show in the area of the form that it shows in, rather than showing a vertical scrollbar, it just displays the context menu off of the screen so that the user cannot select those items.

I thought scrollbars would be an automatic for context menus, but I can't find evidence of that.

Is there a way to make the context menu have a vertical scroll bar?

Thanks!
0
ablesa
Asked:
ablesa
  • 9
  • 8
1 Solution
 
gamarrojgqCommented:
Hi,

Wich version of VS are you using? in VS2010 is a know bug, and you need to install a hotfix, you can find it in the link below

http://blogs.msdn.com/b/visualstudio/archive/2010/10/14/hotfixes-available-for-scrolling-context-menu-problem.aspx
0
 
ablesaAuthor Commented:
I'm using vs2010.  I did read about the bug in VS2010, however, I got the impression that it was just a bug in the IDE...  not necessarily in apps developed with VS2010.  Can you confirm?  If so, I will download that fix...

Many thanks!
0
 
gamarrojgqCommented:
Well, VS2010 IDE use the same libraries that your project uses to manage the Context Menu, so if the patch fixs the IDE it have to fix you project.

Please download it and try
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
ablesaAuthor Commented:
i will give a shot.  thanks!  I'll report back here on whether that resolved.
0
 
ablesaAuthor Commented:
I installed the hotfixes for the scroll issue and it does not resolve my problem...  context menus in my app still don't have scrollbars...  And in reading more about the hotfix, it seems to fix a problem opposite of mine.  My problem is that scrollbars don't appear when they need to.  The hotfix addresses a problem where scrollbars appear when they don't need to.
Any other suggestions?

Thanks!
0
 
gamarrojgqCommented:
Ok, do you really need that the context menu grow that big? can you use Sub menus to prevent the options to be bigger than the screen?

Another thing you can check (just in case) is that the AutoSize and LayoutStyle properties of your Context Menu, are setting to True and Flow

The context Menu won't show you a Standard Scrollbar, but two Up and Down buttons to make the contextmenu scroll
0
 
ablesaAuthor Commented:
no... i can't use sub menus...  the context menu is on a grid and it contains items to filter the column by...  In other words, the items on the context menu are all the distinct values in the associated column.  So, if there are a lot of rows in teh grid and a lot of distinct items in teh column, the context menu can be a little big...

It does have autosize=true and layoutstyle = flow.  

Any other ideas?

Thanks for your help.
0
 
gamarrojgqCommented:
ok, have you tried to installa the application in another machine and see if there happens the same thing?

Perhaps it is only in you environment and will be no problem for your deploy
0
 
ablesaAuthor Commented:
I have tried on another machine and the same thing happens...  it just displays the number of items that it can for the screen and the menu is cut-off there...  no up/down buttons and no scrollbar..  
I debugged a little more on this.  When running in debug mode and looking at the ContextMenuStrip, it shows an AutoScroll property set to false.  At design time, I do not see this property on the control.  If I try to set AutoScroll propertty to true in the code, at runtime, I get the error "ToolStrip doesn't support the AutoScroll property."
Not sure what else to try...
0
 
gamarrojgqCommented:
Ok a ToolStrip is different from a ContextMenuStrip, the ToolStrip is a ToolBar and does not have the AutoScroll property, a ContextMenuStrip if a normal DropDown Menu.

Are you sure you are setting the property to the right control?

Can you post your code to try to see if there is something there?
0
 
ablesaAuthor Commented:
I know what the error message says, but this control is really a ContextMenuStrip.  I'm confused as to why the error message refers to a toolStrip.    Yes...I'm setting the property to the right control.  I can't post all of my code.  This is in a user control and there's a lot of code there.  I have attached the code that defines, initializes and assigns it to the grid.
ContextMenuStrip.doc
0
 
gamarrojgqCommented:
ok, lets try it step by step, in your previous post you said that in debug mode you can see an AutoScroll property set to false right? but this is nota valid property of a ContextMenuStrip, so try to use AutoSize instead.

0
 
ablesaAuthor Commented:
AutoSize is already true.  I have attached a screenshot from debugging...
AutoSizeTrue.doc
0
 
gamarrojgqCommented:
ok, can you post a screenshot of how it looks the contextmenustrip when it is displayed?
0
 
ablesaAuthor Commented:
OMG...  I was getting you a screenshot and decided to step further down into the code... I didn't write this particular user control.  Anyway, it turns out that the guy that did write it put a max cap on the number of items it puts on the menu...and that's why they weren't showing up!
I'm so sorry for putting you through this exercise.  I will award the points because I wouldn't have kept digging if you didn't hang in there with me, asking questions...
Appreciate your help!
0
 
gamarrojgqCommented:
It's not programming fun? :)  Great!!!! glad to help
0
 
ablesaAuthor Commented:
If I were having any more fun, I don't think I could stand it.
:)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now