Merge pull request #368 from d3agle/master

RemoteShell caret positioning fix
This commit is contained in:
MaxXor 2015-09-05 19:25:56 +02:00
commit 4927d1b230
2 changed files with 10 additions and 2 deletions

View File

@ -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);
}
}
}

View File

@ -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);
});
}