replace richtextbox control
-
Hello, i came across this interesting article - http://www.codeproject.com/cs/miscctrl/SyntaxHighlighting.asp[^] The article provides it's own rtb, control, so i was wondering, how do you replace my own rtb controls with the one provided in this article? I already have a richtextbox on my form which i'd like to keep (because i build my application around that rtb), whilst using the controls provided by this article (for the syntax highlighting feature), how can i do this? I am not asking for someone to write me a code or full detailed explaination, a quick instruction would be much appreciated. Many thanks in advance for your input.
-
Hello, i came across this interesting article - http://www.codeproject.com/cs/miscctrl/SyntaxHighlighting.asp[^] The article provides it's own rtb, control, so i was wondering, how do you replace my own rtb controls with the one provided in this article? I already have a richtextbox on my form which i'd like to keep (because i build my application around that rtb), whilst using the controls provided by this article (for the syntax highlighting feature), how can i do this? I am not asking for someone to write me a code or full detailed explaination, a quick instruction would be much appreciated. Many thanks in advance for your input.
assuming the replacement kept the same interface as the stock RTB, add the new control into your project's references, add it into the forms includes. replace the type and instantiation of the old RTB with those of the new control. IF the events and properties were changed you'll have to modify your existing code to work with the new interface.
-- CleaKO The sad part about this instance is that none of the users ever said anything [about the problem]. Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
-
assuming the replacement kept the same interface as the stock RTB, add the new control into your project's references, add it into the forms includes. replace the type and instantiation of the old RTB with those of the new control. IF the events and properties were changed you'll have to modify your existing code to work with the new interface.
-- CleaKO The sad part about this instance is that none of the users ever said anything [about the problem]. Pete O`Hanlon Doesn't that just tell you everything you need to know about users?
Im not good at C# at all, so i'll try to explain this as clear as possible (from my point of view). On the sample app provided in the article, it has a form without any rtb in it. BUT, the form us linked to an action form1_Load(); So, i had a look in there and this is the code i saw: SyntaxHighlightingTextBox shtb = new SyntaxHighlightingTextBox(); shtb.Location = new Point(0,0); shtb.Dock = DockStyle.Fill; shtb.Seperators.Add(' '); shtb.Seperators.Add('\r'); shtb.Seperators.Add('\n'); shtb.Seperators.Add(','); shtb.Seperators.Add('.'); shtb.Seperators.Add('-'); shtb.Seperators.Add('+'); //shtb.Seperators.Add('*'); //shtb.Seperators.Add('/'); Controls.Add(shtb); shtb.WordWrap = false; shtb.ScrollBars = RichTextBoxScrollBars.Both;// & RichTextBoxScrollBars.ForcedVertical; shtb.FilterAutoComplete = false; shtb.HighlightDescriptors.Add(new HighlightDescriptor("Hello", Color.Red, null, DescriptorType.Word, DescriptorRecognition.WholeWord, true)); As you can see, the class inside the syntax highlighting textbox library is called to make a new instance called "shtb" and then only after, words to highlight such as "hello" is added to it. My question orginally was, is it possible to have the ability to highlight text inside rtb (as i type), without creating a new instance such as "shtb", because i already have a rtb on my form. I just want to add the syntax highlighting functionality to the existing rtb box i have. Did i confuse you guys with what i am trying to achieve? Is this even possible?...:sigh:
-
Im not good at C# at all, so i'll try to explain this as clear as possible (from my point of view). On the sample app provided in the article, it has a form without any rtb in it. BUT, the form us linked to an action form1_Load(); So, i had a look in there and this is the code i saw: SyntaxHighlightingTextBox shtb = new SyntaxHighlightingTextBox(); shtb.Location = new Point(0,0); shtb.Dock = DockStyle.Fill; shtb.Seperators.Add(' '); shtb.Seperators.Add('\r'); shtb.Seperators.Add('\n'); shtb.Seperators.Add(','); shtb.Seperators.Add('.'); shtb.Seperators.Add('-'); shtb.Seperators.Add('+'); //shtb.Seperators.Add('*'); //shtb.Seperators.Add('/'); Controls.Add(shtb); shtb.WordWrap = false; shtb.ScrollBars = RichTextBoxScrollBars.Both;// & RichTextBoxScrollBars.ForcedVertical; shtb.FilterAutoComplete = false; shtb.HighlightDescriptors.Add(new HighlightDescriptor("Hello", Color.Red, null, DescriptorType.Word, DescriptorRecognition.WholeWord, true)); As you can see, the class inside the syntax highlighting textbox library is called to make a new instance called "shtb" and then only after, words to highlight such as "hello" is added to it. My question orginally was, is it possible to have the ability to highlight text inside rtb (as i type), without creating a new instance such as "shtb", because i already have a rtb on my form. I just want to add the syntax highlighting functionality to the existing rtb box i have. Did i confuse you guys with what i am trying to achieve? Is this even possible?...:sigh: