diff --git a/Server/Core/Helper/NativeMethodsHelper.cs b/Server/Core/Helper/NativeMethodsHelper.cs index 1aa8420b..1c4efba4 100644 --- a/Server/Core/Helper/NativeMethodsHelper.cs +++ b/Server/Core/Helper/NativeMethodsHelper.cs @@ -8,6 +8,9 @@ namespace xServer.Core.Helper private const int LVM_FIRST = 0x1000; private const int LVM_SETITEMSTATE = LVM_FIRST + 43; + private const int WM_VSCROLL = 277; + private const int SB_PAGEBOTTOM = 7; + public static int MakeLong(int wLow, int wHigh) { int low = (int)IntLoWord(wLow); @@ -31,5 +34,10 @@ namespace xServer.Core.Helper }; NativeMethods.SendMessageLVItem(handle, LVM_SETITEMSTATE, itemIndex, ref lvItem); } + + public static void ScrollToBottom(IntPtr handle) + { + NativeMethods.SendMessage(handle, WM_VSCROLL, SB_PAGEBOTTOM, 0); + } } } diff --git a/Server/Forms/FrmRemoteShell.cs b/Server/Forms/FrmRemoteShell.cs index 69f7d624..2579eb4a 100644 --- a/Server/Forms/FrmRemoteShell.cs +++ b/Server/Forms/FrmRemoteShell.cs @@ -43,8 +43,7 @@ namespace xServer.Forms private void txtConsoleOutput_TextChanged(object sender, EventArgs e) { - txtConsoleOutput.SelectionStart = txtConsoleOutput.TextLength; - txtConsoleOutput.ScrollToCaret(); + NativeMethodsHelper.ScrollToBottom(txtConsoleOutput.Handle); } private void txtConsoleInput_KeyDown(object sender, KeyEventArgs e) @@ -101,6 +100,7 @@ namespace xServer.Forms { txtConsoleOutput.Invoke((MethodInvoker)delegate { + txtConsoleOutput.SelectionColor = Color.WhiteSmoke; txtConsoleOutput.AppendText(message); }); }