【发布时间】:2025-12-28 00:25:08
【问题描述】:
我需要一种方法来禁用 RichTextBox 中的全字选择。
这是我的问题:我想创建一个可以在文本中包含图像的文本编辑应用程序。但是,我注意到在 RichTextBox 中选择文本时,只能选择一个完整的单词。
注意:以防万一它是基于系统的,我在 Windows 10 上使用 VS 2015
【问题讨论】:
标签: vb.net selection richtextbox
我需要一种方法来禁用 RichTextBox 中的全字选择。
这是我的问题:我想创建一个可以在文本中包含图像的文本编辑应用程序。但是,我注意到在 RichTextBox 中选择文本时,只能选择一个完整的单词。
注意:以防万一它是基于系统的,我在 Windows 10 上使用 VS 2015
【问题讨论】:
标签: vb.net selection richtextbox
根据 MSDN,RichTextBox 中的 AutoWordSelection 似乎存在错误。要修复它,只需制作一个 Timer,将 Enabled 设置为 True,然后编写以下代码:
RichTextBox1.AutoWordSelection = True
RichTextBox1.AutoWordSelection = False
【讨论】:
接受的答案对我不起作用,但以下答案对我有用:
C# RichTextBox selection problem
这是Telerik's 尝试进行 C# 到 VB.NET 的转换:
Protected Overrides Sub OnHandleCreated(e As EventArgs)
MyBase.OnHandleCreated(e)
If Not MyBase.AutoWordSelection Then
MyBase.AutoWordSelection = True
MyBase.AutoWordSelection = False
End If
End Sub
【讨论】: