G
Guest
I have a tabcontrol where I want to capture the CTRL+C key combination. My
tabcontrol has on its tabpages some treeView controls. My intention is to
intercept the event of pressing the CTRL+C when one of the controls embedded
in the tabControl has the focus. I'm doing this using the KeyDown event.
However, when pressing the CTRL+C my computer sounds a beep - as in 'not
allowed' beep. The capturing of the keycombination works fine, however, the
beep is unacceptable and must be removed.
Previously I've done this by using the KeyPress event and used a "e.Handled
= true;" command to avoid the beep. However, I cannot manage to capture the
CTRL+C key combination (I'm aware of the Controls.KeyModifier functionality
but not sure how to construct the clause that keys on the CTRL+C combination).
1) Does Anyone know how to capture the CTRL+C using the KeyPress event.
I've managed to remove the beep and keep program functionality intact using
the following:
private void tabControlTop_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}
....along with:
private void tabControlTop_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Z && e.Control)......ya da ya da
.....however I feel that it is somewhat of a 'hack' using the Handled
property in this way - merely showing my shortsommings in understanding what
generates the beep.
2) Any suggestions to how this should be done.
Best regards Jesper
tabcontrol has on its tabpages some treeView controls. My intention is to
intercept the event of pressing the CTRL+C when one of the controls embedded
in the tabControl has the focus. I'm doing this using the KeyDown event.
However, when pressing the CTRL+C my computer sounds a beep - as in 'not
allowed' beep. The capturing of the keycombination works fine, however, the
beep is unacceptable and must be removed.
Previously I've done this by using the KeyPress event and used a "e.Handled
= true;" command to avoid the beep. However, I cannot manage to capture the
CTRL+C key combination (I'm aware of the Controls.KeyModifier functionality
but not sure how to construct the clause that keys on the CTRL+C combination).
1) Does Anyone know how to capture the CTRL+C using the KeyPress event.
I've managed to remove the beep and keep program functionality intact using
the following:
private void tabControlTop_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}
....along with:
private void tabControlTop_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Z && e.Control)......ya da ya da
.....however I feel that it is somewhat of a 'hack' using the Handled
property in this way - merely showing my shortsommings in understanding what
generates the beep.
2) Any suggestions to how this should be done.
Best regards Jesper