heikaman
September 24th, 2008, 05:38 AM
Hello
I am trying to make a simple syntax highlighter in C# mono using a Windows.Forms.RichTextBox control from winforms after googling for a while I found a reasonable solution using the RTF so I tried it in my RichTextBox subclass
Rtf="{\\rtf1\\ansi\\ansicpg1252\\deff-1\\deflang1033"+
"{\\fonttbl{\\f0\\fnil\\fcharset0 Nimbus Mono L;}}"+
"{\\colortbl \\red0\\green0\\blue0;\\red255\\green0\\blue0;}"+
"{\\*\\generator Mono RichTextBox;}";
and then I got
Unhandled Exception: System.NotSupportedException: CodePage 1252 not supported
at System.Text.Encoding.GetEncoding (Int32 codePage) [0x00000]
at System.Windows.Forms.RTF.RTF.GetToken () [0x00000]
at System.Windows.Forms.RTF.RTF.ReadFontTbl (System.Windows.Forms.RTF.RTF rtf) [0x00000]
at System.Windows.Forms.RTF.RTF.RouteToken () [0x00000]
at System.Windows.Forms.RTF.RTF.Read () [0x00000]
at System.Windows.Forms.RichTextBox.InsertRTFFromStre am (System.IO.Stream data, Int32 cursor_x, Int32 cursor_y, System.Int32& to_x, System.Int32& to_y, System.Int32& chars) [0x00000]
at System.Windows.Forms.RichTextBox.InsertRTFFromStre am (System.IO.Stream data, Int32 cursor_x, Int32 cursor_y) [0x00000]
at System.Windows.Forms.RichTextBox.set_Rtf (System.String value) [0x00000]
Now I am really NOT a C# developer (I HAVE to do it in C#) and I don't know what was that all about :confused:
So any help is really appreciated, and I am open to suggestions if you know a better way to do this.
Thanks. :popcorn:
I am trying to make a simple syntax highlighter in C# mono using a Windows.Forms.RichTextBox control from winforms after googling for a while I found a reasonable solution using the RTF so I tried it in my RichTextBox subclass
Rtf="{\\rtf1\\ansi\\ansicpg1252\\deff-1\\deflang1033"+
"{\\fonttbl{\\f0\\fnil\\fcharset0 Nimbus Mono L;}}"+
"{\\colortbl \\red0\\green0\\blue0;\\red255\\green0\\blue0;}"+
"{\\*\\generator Mono RichTextBox;}";
and then I got
Unhandled Exception: System.NotSupportedException: CodePage 1252 not supported
at System.Text.Encoding.GetEncoding (Int32 codePage) [0x00000]
at System.Windows.Forms.RTF.RTF.GetToken () [0x00000]
at System.Windows.Forms.RTF.RTF.ReadFontTbl (System.Windows.Forms.RTF.RTF rtf) [0x00000]
at System.Windows.Forms.RTF.RTF.RouteToken () [0x00000]
at System.Windows.Forms.RTF.RTF.Read () [0x00000]
at System.Windows.Forms.RichTextBox.InsertRTFFromStre am (System.IO.Stream data, Int32 cursor_x, Int32 cursor_y, System.Int32& to_x, System.Int32& to_y, System.Int32& chars) [0x00000]
at System.Windows.Forms.RichTextBox.InsertRTFFromStre am (System.IO.Stream data, Int32 cursor_x, Int32 cursor_y) [0x00000]
at System.Windows.Forms.RichTextBox.set_Rtf (System.String value) [0x00000]
Now I am really NOT a C# developer (I HAVE to do it in C#) and I don't know what was that all about :confused:
So any help is really appreciated, and I am open to suggestions if you know a better way to do this.
Thanks. :popcorn: