Change line spacing in winform RichTextBox

Deadly 提交于 2019-12-07 11:48:01

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/3099692/change-line-spacing-in-winform-richtextbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!