
展开全部
给你写了个例子
Const EM_LINEINDEX = &HBB
Const EM_LINELENGTH = &HC1
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 Sub Command1_Click()
Dim Start As Long, Length As Long
Start = SendMessage(RichTextBox1.hwnd, EM_LINEINDEX, 2, 0)
Length = SendMessage(RichTextBox1.hwnd, EM_LINELENGTH, Start, 0)
If Start >= 0 Then
RichTextBox1.SelStart = Start
RichTextBox1.SelLength = Length
RichTextBox1.SetFocus
End If
End Sub
Const EM_LINEINDEX = &HBB
Const EM_LINELENGTH = &HC1
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 Sub Command1_Click()
Dim Start As Long, Length As Long
Start = SendMessage(RichTextBox1.hwnd, EM_LINEINDEX, 2, 0)
Length = SendMessage(RichTextBox1.hwnd, EM_LINELENGTH, Start, 0)
If Start >= 0 Then
RichTextBox1.SelStart = Start
RichTextBox1.SelLength = Length
RichTextBox1.SetFocus
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询