473,287 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Handling Keyboard Shortcuts

BD
How can I duplicate the behavior of the operating system shortcut keys
in my application? For example, my windows form has 5 controls
(textboxes), the operating system will pickup which control has the
focus and handle ctrl-c, ctrl-v, or any other shortcuts. I have the
same shortcuts working in my app, but have not determined how to find
out which control has focus. Would I set up a loop or code for each
control at form level. Any help is greatly appreciated.

BD
Jun 27 '08 #1
8 5265
On Mon, 21 Apr 2008 13:41:19 -0700, BD <bw******@charter.netwrote:
How can I duplicate the behavior of the operating system shortcut keys
in my application? For example, my windows form has 5 controls
(textboxes), the operating system will pickup which control has the
focus and handle ctrl-c, ctrl-v, or any other shortcuts. I have the
same shortcuts working in my app, but have not determined how to find
out which control has focus.
I'm not sure you really understand how keyboard input happens. The OS
isn't doing anything special for control-modified keys. All it does is
make sure that the keyboard input is sent to whatever window has the
current focus, and that window deals with it.

In the case of .NET, each instance of Control has its own window, and when
the Control has focus, that means its window has focus and is receiving
keyboard input. Then it's simply a matter of the Control handling the
input as appropriate.

If you want your own custom control to handle keyboard input, you need to
make sure that your control can receive focus, and is handling the
keyboard input messages. Once you've done that, then if and when your
control actually has the focus, it will automatically receive the keyboard
input, which you can then inspect, looking for special key input such as
Ctrl-C, Ctrl-V, etc.

At no point should you need to worry about which control actually has the
focus. Assuming you've implemented your control properly, it will receive
keyboard input appropriately when it has focus, without any additional
effort from you.

Note that for your control to receive focus, its CanFocus property needs
to return "true" (i.e. set the ControlStyle.Selectable flag with the
SetStyle() method). You should also make sure that your control has some
visible representation that indicates when it has focus, which of course
means handling the focus events (e.g. override OnGotFocus(),
OnLostFocus()) so that you know when your state changes.

Pete
Jun 27 '08 #2
BD
On Apr 21, 4:17 pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Mon, 21 Apr 2008 13:41:19 -0700, BD <bwald...@charter.netwrote:
How can I duplicate the behavior of the operating system shortcut keys
in my application? For example, my windows form has 5 controls
(textboxes), the operating system will pickup which control has the
focus and handle ctrl-c, ctrl-v, or any other shortcuts. I have the
same shortcuts working in my app, but have not determined how to find
out which control has focus.

I'm not sure you really understand how keyboard input happens. The OS
isn't doing anything special for control-modified keys. All it does is
make sure that the keyboard input is sent to whatever window has the
current focus, and that window deals with it.

In the case of .NET, each instance of Control has its own window, and when
the Control has focus, that means its window has focus and is receiving
keyboard input. Then it's simply a matter of the Control handling the
input as appropriate.

If you want your own custom control to handle keyboard input, you need to
make sure that your control can receive focus, and is handling the
keyboard input messages. Once you've done that, then if and when your
control actually has the focus, it will automatically receive the keyboard
input, which you can then inspect, looking for special key input such as
Ctrl-C, Ctrl-V, etc.

At no point should you need to worry about which control actually has the
focus. Assuming you've implemented your control properly, it will receive
keyboard input appropriately when it has focus, without any additional
effort from you.

Note that for your control to receive focus, its CanFocus property needs
to return "true" (i.e. set the ControlStyle.Selectable flag with the
SetStyle() method). You should also make sure that your control has some
visible representation that indicates when it has focus, which of course
means handling the focus events (e.g. override OnGotFocus(),
OnLostFocus()) so that you know when your state changes.

