منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
[VB.NET] كيفية الانتقال لسطر جديد في السطور الطويلة - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : [VB.NET] كيفية الانتقال لسطر جديد في السطور الطويلة (/showthread.php?tid=33318)



كيفية الانتقال لسطر جديد في السطور الطويلة - Naefabdo - 06-02-20

السلام عليكم ورحمة الله وبركاته 

اخواني ممكن مساعدة في هذا الكود 

بحيث اذا كان السطر طويل ينتقل لسطر جديد

هذا الكود 

كود :
Public Sub addlog(ByVal s As String)
       Dim path As String = (Application.StartupPath & "\Logs")
       If Not Directory.Exists(path) Then
           MkDir(path)
       End If
       Dim str2 As String = String.Format((path & "\{0}.txt"), DateTime.Today.ToString("dd-MMM-yyyy"))
       Dim flag As Boolean = File.Exists(str2)
       Using writer As StreamWriter = New StreamWriter(str2, True)
           If Not flag Then
               writer.WriteLine("Start Log for today")
           End If
           writer.WriteLine((Conversions.ToString(DateTime.Now) & " -- " & s))
       End Using
       Me.RichTextBox1.AppendText((s & ChrW(13) & ChrW(10)))
       Me.RichTextBox1.ScrollToCaret()
       Application.DoEvents()

       If (Enumerable.Count(Of String)(Me.RichTextBox1.Lines) = &H1388) Then
           Me.RichTextBox1.Clear()
       End If
   End Sub

   
   Public Sub addlog(ByVal s As String, ByVal color As Color, ByVal isBold As Boolean, ByVal Optional newline As Boolean = False)
       Dim box As RichTextBox = Me.RichTextBox1
       If (newline AndAlso (box.TextLength > 0)) Then
           box.AppendText(ChrW(13) & ChrW(10))
       End If
       box.SelectionStart = box.Text.Length
       Dim selectionColor As Color = box.SelectionColor
       box.SelectionColor = color
       If isBold Then
           box.SelectionFont = New Font(box.Font, FontStyle.Bold)
       End If
       box.AppendText( s)
       box.SelectionColor = selectionColor
       box.SelectionFont = New Font(box.Font, FontStyle.Regular)
       box.ScrollToCaret()
       box = Nothing
   End Sub