在RichTextBox(WinForm)的特定部分应用删除线

时间:2014-06-22 23:14:47

标签: vb.net richtextbox

在文本的特定部分应用删除线的最简单方法是什么?

例如:

rxtTest.text = "Stackoverflow is a very good site" 'Apply strikeout just on 'very'

1 个答案:

答案 0 :(得分:1)

'rxtTest = My WinForm RichTextBox
'rxtTest.Text = "Stackoverflow is a very good site"
'text selected = "very"

Private Sub rxtTest_MouseCaptureChanged(sender As System.Object, e As System.EventArgs) Handles rxtTest.MouseCaptureChanged
    Dim f As New System.Drawing.Font("Arial", 12, FontStyle.Strikeout)
    rxtTest.SelectionFont = f
End Sub

'After this code my text selected ("very") will be strikeout