简体   繁体   中英

TreeView Bold Node (C#)

I just have a quick question, actually, I just want to know if it's possible to check if a node from a treeview is in Bold? Because I can't find a solution on the Internet.

I have try this in my code :

            foreach (TreeNode node in nodesTvMsg)
            {

                if (node.NodeFont.Bold == true)
                {
                    MessageBox.Show("BOLD");
                } 
}

but it also works for those who are not bold and I also have this mistake : The object reference is not defined to an instance of an object.

Thank in advance ;)

Maybe you didnt assign New Font object which has Bold prop. not set true it is seen as false, you can diagnose easly "node.NodeFont.Bold == false" making true as false if it works. It means bold is set as false.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM