تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
طلب بعض الاكواد فى انشاء محرر RichTextBox
#4
تفضل أخي

كود :
Private Sub SetBold(ByVal Rbox As RichTextBox)
        If Rbox.SelectedText IsNot Nothing Then
            Dim CurrFont As Font = Rbox.SelectionFont
            Dim BoldStyle As FontStyle
            If Rbox.SelectionFont.Bold = True Then
                BoldStyle = FontStyle.Regular
            Else
                BoldStyle = FontStyle.Bold
            End If
            BoldStyle += CurrFont.Style
            Rbox.SelectionFont = New Font(CurrFont.FontFamily, CurrFont.Size, BoldStyle)
        End If
    End Sub


    Private Sub SetItalic(ByVal Rbox As RichTextBox)
        If Rbox.SelectedText IsNot Nothing Then
            Dim CurrFont As Font = Rbox.SelectionFont
            Dim ItalicStyle As FontStyle
            If Rbox.SelectionFont.Italic = True Then
                ItalicStyle = FontStyle.Regular
            Else
                ItalicStyle = FontStyle.Italic
            End If
            ItalicStyle += CurrFont.Style
            Rbox.SelectionFont = New Font(CurrFont.FontFamily, CurrFont.Size, ItalicStyle)
        End If
    End Sub


    Private Sub SetUnderline(ByVal Rbox As RichTextBox)
        If Rbox.SelectedText IsNot Nothing Then
            Dim CurrFont As Font = Rbox.SelectionFont
            Dim UnderlineStyle As FontStyle
            If Rbox.SelectionFont.Underline = True Then
                UnderlineStyle = FontStyle.Regular
            Else
                UnderlineStyle = FontStyle.Underline
            End If
            UnderlineStyle += CurrFont.Style
            Rbox.SelectionFont = New Font(CurrFont.FontFamily, CurrFont.Size, UnderlineStyle)
        End If
    End Sub


    ' كيفية الاستخدام


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        SetBold(Me.RichTextBox1)
    End Sub


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        SetItalic(Me.RichTextBox1)
    End Sub


    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        SetUnderline(Me.RichTextBox1)
    End Sub


****
***
**
*
(وَقُل رَّبِّ زِدْنِي عِلْمًا)

الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
طلب بعض الاكواد فى انشاء محرر RichTextBox - بواسطة kslawy - 13-06-13, 04:22 PM


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


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