Results 1 to 3 of 3

Thread: Richtextbox resized smaller, vertical scrollbar disappears. Any idea how to fix this?

  1. #1

    Thread Starter
    Fanatic Member Peter Porter's Avatar
    Join Date
    Jul 2013
    Location
    Germany
    Posts
    581

    Resolved Richtextbox resized smaller, vertical scrollbar disappears. Any idea how to fix this?

    I know the current version of Visual Studio has this bug fixed, but does anyone know of a way to correct this with VB 2010, 4.0 NET?

    I tried to programmatically double click the richtextbox when I resize the form to get the vertical scrollbar to reappear, but that doesn't work.

    Code:
    If Me.Height <= t Then
                RichTextBox2_DoubleClick(sender, e)
                t = Me.Height
    Else
    End If
    Any ideas besides upgrading?
    Last edited by Peter Porter; Jun 17th, 2018 at 04:55 PM.

  2. #2
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Richtextbox resized smaller, vertical scrollbar disappears. Any idea how to fix t

    Still using VB10 on Win7 here, When I have RTB resize with form (anchored on all sides) invalidating the RTB in forms resize-end event works here,...
    Code:
    Private Sub FrmMain_ResizeEnd(sender As Object, e As EventArgs) Handles Me.ResizeEnd
        RTB1.Invalidate()
    End Sub
    Other workarounds, might be to toogle the rtb ScrollBars property,
    http://www.vbforums.com/showthread.php?793671

  3. #3

    Thread Starter
    Fanatic Member Peter Porter's Avatar
    Join Date
    Jul 2013
    Location
    Germany
    Posts
    581

    Re: Richtextbox resized smaller, vertical scrollbar disappears. Any idea how to fix t

    Quote Originally Posted by Edgemeal View Post
    Still using VB10 on Win7 here, When I have RTB resize with form (anchored on all sides) invalidating the RTB in forms resize-end event works here,...
    Thanks Edgemeal! This did it for me:

    RichTextBox2.Invalidate(True)

    Also, to prevent that funky scroll to caret in the richtextbox while resizing the form, I give a hidden label focus in the form's 'Resize' event, and refocus the richtextbox on it's 'MouseEnter' event.

    Code:
    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize      
            Label1.Focus()
            RichTextBox2.Invalidate(True)
    End Sub
    
    
    Private Sub RichTextBox2_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles RichTextBox2.MouseEnter
            RichTextBox2.Focus()
    End Sub
    Last edited by Peter Porter; Jun 17th, 2018 at 05:38 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width