There is no method for programmatic scrolling of TerminalControl
in the current version, but you can use a workaround using OnMouseWheel method. It can be done like this:
public class MyTerminalControl : TerminalControl
{
private const int WHEEL_DELTA = 120;
/// <summary>
/// Scrolls the control.
/// </summary>
/// <param name="rows">Number of rows to scroll.</param>
public void Scroll(int rows)
{
MouseEventArgs e = new MouseEventArgs(0, 0, 0, 0, rows * WHEEL_DELTA);
base.OnMouseWheel(e);
}
protected override void OnKeyDown(KeyEventArgs e)
{
int delta = 0;
switch (e.KeyCode)
{
case Keys.PageUp:
if (e.Control)
delta = 1;
if (e.Shift)
delta = Screen.Rows;
break;
case Keys.PageDown:
if (e.Control)
delta = -1;
if (e.Shift)
delta = -Screen.Rows;
break;
}
if (delta != 0)
{
Scroll(delta);
return;
}
base.OnKeyDown(e);
}
}
On the form use the MyTerminalControl
instead of the TerminalControl
. Now you are able to scroll by hitting Ctrl+PageUp/Down (one line) and by hitting Shift+PageUp/Down (one screen).