Syncfusion - 按快捷键后没有空格 - " CTRL" +" SPACE"

时间:2016-06-13 12:28:05

标签: winforms autocomplete event-handling syncfusion editcontrol

我们正在使用Syncfusion框架Essential Studio中的EditControl(来自工具箱的组件)来编写一个小代码编辑器。 我们希望在按下快捷键 CTRL + SPACE 后不弹出编辑器窗口中的空格字符来弹出自动完成窗口。

有没有办法禁止在EditControl中输入字符?

Private Sub editControl1_KeyDown(sender As Object, e As KeyEventArgs)
        If e.Control Then
        ' Do something here
            If e.KeyCode = Keys.Space Then
                EditControl1.ShowContextChoice()
                Dim context = EditControl1.ContextChoiceController
                For Each item As IConfigLexem In lexeme
                    context.Items.Add((item).BeginBlock, CStr(m_MethodComments(item.ID)), Me.EditControl1.ContextChoiceController.Images("Image" & item.FormatName))
                Next
            End If
        End If
    End Sub

1 个答案:

答案 0 :(得分:1)

您可以在控件中设置键绑定,这将阻止您需要捕获KeyDown事件。

例如,创建一些Sub来配置控件的属性(在我的示例中称为Editor)并添加以下行:

AddHandler Editor.Commands.Add("Editor.ContextChoice").ProcessCommand, AddressOf Editor.ShowContextChoice

Editor.KeyBinder.BindToCommand(Keys.Control Or Keys.Space, "Editor.ContextChoice")

检查安装以获取此功能的实际示例。选择安装样本是一个好主意,因为它们非常全面。

相关问题