Solved

.NET Context Menu Scroll Bars

Posted on 2011-03-11
17
1,346 Views
Last Modified: 2012-06-21
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
Comment
Question by:ablesa
  • 9
  • 8
17 Comments
 
LVL 13

Expert Comment

by:gamarrojgq
Comment Utility
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
 

Author Comment

by:ablesa
Comment Utility
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
 
LVL 13

Expert Comment

by:gamarrojgq
Comment Utility
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
 

Author Comment

by:ablesa
Comment Utility
i will give a shot.  thanks!  I'll report back here on whether that resolved.
0
 

Author Comment

by:ablesa
Comment Utility
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
 
LVL 13

Expert Comment

by:gamarrojgq
Comment Utility
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
 

Author Comment

by:ablesa
Comment Utility
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
 
LVL 13

Expert Comment

by:gamarrojgq
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:ablesa
Comment Utility
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
 
LVL 13

Expert Comment

by:gamarrojgq
Comment Utility
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
 

Author Comment

by:ablesa
Comment Utility
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
 
LVL 13

Expert Comment

by:gamarrojgq
Comment Utility
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
 

Author Comment

by:ablesa
Comment Utility
AutoSize is already true.  I have attached a screenshot from debugging...
AutoSizeTrue.doc
0
 
LVL 13

Accepted Solution

by:
gamarrojgq earned 500 total points
Comment Utility
ok, can you post a screenshot of how it looks the contextmenustrip when it is displayed?
0
 

Author Comment

by:ablesa
Comment Utility
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
 
LVL 13

Expert Comment

by:gamarrojgq
Comment Utility
It's not programming fun? :)  Great!!!! glad to help
0
 

Author Comment

by:ablesa
Comment Utility
If I were having any more fun, I don't think I could stand it.
:)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now