Can I display a node in standard ttreeview component with bold style without Custom drawing?

Source: Internet
Author: User
Can I display a node in standard TTreeView component with bold style without custom drawing?
Time-to-time I receive the question how I realized a selection by the bold font for some nodes in the SMReport Explorer form.Today I have decided to describe this very simple way (but very useful). It does not require an override of any custom drawing methods/events, creatinga new component etc. It's a real standard way.**********************************************************The standard Windows Treeview control have a few state flags (TVIS_BOLD and TVIS_CUT in our example), due to which it's possible to reach wished.At first, let's write the procedure SetNodeState:procedure SetNodeState(node: TTreeNode; Flags: Integer);var tvi: TTVItem;begin  FillChar(tvi, SizeOf(tvi), 0);  tvi.hItem := node.ItemID;  tvi.Mask := TVIF_STATE;  tvi.StateMask := TVIS_BOLD or TVIS_CUT;  tvi.State := Flags;  TreeView_SetItem(node.Handle, tvi);end;And now we can set a wished flags:SetNodeState(node, TVIS_BOLD) - to set the node as BoldSetNodeState(node, TVIS_CUT) - to set the node as CuttedSetNodeState(node, TVIS_BOLD or TVIS_CUT) - to set the node as Bold andCuttedSetNodeState(node, 0) - to set a node as normal*******************************************

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.