So I'm working on a C# program that functions something like an IDE. The thing is, I'm doing it through a rich text box the custom syntax highlighting is SUPER inefficient.
I was wondering if there was a way to make a custom control similar to a rich text box (even based off of one) and then build in the syntax highlighting in an easier way...
So, how do I make custom controls? And if you were super nice, you'd point me in the direction of a good tutorial on it!
Nope, there is no control in your toolbox that tries to pretend to be a good editor control. TextBox and RichTextBox had very different design goals. That's been solved a number of times, the ScintillaNET project is ahead as far as I can tell.
Simple but functional examples:
Windows Forms:
http://www.codeproject.com/KB/miscctrl/cutebutton.aspx
WPF:
http://msdn.microsoft.com/en-us/library/cc295235.aspx
easily just derive from base control
I found this tutorial very helpful. Hopefully this will help you the most.
It is simple, just call graphics method and draw shapes correspond to the controls.
Consider you want to create a custom button, you know button is a rectangle in system,so just fill rectangle using that buttons co-ordinates (x,y,width,height) with LinearGradientBrush or SolidBrush in Paint() method in C#. C# provides ClientRectangle method to get all co-ordinates of the controls in which rectangle is used. There are many components in which rectangle is used like Button, Panel, CheckBox, TabControl, etc.
creating custom controls in C#
I think these links are also useful.
Customizing Windows Form in C#
Creating Custom Controls in Visual Studio using C# (Video)
Here is the complete source code if the link form C# Corner found broken
Thank you.
I would suggest looking at some tutorials such as
http://www.codeproject.com/KB/miscctrl/cutebutton.aspx
As NavidRahmani said just above, you dont have to start from scratch you can extend existing control or use controls that are already made from different libraries.
Such as telerik controls.