neue version
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Drawing
|
||||
Imports System.Windows.Forms
|
||||
|
||||
Public Class MyRichTextBox
|
||||
Inherits System.Windows.Forms.RichTextBox
|
||||
|
||||
Property MaxLines_Warning As String = ""
|
||||
Property MaxLines_Warning_Label As Label = Nothing
|
||||
Property MaxLineLength As Integer = -1
|
||||
|
||||
|
||||
Private Sub MyTextBox_Leave(sender As Object, e As EventArgs) Handles Me.Leave
|
||||
If MaxLineLength > 0 Then
|
||||
Dim str() As String = Me.Lines
|
||||
For i = 0 To Me.Lines.Count - 1
|
||||
If str(i).Length > MaxLineLength Then
|
||||
str(i) = str(i).Substring(0, MaxLineLength)
|
||||
End If
|
||||
Next
|
||||
Me.Lines = str
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub MyTextBox_Textchanged(sender As Object, e As EventArgs) Handles Me.TextChanged
|
||||
'sender.ForeColor = System.Drawing.Color.Black
|
||||
|
||||
If Me.Multiline And IsNumeric(MaxLines_Warning) Then
|
||||
' If Me.Lines.Length > MaxLines Then
|
||||
If MaxLines_Warning_Label IsNot Nothing Then
|
||||
MaxLines_Warning_Label.Visible = CBool(Me.Lines.Length > MaxLines_Warning)
|
||||
End If
|
||||
'End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user