Are there any VS.NET plugins that will format a selection of code for printing or emailing and is also free?
Have you checked the inbuilt formatting provided by VS? Select code and enter key chord Ctrl+K, Ctrl+F.
Or goto (menu)Edit->Advanced->FormatSelection or Edit->Advanced->FormatDocument
If you copy your code from Visual Studio and paste it into Word, the syntax highlighting will be kept.
Alternatively, you could take a look at the Copy Source As HTML add-in.
Is this just a matter of using spaces instead of tabs to do indent your code?
try Artistic Style 1.22, http://astyle.sourceforge.net/
it's easy to use, has 3 or 4 predefined styles and is configurable.
Use some kind of tabs-to-spaces function, and make sure the print or email uses a monospaced (aka. typewriter or console) font.
I'm pretty sure VisualStudio had a (little well hidden) function to convert indenting from tabs to spaces and vice versa.
I'm normally using vim where you can use:
:set expandtab
:%retab
to replace tabs with spaces and:
:set noexpandtab
:%retab
to replace spaces to tabs.
Spaces is better for emailing etc. because noone can agree on the length (in spaces) of a tab.
To turn tabs to spaces, select the code and use Editor -> Advanced -> Untabify Selected Lines.
Related
I've built a basic editor which have code auto-completion feature and also shows parameter list. Now I want to add highlight matching bracket feature. How to do this?
Update
I know some basic algorithm to find the matching bracket, but don't know how to highlight it! [to change the color or making it bold of the matching bracket].
I'm using multi-line textbox for this issue.
Based on your current features you likely to have some sort of parsed tree of the source. If it is true you should be able to relatively easy to find node that represent braces above current location in the source.
Otherwise counting braces as Hunter McMillen suggested may be enough. Don't forget to skip comments and string literals if you support them.
Short question here:
In .Net 4.0 Winforms, how do I use the PasswordChar property of a Textbox to show a common black dot as a character? Is there perhaps some font I can use that has this as a character?
If I use 'UseSystemPasswordChar = true' it shows an asterisk (*).
You can use this one: ●
You can type it by holding Alt and typing 25CF.
Alternately, you may use this smaller one: •
You can type it by holding Alt and typing 2022.
Use the Unicode Character 'BLACK CIRCLE' (U+25CF)
http://www.fileformat.info/info/unicode/char/25CF/index.htm
To copy and paste: ●
I was also wondering how to store it cleanly in a variable.
As using
char c = '•';
is not very good practice (I guess). I found out the following way of storing it in a variable
char c = (char)0x2022;// or 0x25cf depending on the one you choose
or even cleaner
char c = '\u2022';// or "\u25cf"
https://msdn.microsoft.com/en-us/library/aa664669%28v=vs.71%29.aspx
same for strings
string s = "\u2022";
https://msdn.microsoft.com/en-us/library/362314fe.aspx
One more solution to use this Unicode black circle >>
Start >> All Programs >> Accessories >> System Tools >> Character Map
Then select Arial font and choose the Black circle copy it and paste it into PasswordChar property of the textbox.
That's it....
Below are some different ways to achieve this. Pick the one suits you
In fonts like 'Tahoma' and 'Times new Roman' this common password character '●' which is called 'Black circle' has a unicode value 0x25CF. Set the PasswordChar property with either the value 0x25CF or copy paste the actual character itself.
If you want to display the Black Circle by default then enable visual styles which should replace the default password character from '*' to '●' by default irrespective of the font.
Another alternative is to use 'Wingdings 2' font on the TextBox and set the password character to 0x97. This should work even if the application is not unicoded. Refer to charMap.exe to get better idea on different fonts and characters supported.
Instead of copy/paste a unicode character or setting it in the code-behind you could also change the properties of the TextBox. Simply set "UseSystemPasswordChar" to True and everytghing will be done for you by the Framework. Or in code-behind:
this.txtPassword.UseSystemPasswordChar = true;
I have an application that allows the user to create an article. The problem arises when the user pastes from something like Word which comes loaded with a bunch of markup.
I'm using a jQuery editor called tiny_mce which allows the markup. I do a htmlencode and decode obviously but it means that i carry a huge payload of markup.
Is there a way to strip (all) markup from pasted text and just keep the text?
Or is there a way that tiny_mce can show the markup as text?
It's been a while since I used tinyMCE, but when I did I used this paste plugin that did automatic clean-up on paste, including paste from Word.
Strip all HTML markup using Regex: http://weblogs.asp.net/rosherove/archive/2003/05/13/6963.aspx
string stripped = Regex.Replace(textBox1.Text,#"<(.|\n)*?>",string.Empty);
This Regex expression can be applied to the language of choice.
I use a simple Windows shell addin caled Pure Text. It overloads the Windows+V key to do a plain text paste.
I am looking to handle incoming telnet text that has ANSI escape codes. For the bounty I am looking for a full implementation where I can just append text to the end of a buffer. The control should be scrollable, yet still be able to handle appending text, cursor positioning, etc.. while the user is scrolled out of view.
For example,
"\e[0;32mHello \e[0;37mWorld"
Would display a green "Hello" and a white "World"
As this would need to handle cursor positioning, setting a default 80 characters per row (80 columns) would be fine, but also needs to handle other column sizes. Would be nice to be able to change the font as well.
See Wikipedia ANSI Escape Codes for more information.
Take a look at Dart's Vt.NET control (assuming that a VTxxx emulation is close enough to an ansi emulation).
checkout the following link:
AckTerm # sourceforge.com
i'm trying to translate ANSI codes coming from a serial interface using Terminal Control project from www.sourceforge.com written in C# - if ackterm won't be good for you google terminal control project
hope it is what you are looking for...
Assuming you mean "ANSI escape code," you can start by converting each escape code in your string into a color (since it sounds like those are the only codes you're interested in). Just use a table like the one here (bottom of page) and do a little bit of custom string parsing.
ANSI escape codes are pretty old-school, so I wouldn't expect them to have the intended effect. They're meant for controlling output to text terminals, not fancy stuff like a .NET user control.
Please Do any one know a free rich text box in C# like the one used in Microsoft Encarta, such that when i write x^2 it makes the 2 up the x with smaller font (like sup in HTML).
Thanks very much
The possibility to make text superscript or subscript is built-in in the richtextbox: see this msdn article.
Of course the base richtextbox does not do it "automatically", but you might try replacing text as the user types...
EDIT: If I understand correctly, you don't need just subscript and superscript capabilities, but a full equation editor. I don't have any direct experience with something like that, but just googling for ".net equation editor" yields some interesting results, like this equation editor in C#. Give it a try... I'm afraid that it won't be easy to find something that 1) does exactly what you need 2) is easy to use and 3) is free, but I wish you all the best luck :)
I don't know encarta do. But if you want some components for edit html try find:
http://www.fckeditor.net/
http://devexpress.com/Products/NET/Controls/WinForms/Editors/ (serach for a new editor control, can edit html)