Solved

.NET Context Menu Scroll Bars

Posted on 2011-03-11
17
1,450 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 8
17 Comments
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35112209
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
ID: 35112349
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
ID: 35112493
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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

Author Comment

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

Author Comment

by:ablesa
ID: 35129426
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
ID: 35129661
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
ID: 35159010
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
ID: 35159035
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
 

Author Comment

by:ablesa
ID: 35198175
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
ID: 35198605
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
ID: 35207407
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
ID: 35209161
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
ID: 35210413
AutoSize is already true.  I have attached a screenshot from debugging...
AutoSizeTrue.doc
0
 
LVL 13

Accepted Solution

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

Author Comment

by:ablesa
ID: 35210652
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
ID: 35210695
It's not programming fun? :)  Great!!!! glad to help
0
 

Author Comment

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

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

623 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