I created a TRichEdit control, set the PlainText property to true, and set the font to a fixed-pitch font (e.g., Courier New). How do I set the tab stops so that the columns line up properly?
This one took a remarkable length of time to solve. There are a few prefacing comments. First, this is only an issue if you are trying to display a formatted output with a fixed pitch font. This is common for source code editors and hexadecimal dumps where each character of output must line up with the character above it. If you are using a proportional font, then absolute offsets from the left margin are fine and you do not need this FAQ. Second, the native Rich Edit control allows you to set up to 32 tabstops (MAX_TAB_STOPS as defined in richedit.h) beyond that, you’re screwed. Third, tabstops are set in TWIPs relative to the left margin in the native Rich Edit control. The problem is converting character positions (as offsets) into absolute offsets in TWIPs. The offsets are, of course, dependent upon the font being used. All that said, the following code works for me.
Related Questions
- I created a TRichEdit control, set the PlainText property to true, and set the font to a fixed-pitch font (e.g., Courier New). How do I set the tab stops so that the columns line up properly?
- Is there a TAG property for each individual ITEM in the CheckListBox Control, or for only the control itself? What is the correct syntax?
- Who will control access to canals on a landowners property? Can someone boat in, hunt or fish there without the permission?