469,592 Members | 1,914 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

richtextbox selectedtext bold upper .... how to find out

When I select a text in a richtextbox to set de selected text in bold,
regular, italic .. or non I want to do that with one click
Thus I must find out if the selected text is already in bold, regular,
italic......
Is there any code for this
Thanks for any response
Jun 10 '06 #1
2 2253

andreas wrote:
When I select a text in a richtextbox to set de selected text in bold,
regular, italic .. or non I want to do that with one click
Thus I must find out if the selected text is already in bold, regular,
italic......
Is there any code for this
Thanks for any response


if me.RichTextBox1.SelectionFont.Bold then

'do somthing

end if

Jun 11 '06 #2
Thanks Ahmed, it works fine but i have still two questions
1)
if I don't want bold, italic ... I set the font to regular but I lose both
when they are there
how set I the text to not bold only or to not italic only
2)
I have taken a code from internet for making the text greater by clicking
and after a little changing it works fine but the original text become Bold
after wich I don't understand for what reason

Here follows the code

Private Sub mnuGroter_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuGroter.Click
Const iBasisGrootte As Single = 12

Static FontsizeVergroting As Single = 3

Dim fontsize As Single

Static sGeselecteerd As String

If sGeselecteerd <> rtb.SelectedText Then 'other text

FontsizeVergroting = 3

End If

If rtb.SelectionLength > 0 Then

Dim selStart As Integer = rtb.SelectionStart

Dim selLength As Integer = rtb.SelectionLength

Dim currFont As System.Drawing.Font

fontsize = iBasisGrootte + FontsizeVergroting

Dim i As Integer

For i = 0 To selLength - 1

rtb.Select(selStart + i, 1)

currFont = rtb.SelectionFont

rtb.SelectionFont = New Font(currFont.FontFamily, fontsize, _

currFont.Style)

Next

rtb.Select(selStart, selLength)

FontsizeVergroting = FontsizeVergroting + 2

sGeselecteerd = rtb.SelectedText

End If

End Sub

andreas" <an*****@pandora.be> wrote in message
news:df***********************@phobos.telenet-ops.be...
When I select a text in a richtextbox to set de selected text in bold,
regular, italic .. or non I want to do that with one click
Thus I must find out if the selected text is already in bold, regular,
italic......
Is there any code for this
Thanks for any response

Jun 11 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Hariharan S | last post: by
2 posts views Thread by Alvo von Cossel I | last post: by
2 posts views Thread by Clark Stevens | last post: by
5 posts views Thread by genojoe | last post: by
reply views Thread by Linda Liu[MSFT] | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.