I'm trying to disable the ctrl+p command in a WPF application with Awesomium. When you press ctrl+p Awesomium saves a pdf from the document.
I try with JavaScript and c# code but nothing works.
JS (it open the window before the function):
$(document).ready(function (e) {
$('body').keydown(function (event) {
// alert('this');
if (event.which == 80 && event.ctrlKey) {
return false;
//alert('me');
}
});
});
C# (just ignore it):
myAwesomium.KeyDown +) KeyyDown;
private void KeyyDown(object sender, KeyEventArgs e)
{
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
{
#Something
}
}
you should use
PreviewKeyDownfor that. There you need to sete.Handled = true, this will stop processing the keyhandling.Hint: You should also set the
ContextMenuof theWebControlto a newContextMenuto prevent printing via the contextmenu entry.Hope that it help.