Wyświetlanie dużego stringu w małym TextBoxie po kolei

0

obecnie.png

chce osiągnąć to, ale....funkcja ma działać TYLKO WTEDY, gdy textbox NIE JEST ZAZNACZONY (edytowany)

cel.png

jak to osiągnąć ? :D

bo myslalem po prostu aby zrobić wciskanie klawiszy Pg UP i PG Down...ale to się będzie mijalo z celem :P i nie zda egzaminu =/

0

Zmieniaj HorzScroll

0

mi głównie chodzi o to , jak zrobić warunek "if textbox1 selected = false" czy cos w ten deseń

0
Private Sub TextBox6_GotFocus(sender As Object, e As EventArgs) Handles TextBox6.GotFocus
        TextBox6.BackColor = Color.Yellow
    End Sub
    Private Sub TextBox6_LostFocus(sender As Object, e As EventArgs) Handles TextBox6.LostFocus
        TextBox6.BackColor = Color.White
    End Sub

ok getfocus i lostfocus działa...ale odnośnie tych napisów..w jaki sposób zastosować te horzscroll ?

0

Timer Interval na 2000 i:

        Private Function GetVisibleCharsCount(TextBox As TextBox) As Integer
        Dim tmpText As String = ""
        GetVisibleCharsCount = 0
        Dim avg As Size
        For Each ch As Char In TextBox.Text.ToCharArray
            tmpText &= ch
            avg = TextRenderer.MeasureText(tmpText, TextBox.Font)
            If avg.Width <= TextBox.ClientRectangle.Width Then
                GetVisibleCharsCount += 1
            Else
                Exit Function
            End If
        Next
    End Function

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        If TextBox1.SelectionLength = 0 Then
            TextBox1.SelectionStart = GetVisibleCharsCount(TextBox1)
            TextBox1.SelectionLength = TextBox1.TextLength
            TextBox1.ScrollToCaret()
        Else
            TextBox1.SelectionStart = 0
            TextBox1.SelectionLength = 0
            TextBox1.ScrollToCaret()
        End If
    End Sub

1 użytkowników online, w tym zalogowanych: 0, gości: 1