System.Windows.Forms.RichTextBox.SelectionFont.Size 
Author Message
 System.Windows.Forms.RichTextBox.SelectionFont.Size

Hi,

Using System.Windows.Forms.RitchTextBox, I am trying to set the size of
selected text (or make it bold,italic, uderline) by following code :

rtxt.SelectionStart = 11 ' or something else
rtxt.SelectionLength = rtxt.TextLength
rtxt.SelectionFont.Size = 18

But last line gives me an error and tells me Size property is readonly.
What is the shortest way to set the size ?

Any help would be appreciated,
Ali



Mon, 14 Nov 2005 22:56:57 GMT  
 System.Windows.Forms.RichTextBox.SelectionFont.Size
Hi,

        Create a new font with the same name and a size of 18.  Set the
selectionfont equal to the font.

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

Dim fnt As Font

RichTextBox1.SelectAll()

fnt = New Font(RichTextBox1.SelectionFont.Name, 18)

RichTextBox1.SelectionFont = fnt

End Sub

Ken

----------


Quote:
> Hi,

> Using System.Windows.Forms.RitchTextBox, I am trying to set the size of
> selected text (or make it bold,italic, uderline) by following code :

> rtxt.SelectionStart = 11 ' or something else
> rtxt.SelectionLength = rtxt.TextLength
> rtxt.SelectionFont.Size = 18

> But last line gives me an error and tells me Size property is readonly.
> What is the shortest way to set the size ?

> Any help would be appreciated,
> Ali



Mon, 14 Nov 2005 23:07:30 GMT  
 System.Windows.Forms.RichTextBox.SelectionFont.Size
Thanks ken,
I was expecting easier way like we had in VB6.


Quote:
> Hi,

>         Create a new font with the same name and a size of 18.  Set the
> selectionfont equal to the font.

> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click

> Dim fnt As Font

> RichTextBox1.SelectAll()

> fnt = New Font(RichTextBox1.SelectionFont.Name, 18)

> RichTextBox1.SelectionFont = fnt

> End Sub

> Ken

> ----------



> > Hi,

> > Using System.Windows.Forms.RitchTextBox, I am trying to set the size of
> > selected text (or make it bold,italic, uderline) by following code :

> > rtxt.SelectionStart = 11 ' or something else
> > rtxt.SelectionLength = rtxt.TextLength
> > rtxt.SelectionFont.Size = 18

> > But last line gives me an error and tells me Size property is readonly.
> > What is the shortest way to set the size ?

> > Any help would be appreciated,
> > Ali



Mon, 14 Nov 2005 23:45:03 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. System.Windows.Forms.RichTextBox.SelectionFont.Size

2. Error in System.Windows.Forms.Form.UpdateLayered()

3. Inherits System.Windows.Forms.Control...

4. howto Inherits System.Windows.Forms.TextBoxbase

5. System.Windows.Forms.Application.Exit()

6. Excel 2000, Windows XP, System.Runtime.InteropServices.COMException

7. System.Windows.ControlPaint.DrawMenuGlyph

8. Solution for Setting the Windows-NT-System-Default-Printer (without any dialog)

9. B`UILD YO.UR O.WN C.ABLE B.OX........................................................................................ 1382 [1/2]

10. System.Runtime.InteropServices.VTableCallsNotSupportedException

11. Unhandled exception in system.windows.forms.dll (in my main form) - argh

12. VB.NET - Subclassing System.Windows.Forms.Form?

 

 
Powered by phpBB® Forum Software