我想在用户单击 contextmenustrip dorpdownitem 时替换鼠标光标下的当前单词。我可以得到这个词,但无法用新词替换这个词,这是我的代码,非常感谢任何帮助。
Private Sub tsmmutradifat__DropDownItemClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles tsmmutradifat_.DropDownItemClicked
Dim myclickeditem As String = correct_word(e.ClickedItem.Text)
Dim wordtoreplace As String
If Not myclickeditem = Nothing Then
If RichTextBox1.SelectedText = "" Then
' Code required
Else
wordtoreplace = RichTextBox1.SelectedText
If wordtoreplace.EndsWith(" ") Then
myclickeditem = myclickeditem & " "
End If
If wordtoreplace.StartsWith(" ") Then
myclickeditem = " " & myclickeditem
End If
RichTextBox1.SelectedText = myclickeditem
End If
End If
End Sub
好的会看到,未来的时间,什么时候