简体   繁体   English

在winform RichTextBox中更改行间距

[英]Change line spacing in winform RichTextBox

I'm using in my winform project a RichTextBox control to display a kind of old console screen. 我在我的winform项目中使用RichTextBox控件来显示一种旧的控制台屏幕。 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. 是否可以将此空间更改为0或接近该空间。 If i paint a line from vetical line from line 1 to line 5 i don't want any spacing between the line. 如果我从第1行到第5行的纹理线绘制一条线,我不希望线之间有任何间距。

Hope you can help me. 希望您能够帮助我。

There's actually a lot that the Windows Forms RichTextBox doesn't expose. 实际上,Windows Forms RichTextBox没有公开很多内容。 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. 如果您具有控件的HWND(句柄属性),则可以使用SendMessage API发送EM_SETPARAFORMAT消息以使用格式。

In particular the PARAFORMAT2 structure does have some line spacing options that may be relevant. 特别是PARAFORMAT2结构确实有一些可能相关的行间距选项。 You will have to get your hands dirty with interop though. 尽管如此,你还是得把手弄脏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM