Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using Ctrl+E menu shortcut
Message
De
25/06/2008 14:02:30
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Titre:
Using Ctrl+E menu shortcut
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01326710
Message ID:
01326710
Vues:
68
If focused control is ReadOnly, menu shortcut key is ignored.

To reproduce, run code below, press Ctrl+E.
Note that message box does not appear.

This issue blocks Ctrl+E usage in application.
How to fix ?

Andrus.


using System;
using System.Windows.Forms;

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

class Form1 : Form
{
public Form1()
{
menuStrip1 = new MenuStrip();
fileToolStripMenuItem = new ToolStripMenuItem();
openToolStripMenuItem = new ToolStripMenuItem();
textBox1 = new TextBox();
menuStrip1.Items.AddRange(new ToolStripItem[] { fileToolStripMenuItem });
fileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { openToolStripMenuItem });
fileToolStripMenuItem.Text = "File";
openToolStripMenuItem.ShortcutKeys = ((Keys)((Keys.Control | Keys.E)));
openToolStripMenuItem.Text = "Open";
openToolStripMenuItem.Click += new System.EventHandler(openToolStripMenuItem_Click);
textBox1.Location = new System.Drawing.Point(55, 150);
textBox1.ReadOnly = true;
Controls.Add(textBox1);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
}

void openToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("Clicked");
}

MenuStrip menuStrip1;
ToolStripMenuItem fileToolStripMenuItem;
ToolStripMenuItem openToolStripMenuItem;
TextBox textBox1;
}
Andrus
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform