How to syntax highlight using scintilla? - c#

How can I syntax highlight using the scintilla. I have no idea how to use it. I need a code sample that loads scintilla, puts a String[], and runs it in a richtextbox.

You might find your answer here.
alternatively apparently some file can't be found it seems like an installation issue.
might find more here

Related

Not getting how to use the execWB method

I am unable to get execWB working. Can any one show me how to initialize it or which namespace or dll file I need to include in order to use this method.
I am trying to zoom out the content on my browser.
You are in luck. Someone already wrote the interop for you.
Try looking at this Stackoverflow question. This CodeProject link concerns VB.Net but you might be able to get some useful information from it.

In Visual Studio, is there a quick way to generate these types of comment blocks?

If anyone knows the name for these types of comments, if one exists, please modify my question.
I frequently see comment blocks such as this:
/**********************************************
* Some Important Text Here
**********************************************/
Sometimes they can look like this:
/**********************************************
********* Some Important Text Here *******
**********************************************/
I've also seen them prettier than that.
They seem useful for noting sections of code, and important messages, such as license blocks. But, I feel like there *must* be a "lazy" way of doing this in Visual Studio, or at least an addon, because typing them manually is a pain.
Thanks!
P.S. If this feature or a point-and-click way to do it doesn't exist, then I know what VS plugin I'm writing next.
create a code snippet for them
You could perhaps look at GhostDoc, it is great for writing neat, clean, consistent style commenting in your code. It uses XML markup, and can later be exported for documentation.
If you want fixed-text blocks, then add a Code Snippet for each one you need.
If you want auto-generated documentation blocks for absolutely any code element, then you might like to try my addin, AtomineerUtils. (Similar to GhostDoc, but with significantly more features, a much better documentation generation engine, better formatting control (e.g. word wrapping of comments and documentation comments) and support for many more programming languages and documentation block styles).
You could create a toolbar macro which inserts that text at your cursor position when you click on the toolbar icon.

C# Rich Text Box, Brace Matching

Is there a good open source project with brace matching support? I was searching codeproject all day but failed to find any. Or atleast can someone advice me on how to tackle it? Thanks!
It can be in C# or VB.NET.
Edit:
Sorry forgot to mention, I do not want to use other dll components since I'll have to include them in the directory to use them... I'd create my own so all I have is JUST the exe file to give out. Thanks!
Not sure if these provide what you need, but worth a look:
scintillanet is a C# wrapper around the scintilla control
ICSharpCode.TextEditor from the SharpDevelop project

How to Syntax Highlight in a RichTextBox [C#]?

How do I syntax highlight in a richtextbox control AS THE USER TYPES and USING A String[] keywords. I will be publishing a lightweight notepad to the web soon and I want it to have syntax highlighting. I am using Windows forms. Can someone post a code example?
RichTextBox syntax highlighting (talks about RichTextBox itself - minimal features but exactly what you asked for here)
A textbox/richtextbox that has syntax highlighting? [C#] (talks mostly about other ways of doing it)
The Scintilla control is an excellent source code editor that includes syntax highlighting amongst a whole range of other features. You can embed it in your own app and there is a .NET wrapper available.
With Scintilla you can specify the keywords and it will then apply the syntax highlighting as you type.
Are you using WinForms or WPF?
If WPF, you could have a look at AvalonEdit. It's free and open source, and it's used in SharpDevelop (open source IDE).
You can change the font of selected words in the richtextbox. Take a look at the Select and SelectedFont properties of the control.
But essentially, you need to iterate through the words, check if a word is present in your keywords, and then change the font, using the above-mentioned properties.
Not exactly an answer to your question, but have you looked at the text editor component from SharpDevelop? It's quite lightweight (<200kB IIRC), can be easily embedded in WinForms applications and has syntax highlighting for several languages built in.
Otherwise, you might want to look at this CodeProject page. It reformats the RTF while you type, which is not very efficient for large files, and it contains a few creepy catch (Exception) { } blocks, so I'm not sure if I would use it in a life-critical application, but it's definitely a good starting point to see how it can be done.
Syntax highlighting is not an easy task to perform efficiently. Many solutions you can find (like the ones involving modification of RTF) are a one time solution. If you want to highlight and un-highlight words on the fly during edition, your code has to be ready for it. I would not reinvent the wheel and use ICSharp.TextEditor or alike to solve your problem.

C# syntax highlighter for blogging on BlogSpot

I'm looking for a syntax highlighter cum code formatter for my blog on BlogSpot. I've tried several today, but the all want to include <style> tags, or reference a stylesheet. I'm looking for one that is ideal for segments of code, and includes styling inline. Any suggestions?
The project referenced above has moved:
http://alexgorbatchev.com/wiki/SyntaxHighlighter
Instructions for using it on Blogger:
mlawire.blogspot.com/2009/07/blogger-syntax-highlighting.html
You can always copy the extra few bytes of styling for, say, a Pygments highlighter (which really is quite excellent) into the <head> of your blog. You don't even need to install any software; just copy the HTML from the online service.
I've created a Free Online C# Syntax Highlighter that has exactly the ability you need - to inline the needed CSS styles. All you have to do is to select the "Inlined styles" check box, paste your C# code and click the Colorize button. You can find it on my blog.
Try this one: http://code.google.com/p/syntaxhighlighter/
I use SyntaxHighlighter Javascript Library. It's really easy to add and use.
here's more information on it that might help others out:
http://www.craftyfella.com/2010/01/syntax-highlighting-with-blogger-engine.html
I had this exact problem.
I wrote an image formatter for Pygments (included in the core distribution).
Please don't hate me for such an abomination, but yes, it renders the highlighted code as a png or jpg or whatever you want. So it has no external dependencies etc.
pygmentize -f png -o mysource.png mysource.cs
I try to make sure that I always link a plain text version of the source for people copy-pasting.

Categories