I have simple text file viewer written in VB.NET in which I need a feature to show whitespace characters. I have seen this option effectively in editors such as EditPlus, SuperEdi, etc. I can't seem to find any VB.NET or C# source code which illustrates showing whitespace or special characters (selectable option.) I have figured out how to catch space characters and translate them to bullet chars and even change the color of the fly, too, but the tab handling has me stumpped. I can replace the tab (chr(9)) with a different character and pad with spaces within the KeyPress event, but I can't figured out how to maintain the tab positioning and navigation (arrow keys) appropriately. Here are the rules:
1. Working code can be in VB.NET or C#.
2. Must be able to replace tabs on the fly (user is typing) whilst maintaining tab positioning especially when the caret is moved within the control (using arrows keys, etc.)
3. Replacement character and padding must take the same amout of space as the tab chracter would:
<tab> below means actual tab (chr(9) a.k.a. \t or vbTab)
Example: Original text: testing<tab>this
Desired text: testing>> this