RichTextBox line spacing

G

Guest

Is there a way to alter the line spacing in a RichTextBox?

I guess not, at least not an easy obvious way. I was hoping someone would
give a positive response to your question.

When a logical font is created, the lfHeight value seems to be what you
want. But the .net font object doesn't expose it in the constructors, and
the related font properties are readonly.

There is font method FromLogFont() which I have never tried. I guess the
idea is that you create a logical font using apis, and then create a font
object from the logfont using FromLogFont(). When this new font is assigned
to the richtextbox, presumably it will respect the font's interline spacing.

If you try this out, please post back results. I don't have the time or
energy, and messing with fonts gives me heartburn. Good luck.
 
H

Herfried K. Wagner [MVP]

PIEBALD said:
Is there a way to alter the line spacing in a RichTextBox?

P/invoke: 'SendMessage', 'EM_GETPARAFORMAT', 'EM_SETPARAFORMAT',
'PARAFORMAT2', 'PFM_LINESPACING'.
 
G

Guest

PIEBALD said:
P/invoke: 'SendMessage', 'EM_GETPARAFORMAT', 'EM_SETPARAFORMAT',
'PARAFORMAT2', 'PFM_LINESPACING'.

Oh man. I spent all weekend working on it, with some success. I didn't know
I was asking for such a difficult task. No wonder the RichTextBox doesn't
have all this functionality! I hope to have it working by the end of the week.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top