Messing With Text in a RichTextBox
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
9 posts
Page 1 of 1
Hello,
I need help doing this:
I am making a CodePad(source viewer), it has tabs, and I want the text size in the RichTextBoxes to be bigger. How do I do so? I tried:
CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Font.Size = 12
Error using that code: Font.Size is read-only. I can't write it's value, I can only check it's value.
I need help doing this:
I am making a CodePad(source viewer), it has tabs, and I want the text size in the RichTextBoxes to be bigger. How do I do so? I tried:
CType(TabControl1.SelectedTab.Controls.Item(0), RichTextBox).Font.Size = 12
Error using that code: Font.Size is read-only. I can't write it's value, I can only check it's value.
Is control 0 of that tab always a richtextbox?
Try this:
Try this:
Code: Select all
You might also want to check out the RTF specification at http://www.biblioscape.com/rtf15_spec.htm Dim fsindex As Integer = RichTextBox1.SelectedRtf.IndexOf("\fs")
If fsindex = -1 Then
MsgBox("no fontsize found in selected rtf")
Return
End If
Dim test As String = RichTextBox1.SelectedRtf.Remove(fsindex + 3, RichTextBox1.SelectedRtf.IndexOf(" "c, fsindex) - fsindex - 3)
RichTextBox1.SelectedRtf = test.Insert(fsindex + 3, "88")
Last edited by mandai on Tue Aug 03, 2010 9:01 pm, edited 2 times in total.
Yes, it is the only control that can ever possibly be in the tab.
Ok, I just posted an example that changes the font size of the selected rtf text.
No, I need the code to make the font size the richtextboxes bigger when I make new ones.
I have tabs, each tab has a richtextbox, I want, as soon as the richtextbox is put in the tab, its fontsize to be bigger, so it will be easier to read.
I have tabs, each tab has a richtextbox, I want, as soon as the richtextbox is put in the tab, its fontsize to be bigger, so it will be easier to read.
You could always use the Rtf property instead of SelectedRtf if it has to be applied to the whole document.
So if I am using
Dim SCode As New RichTextBox
TabControl1.TabPages.Add(1, "Form " & i & ".vb")
TabControl1.SelectTab(i - 1)
SCode.Name = "TE"
SCode.Dock = DockStyle.Fill
SCode.ContextMenuStrip = ContextMenuStrip1
TabControl1.SelectedTab.Controls.Add(SCode)
i = i + 1
I put SCode.Rtf = "12"???
I want to make the size of the text in the created RichTextBox larger than it is when this event is called. Not change the richtextfile.
Dim SCode As New RichTextBox
TabControl1.TabPages.Add(1, "Form " & i & ".vb")
TabControl1.SelectTab(i - 1)
SCode.Name = "TE"
SCode.Dock = DockStyle.Fill
SCode.ContextMenuStrip = ContextMenuStrip1
TabControl1.SelectedTab.Controls.Add(SCode)
i = i + 1
I put SCode.Rtf = "12"???
I want to make the size of the text in the created RichTextBox larger than it is when this event is called. Not change the richtextfile.
Oh ok if you don't want to change the RTF you can change the font property this way:
Code: Select all
RichTextBox1.Font = New Font(FontFamily.GenericMonospace, 40, FontStyle.Regular, GraphicsUnit.Pixel)
This worked! Thanks! I will put you in my cool credits window.
9 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023