如何将焦点显示在空树视图上? [英] How can focus show on an empty tree view?

查看:65
本文介绍了如何将焦点显示在空树视图上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当树视图包含节点时,焦点将转到树视图节点,但如果树视图中没有elemet,则默认情况下,树视图的边框上不显示焦点。如何才能带来这样的关注。 

When tree view containjs nodes then the focus goes to the tree view node, but if there are no elemetns in treeview, then by default no focus is shown on borderof tree view. How can one bring such focus. 

推荐答案

嗨Vimegh,

Hi Vimegh,

众所周知,TreeView控件用作容器,因此当它没有节点作为容器时它是无意义的存在,它不能使用Focus()方法通过我的测试自己获得焦点,并且  we也不能
使用点击事件等。

As we all know, the TreeView control is used as a container, so it is a meaningless existence when there are no nodes in it, as a container, it can not use the Focus() method to get the focus by itself through my tests, and we also can not use the click event and etc.

但是当鼠标输入时,可能会更改TreeView的边框样式:

But it is possible that change the border style of the TreeView when the mouse enter in it:

private void treeView1_MouseHover(object sender, EventArgs e)
{
      treeView1.BorderStyle = BorderStyle.None;
}

或许您可以尝试自定义树视图控件来实现您的请求。

Or maybe you can try to customize a treeview control to implement your request.

希望它有所帮助!

最诚挚的问候,

Stanly


这篇关于如何将焦点显示在空树视图上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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