日研究文本控件和字符串,研究得頭混腦脹,問(wèn)題真是太多了。
這只是其中的一個(gè)問(wèn)題,答案來(lái)自問(wèn)專家網(wǎng)站和CSDN的,解決如下:
Public Const WM_USER = &H400
Public Const EM_SETTARGETDEVICE = (WM_USER + 72)
Public Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Public Sub AutoSwitchLine(ByRef RichText As Long, ByVal bSwitch As Boolean)
If bSwitch Then
´設(shè)置 RichTextBox 自動(dòng)換行
Call SendMessage(RichText.hWnd, EM_SETTARGETDEVICE, _
GetDC(RichText.hWnd), RichText.Width / 15)
If RichText.RightMargin = 0 Then
RichText.RightMargin = 1
Else
RichText.RightMargin = 0
End If
Else
´設(shè)置 RichTextBox 不自動(dòng)換行
Call SendMessage(RichText.hWnd, EM_SETTARGETDEVICE, 0, 1)
End If
End Sub
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)
點(diǎn)擊舉報(bào)。