How to capture Keyboard and Mouse input?
Moderators: SDS, support, admin
How to capture Keyboard and Mouse input?
Hello,
I would like to implement Keyboard Shortcut to the drawing. How can I capture the Keyboard input?
also, I would like to disable right mouse click. How can I do that also?
Thanks in advance.
I would like to implement Keyboard Shortcut to the drawing. How can I capture the Keyboard input?
also, I would like to disable right mouse click. How can I do that also?
Thanks in advance.
Re: How to capture Keyboard and Mouse input?
Hello,
You can capture key presses using the following CADViewX events:
AxCADViewX.OnKeyDown
AxCADViewX.OnKeyPress
To disable a pop-up menu (invoked by the right mouse click) you can use AxCADViewX.SelfPopupMenu property as shown below:
Mikhail
You can capture key presses using the following CADViewX events:
AxCADViewX.OnKeyDown
AxCADViewX.OnKeyPress
To disable a pop-up menu (invoked by the right mouse click) you can use AxCADViewX.SelfPopupMenu property as shown below:
Code: Select all
AxCADViewLib.AxCADViewX cadviewx1 = new AxCADViewLib.AxCADViewX();
cadviewx1.SelfPopupMenu = false;
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: How to capture Keyboard and Mouse input?
Hello,
Thanks for your reply. Setting SelfPopupMenu = false; worked for me. Thank you so much.
However,
I've tried
AxCADViewX.OnKeyDown
AxCADViewX.OnKeyPress
but there is no way for me to capture keys combination, like Ctrl + Shift + A. How can I do that please?
Thanks
Thanks for your reply. Setting SelfPopupMenu = false; worked for me. Thank you so much.
However,
I've tried
AxCADViewX.OnKeyDown
AxCADViewX.OnKeyPress
but there is no way for me to capture keys combination, like Ctrl + Shift + A. How can I do that please?
Thanks
Re: How to capture Keyboard and Mouse input?
Hello,
Have you tried the code below?
Mikhail
Have you tried the code below?
Code: Select all
private void axCADViewX1_OnKeyDown(object sender, AxCADViewLib.ICADViewXEvents_OnKeyDownEvent e)
{
if (e.shift == CADViewLib.TxShiftState.ssCtrl && e.shift == CADViewLib.TxShiftState.ssShift && e.key == 65)
{
MessageBox.Show("Ctrl+Shift+A is pressed");
}
}
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: How to capture Keyboard and Mouse input?
Hello,
yes I've tried the following code
But when I press the combination, no response. The event is not fired when I press any key
Thanks
yes I've tried the following code
Code: Select all
this.CADViewX1.OnKeyDown += new AxCADViewLib.ICADViewXEvents_OnKeyDownEventHandler(this.CADViewX1_OnKeyDown);
private void CADViewX1_OnKeyDown(object sender, AxCADViewLib.ICADViewXEvents_OnKeyDownEvent e)
{
if (e.shift == CADViewLib.TxShiftState.ssCtrl && e.shift == CADViewLib.TxShiftState.ssShift && e.key == 65)
{
MessageBox.Show("A");
}
}
Thanks
Re: How to capture Keyboard and Mouse input?
Hello,
The OnKeyDown event doesn't work, you can try to capture Ctrl+Shift+A keypress using a PreviewKeyDown event.
Mikhail
The OnKeyDown event doesn't work, you can try to capture Ctrl+Shift+A keypress using a PreviewKeyDown event.
Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: How to capture Keyboard and Mouse input?
Hello,
Thanks! PreviewKeyDown event worked!
Thanks! PreviewKeyDown event worked!