Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to draw text in the node of a TTreeView in bold style Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
31-Oct-02
Category
VCL-General
Language
Delphi 2.x
Views
140
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

I would like to write the text of each node in a TTreeview by including the text in 
the standard way with a trailing number written in bold and color blue.

Answer:

This is a code snippet of a descendant of a TTreeView that handles the bold state 
of a treenode:
1   
2   function TTreeView1.GetNodeBoldState(Node: TTreeNode): boolean;
3   var
4     TVItem: TTVItem;
5   begin
6     result := false;
7     if not Assigned(Node) then
8       exit;
9     with TVItem do
10    begin
11      mask := TVIF_STATE;
12      hitem := Node.ItemId;
13      result := TreeView_GetItem(Node.Handle, TVItem) and ((State and TVIS_BOLD) <> 
14  0);
15    end;
16  end;
17  
18  procedure TTreeView1.SetNodeBoldState(Node: TTreeNode; value: boolean);
19  var
20    TVItem: TTVItem;
21  begin
22    if not Assigned(Node) then
23      exit;
24    fillchar(TVItem, sizeof(TVItem), 0);
25    with TVItem do
26    begin
27      mask := TVIF_STATE or TVIF_HANDLE;
28      hitem := Node.ItemId;
29      StateMask := TVIS_BOLD;
30      if value then
31        State := TVIS_BOLD;
32      TreeView_SetItem(Node.Handle, TVItem);
33    end;
34  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC