Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am attempting to create a new form object type, it will be a custom version of a RichTextBox but for syntax highlighting. How would i go about making a new object type that i can use like any other textbox or button.

note:
I am just looking for how to get started making the gui object, i already know how I'm going to do the syntax highlighting.

Thanks In Advance,
Jordan
Posted
Updated 27-Aug-13 11:34am
v2

1 solution

You might want to take a look at this article: Fast Colored TextBox for Syntax Highlighting[^]
 
Share this answer
 
Comments
Sicppy 27-Aug-13 13:09pm    
Already have, i would like to make my own.
Dave Kreskowiak 27-Aug-13 13:14pm    
And? The article still applies. What is that control doing to start off? It's inheriting from another control class and modifying how it works and renders itself. That article demonstrates this concept.

Oh, and having a very good understanding of how the control class you're inheriting from works internally helps a lot too.
BillWoodruff 27-Aug-13 18:27pm    
If you really want to "make your own," without studying how other people have achieved this, then why even ask a question here ? As Dave K. was kind enough to point out to you, there are many resources on CodeProject for creating this type of extended RichTextBox. Also See: http://www.codeproject.com/Answers/643515/Syntax-highlighting-a-RichTextBox-in-Csharp for further pointers to other examples. Studying other people's work is not going to "pollute" your mind and destroy your creativity !
V.Lorz 27-Aug-13 15:52pm    
Ok, in that case simply derive your new class from the Control class or from the RichTextBox class, then add the new functionality you need and Compile the project. You sould now see a new category in the forms editor toolbox with the name "your_project_name Components". Just drag and drop the new component you have created to your form.

I you need to create one component which at the same time contains more components (like a form) then rightclick your project (in the solution view) -> Add -> User control. Edit the control, compile, and the rest is just like described before.

Any way, take a deep look into the fast colored textbox (see Dave's comment), it works realy well and shows many things and concepts.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900