Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Visibility change causes menu items to scroll
Message
De
22/07/2008 14:39:26
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
Visibility change causes menu items to scroll
Versions des environnements
Environment:
C# 3.0
OS:
Vista
Divers
Thread ID:
01333256
Message ID:
01333256
Vues:
66
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 fileToolStripMenuItem = new ToolStripMenuItem();
        menuStrip1.Items.AddRange(new ToolStripItem[] { fileToolStripMenuItem });
        for (int i = 0; i < 10; i++)
        {
            var item = new ToolStripMenuItem("Item" + i.ToString());
            fileToolStripMenuItem.DropDownItems.Add(item);
            if (i < 5)
                item.Visible = false;
        }

        fileToolStripMenuItem.Text = "File";
        Controls.Add(menuStrip1);
        MainMenuStrip = menuStrip1;
    }
}
Andrus
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform