تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[سؤال] استفسار مهم
#5
(22-07-19, 05:58 PM)سعود كتب : موضوع سؤال زي موضوعنا والجواب تحت زي جوابي هذاSmile
PHP كود :
Sub findTextAndHighlight(ByVal searchtext As StringByVal rtb As RichTextBox)
 
   Dim textEnd As Integer rtb.TextLength
    Dim index 
As Integer 0
    Dim fnt 
As Font = New Font(rtb.FontFontStyle.Bold)
 
   Dim lastIndex As Integer rtb.Text.LastIndexOf(searchtext)
 
   While (index lastIndex)
 
     rtb.Find(searchtextindextextEndRichTextBoxFinds.WholeWord)
 
     rtb.SelectionFont fnt
      rtb
.SelectionLength searchtext.Length
      rtb
.SelectionColor Color.Red
      rtb
.SelectionBackColor Color.Cyan
      index 
rtb.Text.IndexOf(searchtextindex) + 1
    End 
While
 
 End Sub

'============USAGE============

 Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
 '
this method with search for text "boy" in RichTextBox2change the textcolor to red and back color to cyan as indicated in the screenshot below 
 findTextAndHighlight
("boy"RichTextBox2  
 End Sub 
الجواب من ايدك يحلي اخ سعود

(22-07-19, 05:58 PM)سعود كتب : موضوع سؤال زي موضوعنا والجواب تحت زي جوابي هذاSmile
PHP كود :
Sub findTextAndHighlight(ByVal searchtext As StringByVal rtb As RichTextBox)
 
   Dim textEnd As Integer rtb.TextLength
    Dim index 
As Integer 0
    Dim fnt 
As Font = New Font(rtb.FontFontStyle.Bold)
 
   Dim lastIndex As Integer rtb.Text.LastIndexOf(searchtext)
 
   While (index lastIndex)
 
     rtb.Find(searchtextindextextEndRichTextBoxFinds.WholeWord)
 
     rtb.SelectionFont fnt
      rtb
.SelectionLength searchtext.Length
      rtb
.SelectionColor Color.Red
      rtb
.SelectionBackColor Color.Cyan
      index 
rtb.Text.IndexOf(searchtextindex) + 1
    End 
While
 
 End Sub

'============USAGE============

 Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
 '
this method with search for text "boy" in RichTextBox2change the textcolor to red and back color to cyan as indicated in the screenshot below 
 findTextAndHighlight
("boy"RichTextBox2  
 End Sub 
كذالك الاخطاء تستمر من فضلك مثال بسيط اخ سعود  انا اسف لتعبك
الرد }}}
تم الشكر بواسطة: ابراهيم ايبو , سعود


الردود في هذا الموضوع
استفسار مهم - بواسطة bakriano30@yahoo.com - 22-07-19, 05:06 PM
RE: استفسار مهم - بواسطة سعود - 22-07-19, 05:41 PM
RE: استفسار مهم - بواسطة bakriano30@yahoo.com - 22-07-19, 05:49 PM
RE: استفسار مهم - بواسطة سعود - 22-07-19, 05:58 PM
RE: استفسار مهم - بواسطة bakriano30@yahoo.com - 22-07-19, 06:16 PM
RE: استفسار مهم - بواسطة Basil Abdallah - 22-07-19, 06:34 PM
RE: استفسار مهم - بواسطة bakriano30@yahoo.com - 22-07-19, 07:19 PM
RE: استفسار مهم - بواسطة سامي محمد - 22-07-19, 10:33 PM
RE: استفسار مهم - بواسطة سعود - 22-07-19, 11:19 PM
RE: استفسار مهم - بواسطة سامي محمد - 22-07-19, 11:31 PM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم