码迷,mamicode.com
首页 > 其他好文 > 详细

TreeView Class Kek Points

时间:2014-08-05 13:49:09      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   color   os   io   for   

 

TreeView keep selected node highlighted

 

bubuko.com,布布扣
public QualityCheck()
        {
            InitializeComponent();

            //trvIndexName.HideSelection = false;
            //trvIndexName.SelectedNode.BackColor = Color.BlueViolet;  // cause DLL problem

            trvIndexName.DrawMode = TreeViewDrawMode.OwnerDrawAll;
            trvIndexName.DrawNode += new DrawTreeNodeEventHandler(trvIndexName_DrawNode);

        }

        void trvIndexName_DrawNode(object sender, DrawTreeNodeEventArgs e)
        {
            if (((e.State & TreeNodeStates.Selected) != 0) && (!trvIndexName.Focused))
                e.Node.ForeColor = Color.Blue;
            else
                e.DrawDefault = true;
        }

        private void trvIndexName_BeforeSelect(object sender, TreeViewCancelEventArgs e)
        {
            if (trvIndexName.SelectedNode != null)
                trvIndexName.SelectedNode.ForeColor = Color.Black;
            e.Node.ForeColor = Color.Blue;
        }
View Code

 

TreeView Class Kek Points,布布扣,bubuko.com

TreeView Class Kek Points

标签:des   style   blog   http   color   os   io   for   

原文地址:http://www.cnblogs.com/kevinygq/p/3891920.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!