rowanjl Posted September 23, 2005 Posted September 23, 2005 I've been looking at creating an entire textbox from scratch that matches my needs, but I don't really know where to begin (apart from making a new User Control...). I've searched everywhere and been unable to find any information on making a textbox control. Can anyone point me to some information? And can someone explain how to give a control the normal BorderStyle property? Thanks! :) Quote
Administrators PlausiblyDamp Posted September 23, 2005 Administrators Posted September 23, 2005 Creating your own control from scratch would be an awful lot of work if you are doing it properly, is there any reason why you couldn't inherit from Textbox and just add your own functionality or override existing methods to get the end result you desire? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
rowanjl Posted September 24, 2005 Author Posted September 24, 2005 Yeah, thats what I was planning to do, but I need to add syntax highlighting. Working with a RichTextBox is very slow, as I'm selecting the text and colouring it. There must be a better way :( Quote
Machaira Posted September 26, 2005 Posted September 26, 2005 Working with a RichTextBox is very slow Then you must be doing something wrong. :) ;) Working with it shouldn't be any slower than a regular textbox. Can you be more specific in what the problems with it are? Quote Here's what I'm up to.
rowanjl Posted October 3, 2005 Author Posted October 3, 2005 Well, the highlighting I'm doing means I have to do the entire document every time the text changes, thats why its slow. Perhaps there is a better way? Quote
Machaira Posted October 3, 2005 Posted October 3, 2005 Why would you have to do the entire document? You should just do the text for the line that changes, right? Quote Here's what I'm up to.
IceAzul Posted October 6, 2005 Posted October 6, 2005 I too tried to write my own text editor from scratch, back in my VB6 days. The problem was that there is very little information on something like this, and google doesn't help since you aren't really sure what exactly to look for. After a while of on and off again work, porting code to VB.Net and then to C# (I do it in the spare time of my spare time) I have come close to completing it. Anyway, I found that there are many different parts of a text editor, the user control being the last (yet very important) part of it. First off, you have to decide how you are going to implement the data structures that will be containing the text. Read these pages about Text Editor Data Structures. This and other structures which would describe the text (management of lines, undo stack, coloring, etc) would make up the underlying data part of the control. I spent a good part of my time figuring this stuff out until I found out about Sharp Develop. While most of their source code is good, differing a little when it came to the data structure, it did probably shave off some time from my project (It is hard code to follow, but the data part of it is well structured unlike the GUI part of it which is, imo and to put simply, awful). It is a long road to travel on, but probably a lot shorter if you dedicate more time and effort than I did, and you'll be a better programmer for it. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.