如何取消选择组合框的文本 [英] How to deselect the text of a combobox

查看:98
本文介绍了如何取消选择组合框的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的数据与键 - 值对列表绑定氪组合框。发生的事情是,当我在代码中设置所选的项目,它突出显示的文本。我怎样才能避免这种情况或取消选择文本

I have a krypton combo box which I data bind with a list of key-value pairs. What's happening is that when I set the selected item in code, it is highlighting the text. How can I prevent this or deselect the text?

我已经试过如下:?

// 1
combo.Select(0,0);
// 2
combo.Focus();
anotherControl.Focus();
// 3
combo.SelectionStart = 0;
combo.SelectionLength = combo.Text.Length;
// 4 
combo.SelectionStart = combo.Text.Length;
combo.SelectionLength = 0;



似乎没有任何工作。任何帮助表示赞赏。

Nothing seems to work. Any help is appreciated.

推荐答案

我设法完成这一被重写我的控制/窗口的OnPaint事件,做

I managed accomplishing this be overriding the OnPaint event of my control/window and doing

combobox1.SelectionLength = 0;

这篇关于如何取消选择组合框的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