views:

737

answers:

1

I want to implement my own textbox (editor) with line numbers to the left of it. Well, so I am implementing the line numbers in another, narrow multiline textbox. However, I want to be able to adjust the font in the main editor and generally make it to be big size, whereas I don't want to have the line numbers to be of equally big size font. But I still want to have the lines in line number textbox align vertically with the ones in the editor.

Well, so I can see two potential solutions here: - find a way to use a font with explicitly specified width and height. Then I could just use a font with big height and small width (to keep numbers small and unobtrusive) - adjust width of whitespace between lines in a textbox

Well, any suggestions here? Is there a way to implement either of those approaches of mine? Is there another nice approach?

Note that I am indeed aware of the approach where we just use separate labels (one for each number) instead of a single multiline textbox to display line numbers, and in this case of course I could regulate their vertical spacing. But that sort of sounds like high bogosity approach, even though I will probably have to end up doing that if nothing better comes up.

A: 

A similar question was asked here.

Aaron Sanders
the articles linked from that answer do not address my question. In fact, I am already using the code inspired by those articles and superior to that. So my question is basically more advanced.