Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change line spacing in winform RichTextBox

I'm using in my winform project a RichTextBox control to display a kind of old console screen. This works perfectly but there is a space between the lines. Is it possible to change this space to be 0 or anything near that. If i paint a line from vetical line from line 1 to line 5 i don't want any spacing between the line.

Hope you can help me.

like image 697
mrfatmen Avatar asked Oct 22 '25 09:10

mrfatmen


1 Answers

There's actually a lot that the Windows Forms RichTextBox doesn't expose. If you have the HWND (Handle property) to the control, you can use the SendMessage API to send the EM_SETPARAFORMAT message to play with the formatting.

In particular the PARAFORMAT2 structure does have some line spacing options that may be relevant. You will have to get your hands dirty with interop though.

like image 142
Josh Avatar answered Oct 24 '25 00:10

Josh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!