没什么不同啊,累加不包含选中的数组行就是前面和后面的部分嘛
nPos = Thisform.edit1.SelStart
ALines(aTemp, Strtran(Thisform.edit1.Text, Chr(13)+Chr(10), Chr(1)+Chr(10)))
Store 0 to n0, n1
For ii = 1 to Alen(aTemp)
n0 = n0 + Len(aTemp[ii]) + 1
If n0 > nPos
n1 = m.ii
Exit
EndIf
EndFor
c选中块 = Rtrim(aTemp[n1], Chr(1))
c前后块 = ''
For ii = 1 to Alen(aTemp)
If ii <> n1
c前后块 = c前后块 + Chr(13)+Chr(10) + Rtrim(aTemp[ii], Chr(1))
EndIf
EndFor
c前后块 = Substr(c前后块, 3)
c前显示分隔符 = Replicate('=',20)+Chr(13)+Chr(10)
c后显示分隔符 = Chr(13)+Chr(10)++Replicate('=',20)
MessageBox('选中块 '+c前显示分隔符 + c选中块 + c后显示分隔符)
MessageBox('前后块 '+c前显示分隔符 + c前后块 + c后显示分隔符)