コード例 #1
0
 /// <summary>
 /// If the user hits the enter key, and event will fire (EnterKeyEvent),
 /// and the consumers of this event can cancel the projecessing of the
 /// enter key by cancelling the event.
 /// This is useful if your application would like to take some action
 /// when the enter key is pressed, such as a submission to a web service.
 /// </summary>
 /// <param name="sender">the sender</param>
 /// <param name="e">HtmlElementEventArgs</param>
 private void Body_KeyDown(object sender, HtmlElementEventArgs e)
 {
     if (e.KeyPressedCode == 13 && !e.ShiftKeyPressed)
     {
         // handle enter code cancellation
         bool cancel = false;
         if (EnterKeyEvent != null)
         {
             EnterKeyEventArgs args = new EnterKeyEventArgs();
             EnterKeyEvent(this, args);
             cancel = args.Cancel;
         }
         e.ReturnValue = !cancel;
     }
 }
コード例 #2
0
ファイル: Editor.cs プロジェクト: aAmitSengar/WindowsEditor
 /// <summary>
 /// If the user hits the enter key, and event will fire (EnterKeyEvent), 
 /// and the consumers of this event can cancel the projecessing of the 
 /// enter key by cancelling the event.
 /// This is useful if your application would like to take some action 
 /// when the enter key is pressed, such as a submission to a web service.
 /// </summary>
 /// <param name="sender">the sender</param>
 /// <param name="e">HtmlElementEventArgs</param>
 private void Body_KeyDown(object sender, HtmlElementEventArgs e)
 {
     if (e.KeyPressedCode == 13 && !e.ShiftKeyPressed)
     {
         // handle enter code cancellation
         bool cancel = false;
         if (EnterKeyEvent != null)
         {
             EnterKeyEventArgs args = new EnterKeyEventArgs();
             EnterKeyEvent(this, args);
             cancel = args.Cancel;
         }
         e.ReturnValue = !cancel;
     }
 }
コード例 #3
0
ファイル: HtmlEditor.cs プロジェクト: tewuapple/WinHtmlEditor
 /// <summary>
 /// Set up a key listener on the body once.
 /// The key listener checks for specific key strokes and takes 
 /// special action in certain cases.
 /// </summary>
 /// <returns></returns>
 private bool SetupKeyListener()
 {
     // handle enter code cancellation
     bool cancel = false;
     if (!EnterKeyEvent.IsNull())
     {
         var args = new EnterKeyEventArgs();
         EnterKeyEvent(this, args);
         cancel = args.Cancel;
     }
     return cancel;
 }