Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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
 
Old December 12th, 2006, 06:26 AM
Registered User
 
Join Date: Nov 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using different colors and fonts in a richtextbox

Hi,

How can I print a line in a richtextbox with a different color, font, style (bold-underline-regular) than another line.
For example : I want to print a title-line in bold and color green. The rest off the text has to be in black and regular (or the color and font set in the properties off the textbox).
When I change a color in the textbox with code, the whole textbox is changed. I just want some lines in another color. I tried to slove the problem with a selectiontext and selectionfont but then also the whole textbox was in green and bold ! How can I do that ?

thanks,

Pascal.

 
Old December 14th, 2006, 08:45 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

textbox do not support rich text format.
create a font object with desired font-family,font-size etc.
and set property selectionfont of richtextbox to font object.
To change the color of text
RichtextBox1.SelectionColor=Color.<whatever color you want>

Bijgupt





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Print RichTextBox marcusbris VB How-To 0 December 2nd, 2006 09:29 AM
SOLVED...Adding Colors to Wingding Fonts eusanpe Access 0 November 30th, 2006 11:35 AM
Word has no Fonts BrianWren Word VBA 1 September 8th, 2006 12:33 PM
RichTextBox Help Kaustav VB How-To 1 February 22nd, 2006 03:53 PM
What is the use of a richtextbox? snowydust VB How-To 2 July 28th, 2004 11:05 AM





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