Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
| Search | Today's Posts | Mark Forums Read
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 20th, 2006, 12:49 AM
Authorized User
 
Join Date: Sep 2005
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Change treeview node font-style programmatically

Hello,

I'm a newbie C# developer (2005) and I've created a database-driven treeview control. I have a method that's called once the main winform loads that pulls some basic information from the database to populate the treeview. The main three parent nodes are created with:

Code:
this.tvMain.Nodes.Add("Client Name");
My question is, how do I change the font style of this particular node to be bold?

Thanks in advance!

Panuvin

  #2 (permalink)  
Old May 23rd, 2006, 09:05 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Panuvin!

Try to do this:

//Define a variable and stablish the created node with the variable
TreeNode node = tvMain.Nodes.Add("Client Name");

//Change the NodeFont property of the created node, as you need
node.NodeFont = new Font(tvMain.Nodes.Font, FontStyle.Bold);

Cheers,

José Antonio

  #3 (permalink)  
Old December 15th, 2007, 02:59 AM
Authorized User
 
Join Date: Dec 2007
Location: Bangalore, Karnataka, India.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to pannasn
Default

Hi Panuvin,

Can u please tell me how to combine fontstyles bold and italic i.e.,
(bold+italic). The text should be like this : Panuvin

Thanks
Panna



Similar Threads
Thread Thread Starter Forum Replies Last Post
Programmatically select a treeview node and expand simsen ASP.NET 2.0 Professional 0 June 23rd, 2008 01:57 AM
Different Font Style For Elements in Drop Down Box kunal_kishan HTML Code Clinic 1 July 11th, 2006 09:01 AM
ANYONE: Page Break in Excel / Font Style shagaset Classic ASP Basics 4 December 20th, 2004 01:09 PM
Page Breaks and Font Style in Excel shagaset Classic ASP Professional 2 December 14th, 2004 10:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.