Exemple #1
0
 /// <summary>
 /// Handle key down event for selection, copy and scrollbars handling.
 /// </summary>
 protected override void OnKeyDown(KeyEventArgs e)
 {
     base.OnKeyDown(e);
     if (_htmlContainer != null)
     {
         _htmlContainer.HandleKeyDown(this, e);
     }
     if (e.KeyCode == Keys.Up)
     {
         VerticalScroll.Value = Math.Max(VerticalScroll.Value - 70, VerticalScroll.Minimum);
         PerformLayout();
     }
     else if (e.KeyCode == Keys.Down)
     {
         VerticalScroll.Value = Math.Min(VerticalScroll.Value + 70, VerticalScroll.Maximum);
         PerformLayout();
     }
     else if (e.KeyCode == Keys.PageDown)
     {
         VerticalScroll.Value = Math.Min(VerticalScroll.Value + 400, VerticalScroll.Maximum);
         PerformLayout();
     }
     else if (e.KeyCode == Keys.PageUp)
     {
         VerticalScroll.Value = Math.Max(VerticalScroll.Value - 400, VerticalScroll.Minimum);
         PerformLayout();
     }
     else if (e.KeyCode == Keys.End)
     {
         VerticalScroll.Value = VerticalScroll.Maximum;
         PerformLayout();
     }
     else if (e.KeyCode == Keys.Home)
     {
         VerticalScroll.Value = VerticalScroll.Minimum;
         PerformLayout();
     }
 }