|
-
Jun 16th, 2018, 07:21 PM
#1
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.
-
Jun 16th, 2018, 09:19 PM
#2
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
-
Jun 17th, 2018, 04:22 AM
#3
Re: Richtextbox resized smaller, vertical scrollbar disappears. Any idea how to fix t
 Originally Posted by Edgemeal
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|