Pete
I do agree, I may not understand how keyboard input works, I have only
been learning programming for about the past two years on my own. I
perhaps didn't state my issue correctly. The form does use the
shortcuts but with a twist. This is why I posted the way I did. If
my form has the EDIT menu that has the general items inserted, 'ctrl-
v' will not work. However, if you do 'ctrl-shift-v' the program will
paste from the clipboard. If I remove the EDIT menu, 'ctrl-v' or any
of the other shortcuts will work correctly. That is why I thought the
OS was controlling the shortcut. I have looked on the net for some
time to find an answer or even an example of what I see and have come
up empty. I did try protected override bool ProcessCmdKey(ref Message
msg, Keys keyData), which will make the shortcuts work properly, but I
have to identify which textbox to process. That is why I thought I
needed to find out which control has the focus. Again, thanks for the
fast response to my question and I hope to hear from you about my
follow-up.

BD
Jun 27 '08 #3
On Mon, 21 Apr 2008 16:27:26 -0700, BD <bw******@charter.netwrote:
[...] If
my form has the EDIT menu that has the general items inserted, 'ctrl-
v' will not work. However, if you do 'ctrl-shift-v' the program will
paste from the clipboard. If I remove the EDIT menu, 'ctrl-v' or any
of the other shortcuts will work correctly. That is why I thought the
OS was controlling the shortcut.
I guess that depends on your definition of "OS". Based on your
description, it's possible that .NET is somehow treating your "EDIT" menu
as something special. One thing you might want to try is making sure that
the menu has the usual shortcut keys assigned to each item in the menu.

Beyond that, you will probably need to post a concise-but-complete code
sample that reliably demonstrates the problem. You can describe the issue
in plain English until you're blue in the face, but doing so will never
provide nearly as precise or accurate a description of the problem as an
actual working code sample.

Pete
Jun 27 '08 #4
BD
On Apr 21, 8:38 pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Mon, 21 Apr 2008 16:27:26 -0700, BD <bwald...@charter.netwrote:
[...] If
my form has the EDIT menu that has the general items inserted, 'ctrl-
v' will not work. However, if you do 'ctrl-shift-v' the program will
paste from the clipboard. If I remove the EDIT menu, 'ctrl-v' or any
of the other shortcuts will work correctly. That is why I thought the
OS was controlling the shortcut.

I guess that depends on your definition of "OS". Based on your
description, it's possible that .NET is somehow treating your "EDIT" menu
as something special. One thing you might want to try is making sure that
the menu has the usual shortcut keys assigned to each item in the menu.

Beyond that, you will probably need to post a concise-but-complete code
sample that reliably demonstrates the problem. You can describe the issue
in plain English until you're blue in the face, but doing so will never
provide nearly as precise or accurate a description of the problem as an
actual working code sample.

Pete
The app I am sending is a testing app that I created for control
testing. I just created it the other day. It has two forms, one form
to tell me the ASCII numbers of the keys I am pressing the main form
which is form1. Form1 is very simple with only two textboxes and two
labels. Textbox1 is a multi-line textbox. I used the standard menu
inserted by Visual Studio 2005 (file, edit, tools, help). The
following is the code I have from Form1.cs:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace TestingApplication
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

