Richtextbox doubledlick and richtextbox resize causes text to be selected automatically.
Posted on 2006-10-27
This code works! This code captures "Doubleclicks" on a RichTextBox and then maximizes the richtextbox size. The problem is that some of the text in the richtextbox becomes selected automatically.
The problem is not the MaximizeRichTextbox subroutine. I've proven that.
Can you help me to stop the automatic text selection.
Private Sub txtrichbxMemo_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles txtrichbxMemo.MouseDown
Static lastclick As DateTime
If Convert.ToString(lastclick) = "#12:00:00 AM#" Then
lastclick = DateTime.Now : Exit Sub : End If
Dim Current_Time As DateTime = DateTime.Now
Dim diff As TimeSpan = Current_Time.Subtract(lastclick)
lastclick = DateTime.Now
If diff.Hours * 1000 + diff.Minutes * 1000 + _
diff.Seconds * 1000 + diff.Milliseconds < 500 Then MaximizeRichTextbox()