怎么设置vb文本框的行间距或者是richtextbox的行间距?????

 我来答
zx001z7d53
推荐于2016-11-25 · TA获得超过2万个赞
知道大有可为答主
回答量:2.4万
采纳率:52%
帮助的人:5652万
展开全部
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_USER = &H400
Private Const EM_GETPARAFORMAT = WM_USER + 61
Private Const EM_SETPARAFORMAT = WM_USER + 71
Private Const MAX_TAB_STOPS As Long = 32
Private Const PFM_LINESPACING As Long = 256
Private Type PARAFORMAT2
cbSize As Long
dwMask As Long
wNumbering As Integer
wEffects As Integer
dxStartIndent As Long
dxRightIndent As Long
dxOffset As Long
wAlignment As Integer
cTabCount As Integer
rgxTabs(MAX_TAB_STOPS - 1) As Long
dySpaceBefore As Long
dySpaceAfter As Long
dyLineSpacing As Long
sStyle As Integer
bLineSpacingRule As Byte
bOutlineLevel As Byte
wShadingWeight As Integer
wShadingStyle As Integer
wNumberingStart As Integer
wNumberingStyle As Integer
wNumberingTab As Integer
wBorderSpace As Integer
wBorderWidth As Integer
wBorders As Integer
End Type

Private Sub Command1_Click()
Dim pf2 As PARAFORMAT2
Dim retval As Long
RichTextBox1.SelStart = Len(RichTextBox1.Text)
pf2.cbSize = LenB(pf2)
pf2.bLineSpacingRule = 3
pf2.dyLineSpacing = CLng(500 * Rnd) + 500 '指定500到1000twips随机行距
pf2.dwMask = PFM_LINESPACING
retval = SendMessage(RichTextBox1.hwnd, EM_SETPARAFORMAT, ByVal 0&, pf2)
End Sub

Private Sub Form_Load()
RichTextBox1.Text = RichTextBox1.Text & vbCrLf & "RichTextBox1"
End Sub
caoyun000000
2012-11-20
知道答主
回答量:1
采纳率:0%
帮助的人:1562
展开全部
另类解法换一种行高较大的字体,例如微软雅黑字体
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式