protected override bool ProcessCmdKey(ref Message msg, Keys
keyData)
{
const int WM_KEYDOWN = 0x100;
const int WM_SYSKEYDOWN = 0x104;

if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
{
switch (keyData)
{
case (Keys.V | Keys.Control):
textBox1.Text = Clipboard.GetText();
return true;
break;

case (Keys.C | Keys.Control):
if (textBox1.SelectedText != "")

Clipboard.SetDataObject(textBox1.SelectedText);
else
MessageBox.Show("There is no data to copy
to the clipboard.");
return true;
break;
}
}
return base.ProcessCmdKey(ref msg, keyData);
}

private void undoToolStripMenuItem_Click(object sender,
EventArgs e)
{
textBox1.Undo();
}

private void selectAllToolStripMenuItem_Click(object sender,
EventArgs e)
{
textBox1.SelectionStart = 0;
textBox1.SelectionLength = textBox1.TextLength;
}

private void editToolStripMenuItem_Click(object sender,
EventArgs e)
{
if (textBox1.SelectionLength == 0)
{
cutToolStripMenuItem.Enabled = false;
copyToolStripMenuItem.Enabled = false;
}
}

private void button1_Click(object sender, EventArgs e)
{
KeyCode frm = new KeyCode();
frm.Show();
frm.Focus();
}

If the designer code is needed, I will send it as well. Again, when
the 'edit' menu is there, shortcut keys for copy and paste for example
require the key combination 'ctrl+shift+c' or 'ctrl+shift+v'.
However, if the edit menu is removed, 'ctrl+c' or 'ctrl+v' work as
they are should.

BD
Jun 27 '08 #5
On Tue, 22 Apr 2008 05:17:33 -0700, BD <bw******@charter.netwrote:
[...]
If the designer code is needed, I will send it as well. Again, when
the 'edit' menu is there, shortcut keys for copy and paste for example
require the key combination 'ctrl+shift+c' or 'ctrl+shift+v'.
However, if the edit menu is removed, 'ctrl+c' or 'ctrl+v' work as
they are should.
Inasmuch as your question seems to be specifically related to the exact
configuration of the menus, you should either create the menus
programmatically in the Form1 class, or you should post the complete
Designer code for the test application.

Pete
Jun 27 '08 #6
BD
On Apr 22, 1:47 pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Tue, 22 Apr 2008 05:17:33 -0700, BD <bwald...@charter.netwrote:
[...]
If the designer code is needed, I will send it as well. Again, when
the 'edit' menu is there, shortcut keys for copy and paste for example
require the key combination 'ctrl+shift+c' or 'ctrl+shift+v'.
However, if the edit menu is removed, 'ctrl+c' or 'ctrl+v' work as
they are should.

Inasmuch as your question seems to be specifically related to the exact
configuration of the menus, you should either create the menus
programmatically in the Form1 class, or you should post the complete
Designer code for the test application.

Pete
Here is the designer code:
namespace TestingApplication
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should
be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources =
new System.ComponentModel.ComponentResourceManager(typ eof(Form1));
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.statusStrip1 = new
System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new
System.Windows.Forms.ToolStripStatusLabel();
this.toolStripProgressBar1 = new
System.Windows.Forms.ToolStripProgressBar();
this.fileToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.newToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator = new
System.Windows.Forms.ToolStripSeparator();
this.saveToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.saveAsToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new
System.Windows.Forms.ToolStripSeparator();
this.printToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.printPreviewToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new
System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.toolsToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.customizeToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.optionsToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.helpToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.contentsToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.indexToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.searchToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator5 = new
System.Windows.Forms.ToolStripSeparator();
this.aboutToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.editToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.undoToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.redoToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new
System.Windows.Forms.ToolStripSeparator();
this.cutToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.copyToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.pasteToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new
System.Windows.Forms.ToolStripSeparator();
this.selectAllToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.button1 = new System.Windows.Forms.Button();
this.statusStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(16, 36);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(66, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Sample Text";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(16, 196);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(35, 13);
this.label2.TabIndex = 2;
this.label2.Text = "label2";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(16, 262);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(35, 13);
this.label3.TabIndex = 3;
this.label3.Text = "label3";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(16, 302);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(35, 13);
this.label4.TabIndex = 4;
this.label4.Text = "label4";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(16, 347);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(35, 13);
this.label5.TabIndex = 5;
this.label5.Text = "label5";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(88, 36);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(341, 146);
this.textBox1.TabIndex = 6;
this.textBox1.KeyDown += new
System.Windows.Forms.KeyEventHandler(this.textBox1 _KeyDown);
this.textBox1.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.tex tBox1_KeyPress);
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(88,
193);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 20);
this.textBox2.TabIndex = 7;
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new
System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1,
this.toolStripProgressBar1});
this.statusStrip1.Location = new System.Drawing.Point(0,
414);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(855, 22);
this.statusStrip1.TabIndex = 8;
this.statusStrip1.Text = "statusStrip1";
//
// toolStripStatusLabel1
//
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
this.toolStripStatusLabel1.Size = new
System.Drawing.Size(740, 17);
this.toolStripStatusLabel1.Spring = true;
this.toolStripStatusLabel1.Text = "toolStripStatusLabel1";
//
// toolStripProgressBar1
//
this.toolStripProgressBar1.Name = "toolStripProgressBar1";
this.toolStripProgressBar1.Size = new
System.Drawing.Size(100, 16);
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange( new
System.Windows.Forms.ToolStripItem[] {
this.newToolStripMenuItem,
this.openToolStripMenuItem,
this.toolStripSeparator,
this.saveToolStripMenuItem,
this.saveAsToolStripMenuItem,
this.toolStripSeparator1,
this.printToolStripMenuItem,
this.printPreviewToolStripMenuItem,
this.toolStripSeparator2,
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new
System.Drawing.Size(35, 20);
this.fileToolStripMenuItem.Text = "&File";
//
// newToolStripMenuItem
//
this.newToolStripMenuItem.Image = ((System.Drawing.Image)
(resources.GetObject("newToolStripMenuItem.Image") ));
this.newToolStripMenuItem.ImageTransparentColor =
System.Drawing.Color.Magenta;
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
this.newToolStripMenuItem.ShortcutKeys =
((System.Windows.Forms.Keys)((System.Windows.Forms .Keys.Control |
System.Windows.Forms.Keys.N)));
this.newToolStripMenuItem.Size = new
System.Drawing.Size(151, 22);
this.newToolStripMenuItem.Text = "&New";
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Image = ((System.Drawing.Image)
(resources.GetObject("openToolStripMenuItem.Image" )));
this.openToolStripMenuItem.ImageTransparentColor =
System.Drawing.Color.Magenta;
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.ShortcutKeys =
((System.Windows.Forms.Keys)((System.Windows.Forms .Keys.Control |
System.Windows.Forms.Keys.O)));
this.openToolStripMenuItem.Size = new
System.Drawing.Size(151, 22);
this.openToolStripMenuItem.Text = "&Open";
//
// toolStripSeparator
//
this.toolStripSeparator.Name = "toolStripSeparator";
this.toolStripSeparator.Size = new
System.Drawing.Size(148, 6);
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Image = ((System.Drawing.Image)
(resources.GetObject("saveToolStripMenuItem.Image" )));
this.saveToolStripMenuItem.ImageTransparentColor =
System.Drawing.Color.Magenta;
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.ShortcutKeys =
((System.Windows.Forms.Keys)((System.Windows.Forms .Keys.Control |
System.Windows.Forms.Keys.S)));
this.saveToolStripMenuItem.Size = new
System.Drawing.Size(151, 22);
this.saveToolStripMenuItem.Text = "&Save";
//
// saveAsToolStripMenuItem
//
this.saveAsToolStripMenuItem.Name =
"saveAsToolStripMenuItem";
this.saveAsToolStripMenuItem.Size = new
System.Drawing.Size(151, 22);
this.saveAsToolStripMenuItem.Text = "Save &As";
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new
System.Drawing.Size(148, 6);
//
// printToolStripMenuItem
//
this.printToolStripMenuItem.Image = ((System.Drawing.Image)
(resources.GetObject("printToolStripMenuItem.Image ")));
this.printToolStripMenuItem.ImageTransparentColor =
System.Drawing.Color.Magenta;
this.printToolStripMenuItem.Name =
"printToolStripMenuItem";
this.printToolStripMenuItem.ShortcutKeys =
((System.Windows.Forms.Keys)((System.Windows.Forms .Keys.Control |
System.Windows.Forms.Keys.P)));
this.printToolStripMenuItem.Size = new
System.Drawing.Size(151, 22);
this.printToolStripMenuItem.Text = "&Print";
//
// printPreviewToolStripMenuItem
//
this.printPreviewToolStripMenuItem.Image =
((System.Drawing.Image)
(resources.GetObject("printPreviewToolStripMenuIte m.Image")));
this.printPreviewToolStripMenuItem.ImageTransparen tColor =
System.Drawing.Color.Magenta;
this.printPreviewToolStripMenuItem.Name =
"printPreviewToolStripMenuItem";
this.printPreviewToolStripMenuItem.Size = new
System.Drawing.Size(151, 22);
this.printPreviewToolStripMenuItem.Text = "Print
Pre&view";
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new
System.Drawing.Size(148, 6);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new
System.Drawing.Size(151, 22);
this.exitToolStripMenuItem.Text = "E&xit";
//
// toolsToolStripMenuItem
//
this.toolsToolStripMenuItem.DropDownItems.AddRange (new
System.Windows.Forms.ToolStripItem[] {
this.customizeToolStripMenuItem,
this.optionsToolStripMenuItem});
this.toolsToolStripMenuItem.Name =
"toolsToolStripMenuItem";
this.toolsToolStripMenuItem.Size = new
System.Drawing.Size(44, 20);
this.toolsToolStripMenuItem.Text = "&Tools";
//
// customizeToolStripMenuItem
//
this.customizeToolStripMenuItem.Name =
"customizeToolStripMenuItem";
this.customizeToolStripMenuItem.Size = new
System.Drawing.Size(134, 22);
this.customizeToolStripMenuItem.Text = "&Customize";
//
// optionsToolStripMenuItem
//
this.optionsToolStripMenuItem.Name =
"optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new
System.Drawing.Size(134, 22);
this.optionsToolStripMenuItem.Text = "&Options";
//
// helpToolStripMenuItem
//
this.helpToolStripMenuItem.DropDownItems.AddRange( new
System.Windows.Forms.ToolStripItem[] {
this.contentsToolStripMenuItem,
this.indexToolStripMenuItem,
this.searchToolStripMenuItem,
this.toolStripSeparator5,
this.aboutToolStripMenuItem});
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
this.helpToolStripMenuItem.Size = new
System.Drawing.Size(40, 20);
this.helpToolStripMenuItem.Text = "&Help";
//
// contentsToolStripMenuItem
//
this.contentsToolStripMenuItem.Name =
"contentsToolStripMenuItem";
this.contentsToolStripMenuItem.Size = new
System.Drawing.Size(129, 22);
this.contentsToolStripMenuItem.Text = "&Contents";
//
// indexToolStripMenuItem
//
this.indexToolStripMenuItem.Name =
"indexToolStripMenuItem";
this.indexToolStripMenuItem.Size = new
System.Drawing.Size(129, 22);
this.indexToolStripMenuItem.Text = "&Index";
//
// searchToolStripMenuItem
//
this.searchToolStripMenuItem.Name =
"searchToolStripMenuItem";
this.searchToolStripMenuItem.Size = new
System.Drawing.Size(129, 22);
this.searchToolStripMenuItem.Text = "&Search";
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new
System.Drawing.Size(126, 6);
//
// aboutToolStripMenuItem
//
this.aboutToolStripMenuItem.Name =
"aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new
System.Drawing.Size(129, 22);
this.aboutToolStripMenuItem.Text = "&About...";
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new
System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.editToolStripMenuItem,
this.toolsToolStripMenuItem,
this.helpToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(855, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// editToolStripMenuItem
//
this.editToolStripMenuItem.DropDownItems.AddRange( new
System.Windows.Forms.ToolStripItem[] {
this.undoToolStripMenuItem,
this.redoToolStripMenuItem,
this.toolStripSeparator3,
this.cutToolStripMenuItem,
this.copyToolStripMenuItem,
this.pasteToolStripMenuItem,
this.toolStripSeparator4,
this.selectAllToolStripMenuItem});
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new
System.Drawing.Size(37, 20);
this.editToolStripMenuItem.Text = "&Edit";
this.editToolStripMenuItem.Click += new
System.EventHandler(this.editToolStripMenuItem_Cli ck);
//
// undoToolStripMenuItem
//
this.undoToolStripMenuItem.Name = "undoToolStripMenuItem";
this.undoToolStripMenuItem.ShortcutKeys =
((System.Windows.Forms.Keys)((System.Windows.Forms .Keys.Control |
System.Windows.Forms.Keys.Z)));
this.undoToolStripMenuItem.Size = new
System.Drawing.Size(150, 22);
this.undoToolStripMenuItem.Text = "&Undo";
this.undoToolStripMenuItem.Click += new
System.EventHandler(this.undoToolStripMenuItem_Cli ck);
//
// redoToolStripMenuItem
//
this.redoToolStripMenuItem.Name = "redoToolStripMenuItem";
this.redoToolStripMenuItem.ShortcutKeys =
((System.Windows.Forms.Keys)((System.Windows.Forms .Keys.Control |
System.Windows.Forms.Keys.Y)));
this.redoToolStripMenuItem.Size = new
System.Drawing.Size(150, 22);
this.redoToolStripMenuItem.Text = "&Redo";
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new
System.Drawing.Size(147, 6);
//
// cutToolStripMenuItem
//
this.cutToolStripMenuItem.Image = ((System.Drawing.Image)
(resources.GetObject("cutToolStripMenuItem.Image") ));
this.cutToolStripMenuItem.ImageTransparentColor =
System.Drawing.Color.Magenta;
this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";
this.cutToolStripMenuItem.ShortcutKeys =
((System.Windows.Forms.Keys)((System.Windows.Forms .Keys.Control |
System.Windows.Forms.Keys.X)));
this.cutToolStripMenuItem.Size = new
System.Drawing.Size(150, 22);
this.cutToolStripMenuItem.Text = "Cu&t";
//
// copyToolStripMenuItem
//
this.copyToolStripMenuItem.Image = ((System.Drawing.Image)
(resources.GetObject("copyToolStripMenuItem.Image" )));
this.copyToolStripMenuItem.ImageTransparentColor =
System.Drawing.Color.Magenta;
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.ShortcutKeys =
((System.Windows.Forms.Keys)((System.Windows.Forms .Keys.Control |
System.Windows.Forms.Keys.C)));
this.copyToolStripMenuItem.Size = new
System.Drawing.Size(167, 22);
this.copyToolStripMenuItem.Text = "&Copy";
this.copyToolStripMenuItem.Click += new
System.EventHandler(this.copyToolStripMenuItem_Cli ck);
//
// pasteToolStripMenuItem
//
this.pasteToolStripMenuItem.Image = ((System.Drawing.Image)
(resources.GetObject("pasteToolStripMenuItem.Image ")));
this.pasteToolStripMenuItem.ImageTransparentColor =
System.Drawing.Color.Magenta;
this.pasteToolStripMenuItem.Name =
"pasteToolStripMenuItem";
this.pasteToolStripMenuItem.ShortcutKeys =
((System.Windows.Forms.Keys)((System.Windows.Forms .Keys.Control |
System.Windows.Forms.Keys.V)));
this.pasteToolStripMenuItem.Size = new
System.Drawing.Size(150, 22);
this.pasteToolStripMenuItem.Text = "&Paste";
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new
System.Drawing.Size(147, 6);
//
// selectAllToolStripMenuItem
//
this.selectAllToolStripMenuItem.Name =
"selectAllToolStripMenuItem";
this.selectAllToolStripMenuItem.ShortcutKeys =
((System.Windows.Forms.Keys)((System.Windows.Forms .Keys.Control |
System.Windows.Forms.Keys.A)));
this.selectAllToolStripMenuItem.Size = new
System.Drawing.Size(167, 22);
this.selectAllToolStripMenuItem.Text = "Select &All";
this.selectAllToolStripMenuItem.Click += new
System.EventHandler(this.selectAllToolStripMenuIte m_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(590,
287);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(152, 23);
this.button1.TabIndex = 9;
this.button1.Text = "Key Code Info Form";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new
System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F,
13F);
this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(855, 436);
this.Controls.Add(this.button1);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "Form1";
this.Text = "Form1";
this.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.For m1_KeyPress);
this.KeyDown += new
System.Windows.Forms.KeyEventHandler(this.Form1_Ke yDown);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel
toolStripStatusLabel1;
private System.Windows.Forms.ToolStripProgressBar
toolStripProgressBar1;
private System.Windows.Forms.ToolStripMenuItem
fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
newToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
openToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator
toolStripSeparator;
private System.Windows.Forms.ToolStripMenuItem
saveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
saveAsToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator
toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem
printToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
printPreviewToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator
toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem
exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
toolsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
customizeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
optionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
helpToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
contentsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
indexToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
searchToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator
toolStripSeparator5;
private System.Windows.Forms.ToolStripMenuItem
aboutToolStripMenuItem;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem
editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
undoToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
redoToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator
toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem
cutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
copyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
pasteToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator
toolStripSeparator4;
private System.Windows.Forms.ToolStripMenuItem
selectAllToolStripMenuItem;
private System.Windows.Forms.Button button1;
}
}

Jun 27 '08 #7
On Tue, 22 Apr 2008 12:58:40 -0700, BD <bw******@charter.netwrote:
Here is the designer code: [...]
Okay. Now post a _concise_ version. Include absolutely _nothing_ that is
not fundamentally required to demonstrate the issue.

If you're having trouble understanding what I mean, or why this is
important, you may find Jon Skeet's article on the topic useful:
http://www.skeet.org.uk/csharp/complete.html

Pete
Jun 27 '08 #8
BD
On Apr 22, 4:56 pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Tue, 22 Apr 2008 12:58:40 -0700, BD <bwald...@charter.netwrote:
Here is the designer code: [...]

Okay. Now post a _concise_ version. Include absolutely _nothing_ that is
not fundamentally required to demonstrate the issue.

If you're having trouble understanding what I mean, or why this is
important, you may find Jon Skeet's article on the topic useful: http://www.skeet.org.uk/csharp/complete.html

Pete
Would it be better if I sent a compiled version to your email?
Jun 27 '08 #9

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

Similar topics

1
by: Spartanicus | last post by:
Some use the kbd element (Example: <kbd>Ctrl</kbd>+<kbd>G</kbd>) to mark up keyboard shortcuts, but the spec defines kbd as: "Indicates *text* to be entered by the user." (emphasis mine). UA...
0
by: ekta | last post by:
How do we write the code for Keyboard shortcuts in asp.net(c#).Is it possible through javascript only or there is any method/property availaible (like Accesskey) in asp.net. Thanks
5
by: bob lambert | last post by:
Hi, I have a vb .net std 2002 windows form app and wanted to use keyboard shortcuts (& in text property input) It shows up on the design view, but when I build (in debug mode) and display the...
4
by: Helene Day | last post by:
Sorry, this could be a newby question... but how do we do the keyboard shortcuts in .NET buttonname.text = "&Click Me" Does not give the short cut Alt-C for the button. Helene
0
by: Mishaev Mark | last post by:
Hi all, How can I disable the standard keyboard shortcuts that are automatically processed by Visio (Ctrl-D for example)? I've tried to use KeyUp event to set "CancelDefault" property to...
1
by: Erland | last post by:
Hello, I am using asp.net 2.0 and I want to add keyboard shortcuts to my application just like the shortcuts you see in GMAIL. I was wondering how can I do this in ASP.NET? Scenerio that would...
0
by: Zytan | last post by:
I cannot use & to implement a keyboard shortcut on a TabPage like I can on a Button. Is there a way to easily do this? Maybe TabPages aren't supposed to have keyboard shortcuts, but it would be...
331
by: Xah Lee | last post by:
http://xahlee.org/emacs/modernization.html ] The Modernization of Emacs ---------------------------------------- THE PROBLEM Emacs is a great editor. It is perhaps the most powerful and...
1
by: Gilbert Tordeur | last post by:
Hello, Context = Web site with VB2008. Is it possible to define keyboard shortcuts on a webpage, to make it possible for the user to "click" on a button or a link, or to set the focus on a...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.