473,804 Members | 3,228 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Visibility change causes menu items to scroll (bug?)

To reproduce, run code, open file menu, press up and down arrows to move out
of menu.
Menu items are scrolled and blank items appears in end.

I need to change visibility of menu items at runtime.
How to fix this ?
Is this .NET 3.5 bug ?

Andrus.
using System.Windows. Forms;

static class Program
{
static void Main()
{
Application.Run (new Form1());
}
}

class Form1 : Form
{
public Form1()
{
var menuStrip1 = new MenuStrip();
var fileToolStripMe nuItem = new ToolStripMenuIt em();
menuStrip1.Item s.AddRange(new ToolStripItem[] {
fileToolStripMe nuItem });
for (int i = 0; i < 10; i++)
{
var item = new ToolStripMenuIt em("Item" + i.ToString());
fileToolStripMe nuItem.DropDown Items.Add(item) ;
if (i < 5)
item.Visible = false;
}

fileToolStripMe nuItem.Text = "File";
Controls.Add(me nuStrip1);
MainMenuStrip = menuStrip1;
}
}

Jul 22 '08 #1
2 2606
Andrus,

The only immediate workaround I can see would be to not add the items if
you are not going to make them visible. I took your example and didn't add
the items if they were not visible, and didn't get that effect.

I would definitely register this bug on the Microsoft Connect site.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Andrus" <ko********@hot .eewrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
To reproduce, run code, open file menu, press up and down arrows to move
out of menu.
Menu items are scrolled and blank items appears in end.

I need to change visibility of menu items at runtime.
How to fix this ?
Is this .NET 3.5 bug ?

Andrus.
using System.Windows. Forms;

static class Program
{
static void Main()
{
Application.Run (new Form1());
}
}

class Form1 : Form
{
public Form1()
{
var menuStrip1 = new MenuStrip();
var fileToolStripMe nuItem = new ToolStripMenuIt em();
menuStrip1.Item s.AddRange(new ToolStripItem[] {
fileToolStripMe nuItem });
for (int i = 0; i < 10; i++)
{
var item = new ToolStripMenuIt em("Item" + i.ToString());
fileToolStripMe nuItem.DropDown Items.Add(item) ;
if (i < 5)
item.Visible = false;
}

fileToolStripMe nuItem.Text = "File";
Controls.Add(me nuStrip1);
MainMenuStrip = menuStrip1;
}
}

Jul 22 '08 #2
The only immediate workaround I can see would be to not add the items
if you are not going to make them visible. I took your example and didn't
add the items if they were not visible, and didn't get that effect.
I have Winforms menu system designed using Windows forms Designer in MDI
parent form.
Some menu items may not be visible to user who logs in.

I have also command "login as different user" in this MDI parent form which
allows other user to log in without exiting main form.
For this command I need to make some other menu items visible.

How to make items visible/invisible in this case ?
I would definitely register this bug on the Microsoft Connect site.
Done.
https://connect.microsoft.com/Visual...dbackID=357453

Andrus.

Jul 23 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2615
by: Chris P. | last post by:
I've been having a problem with PythonWin that seemed to start completely spontaneously and I don't even know where to START to find the answer. The only thing I can think of that marks the point between "PythonWin works fine" and "PythonWin hardly every works fine" was that I changed the size of my Virtual Paging file, noticing that it was too small (I currently have a P4 with 1G of RAM). I tried returning it to its original (smaller)...
3
29686
by: Jukka K. Korpela | last post by:
I have noticed that the meaning of visibility: collapse has been discussed on different forums, but with no consensus on what it really means. Besides, implementations differ. The specification says: "The 'visibility' property takes the value 'collapse' for row, row group, column, and column group elements. This value causes the entire row or column to be removed from the display, and the space normally taken up by the row or column to...
3
1374
by: MrNobody | last post by:
I have a situation where I add over a hundred child MenuItems to a parent MenuItem. When I click the parent which shows a listing of all the child menu items, it is too big to fit on the page, so it has these up/down arrows so you can scroll through it. This is great, except this window it drew takes the entire height of my screen so it looks a little silly. How can I restrict the size of this menu, so it shows only like 20 menu items and...
1
1653
by: BIOSMonkey | last post by:
I am trying to develop a drop down menu control. I know there are many other scripts out there but I need to develop our own in house for licensing purposes. Anyway, I am in the beginning stages and am already having problems. So far all problems are in IE and not Firefox. I have a simple menu with just one button and one level of items that pop up below it. The list of items are A tags inside a DIV. The top level button is also a...
11
2635
by: -D- | last post by:
How can I turn the visibility of the xml control on or off? <%@ Control Language="c#" AutoEventWireup="false" Codebehind="TopNavBar.ascx.cs" Inherits="compass.user_controls.TopNavBar" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%> <table cellSpacing="0" cellPadding="0" border="0"> <colgroup span="1" align="left" width="50%"> </colgroup> <colgroup span="1" align="right" width="50%"> </colgroup>
0
1373
by: jojobar | last post by:
We are using the ASP:Menu control (horizontal) for site navigation. The menu is contained by a table with css styles that allows us to give the illusion of a menu bar that runs the entire width of the page. This table also has additional right aligned cells on the same row for such things as logging out. When the child menu items are displayed by the mouse hovering over a menu item, the width of the web page is apparently increasing,...
9
2434
by: timnels | last post by:
I have an issue where I have a user control that is launched into a floating form. At some point later, I allow the user to "unfloat" the user control by reparenting it on a split container in another form. Problem is if I wake a tooltip when the window is floated, and then try the same thing when it is reparented, the app crashes with " Cannot access a disposed object.Object name: 'Form'. Presumably, this is a result of the tooltips...
1
2160
by: Don Miller | last post by:
I have a one-level static menu control with 18 menu items. When displayed in a browser, the menu items do not wrap and the menu extends well past the browser window. Is there a property to control wrapping for a menu so that it automatically wraps to be one, two, three, etc. rows of menu items depending on the width of the browser window? There is a property "Item Wrap" but it only wraps the text within the item, and I've tried making...
4
4056
by: stuckagain | last post by:
Hi, I have a page with a scrollable DIV, and within that DIV, I have a few asp.net menu controls. The idea being, the user mouses over the small icons and is presented with a list of options. One of these lists has more data than the page allows for, so the menu control automatically creates the scroll up / scroll down commands at both ends of the menu. The problem is; since it is within a scrollable div, the menu scroller are hidden! ...
0
10589
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10327
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2999
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.