public Function GetLeftColor(rtf as richtextbox) as long
dim currentselstart as long
dim currentsellength as long
if rtf.selstart=0 then exit sub
currentselstart=rtf.selstart
currentsellength=rtf.sellength
rtf.selstart=currentselstart-1
rtf.sellength=1
getleftcolor=rtf.selcolor
rtf.selstart=currentselstart
rtf.sellength=currentsellength
end function
没有用vb调试过,你试一试看看行不行。
dim currentselstart as long
dim currentsellength as long
if rtf.selstart=0 then exit sub
currentselstart=rtf.selstart
currentsellength=rtf.sellength
rtf.selstart=currentselstart-1
rtf.sellength=1
getleftcolor=rtf.selcolor
rtf.selstart=currentselstart
rtf.sellength=currentsellength
end function
没有用vb调试过,你试一试看看行不行。
richtextbox1.SetFocus
On Error Resume Next
SendKeys "+{left}"
MsgBox richtextbox1.SelColor
End SubPrivate Sub Form_Load()
Me.KeyPreview = True
End Sub
一句就可以了