PC Review


Reply
Thread Tools Rate Thread

Make Treeview Node Font Bold

 
 
Ben
Guest
Posts: n/a
 
      18th Feb 2007
Hi

I am having problems making a single node's Font Bold.

objUserTree.Nodes.Item(i)


I am looping though the items but with every property I try it fails.

Thanks
B


 
Reply With Quote
 
 
 
 
Lloyd Sheen
Guest
Posts: n/a
 
      18th Feb 2007
The return value of ....Item(i) is a TreeViewNode. That object does not
have a font property. I think if you want to make them visually different
you could use the Backcolour / ForeColor or make the control a userpaint
DrawMode = OwnerDrawText . I have not tried the latter but I am sure you
can find examples on the web.

Lloyd Sheen

"Ben" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I am having problems making a single node's Font Bold.
>
> objUserTree.Nodes.Item(i)
>
>
> I am looping though the items but with every property I try it fails.
>
> Thanks
> B
>


 
Reply With Quote
 
 
 
 
Phill W.
Guest
Posts: n/a
 
      19th Feb 2007
Ben wrote:

> I am having problems making a single node's Font Bold.


The TreeNode class sports a NodeFont property (of Type [Font]), but you
can't set individual properties on it; you have to create a whole new
Font object and replace the existing one, as in :

With objUserTree.Nodes.Item(i)
.NodeFont = New Font( .NodeFont, FontStyle.Bold )
End With

You might want to build this "boldFont" object [once] and store it
somewhere, rather than recreating it every time you want to make a Node
bold.

HTH,
Phill W.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Treeview : Adding a node to a specific existing node with Net 1.0(work with 2.0) michelqa@yahoo.ca Microsoft C# .NET 2 12th Jun 2008 08:18 AM
TreeView node style - for an individual node Homer J. Simpson Microsoft ASP .NET 5 24th Jul 2007 11:04 PM
How to find node in TreeView by using string(the same as Node.Text) ? jiing Microsoft ASP .NET 0 27th Apr 2007 03:34 AM
Context menu popup on treeview node returning wrong selected node Claire Microsoft C# .NET 2 5th Mar 2007 12:59 PM
How can I determine the node number of a node in my treeview meh Microsoft VB .NET 2 4th Sep 2003 04:58 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:41 AM.