RTB with Auto Indenting

Started by
18 comments, last by h0-0t 17 years, 4 months ago
lol that explains it...

I had been using "code" instead of "source"...
So tired
:: h0-0t ::
Advertisement
Does anyone know where I might be able to get my hands on a copy of the source for a similar source formatter like the on this forum uses in the BB script?
:: h0-0t ::
CodeProject gives many results when I searched for syntax highlight. For example, Syntax highlighting textbox written in C# looks like it might be a fairly complete solution.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
Quote:Original post by Extrarius
CodeProject gives many results when I searched for syntax highlight. For example, Syntax highlighting textbox written in C# looks like it might be a fairly complete solution.
It's pretty awful. Don't use it. It's rather unstable and incredibly slow on large documents.

The RichTextBox control has numerous glitches that render it a fairly horrible text editor. The most obvious glaring issue is the inability to substitute in glyphs from another font if the particular character isn't represented in the existing one. In a code editor, that usually uses a limited fixed-width font, this can be an issue if you want to throw in some characters outside of the low ASCII range.

Another limitation if you're trying to hack in your own functionality is to stop it from jumping around as you update text, you need to lock the window, take the current scroll position, update, reset the scroll position and finally unlock it. For long documents, the Win32 hacks required to adjust the scroll don't work correctly, meaning that the document jumps to the wrong location.

I made the initial mistake of using it, and have since resorted to writing my own complete text editing control (manually handling painting and text input). It's not a complex job, but it's quite a lengthy one, so you might want to look into other components.

There are some (rather expensive) commercial ones, but you can, for example, use #develop's text editor in your application.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

The guy who is who is working on this with me said something about a picturebox and GDI...not sure if that's what you're getting at as far as writing your own text control.
:: h0-0t ::
Quote:Original post by h0-0t
The guy who is who is working on this with me said something about a picturebox and GDI...not sure if that's what you're getting at as far as writing your own text control.
I don't use a PictureBox (that's very VB6-esque, as is GDI), but the idea is probably the same (I've written a class that inherits from Control and use GDI+ for painting). You can get a lot more flexibility if you do it all yourself.

I'm just trying to warn you, as my RTB solution ended up being a wild mess of Win32 hacks to try and keep it fast, flicker-free and reliable (of which it was none).

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

hmm
Is there any chance you could show me some sample code for this or would that be asking too much seeing it IS your code?

I've been out of programming for a while now so I'm pretty rusty as I'm sure you've noticed lol
:: h0-0t ::
Quote:Original post by h0-0t
hmm
Is there any chance you could show me some sample code for this or would that be asking too much seeing it IS your code?
I don't have it on me, but if you were looking to implement your own user controls I'd recommend looking at MSDN for information on how to do that.

I'd suggest looking around for third party controls before writing your own, though. It's a lengthy job and quite a lot of code!

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

Alright thanks for all your help :)

I'm downloading MSVB.NET 2005 Express right now...it's about time I get rid of this crappy MSVB6....so old :(
:: h0-0t ::
Quote:Original post by benryves
I've written a class that inherits from Control and use GDI+ for painting.


I don't have the first clue about writing my own controls -.-

Are there any good resources you know of offhand that I could look at for this kind of thing? I googled for a few hours and came up empty.
:: h0-0t ::

This topic is closed to new replies.

Advertisement