private void ScrollChange(object sender) { if (TLBox == null) { return; } int i = 0; while (i < TLBox.Text.Length && Engine.TextWidth(TLBox.Text.Substring(0, i++), TLBox.Font) < Scroll.Value) { continue; } int ni = 0; while (ni < TLBox.Text.Length && Engine.TextWidth(TLBox.Text.Substring(0, ni++), TLBox.Font) < Scroll.Value + Scroll.LargeChange) { continue; } if (ni == TLBox.Text.Length) { i = ni; } TLBox.Select(i, 0); TLBox.Focus(); }
private void Sroll_ValueChanged(object sender, EventArgs e) { //Update TextCursor ~ Force the cursor jump to end of the text if the scroll value is the max int i = 0; while (i < TLBox.Text.Length && Engine.TextWidth(TLBox.Text.Substring(0, i++), TLBox.Font) < Scroll.Value) { continue; } int ni = 0; while (ni < TLBox.Text.Length && Engine.TextWidth(TLBox.Text.Substring(0, ni++), TLBox.Font) < Scroll.Value + Scroll.LargeChange) { continue; } if (ni == TLBox.Text.Length) { i = ni; } TLBox.Select(i, 0); TLBox.Focus(); }