I would like to highlight the selected text by the user with cursor. The highlight button has the same function with the one in office word. Besides that, can anyone provide me some information on how to do the function such as bolding, font size and etc just like in the office word. I have no idea how to do this in visual studio 2010 c#. I am implementing my application in window forms. I try to googled it but found nothing. Your help is greatly appreciated. Thanks.
highlight the selected text in richtextbox
Page 1 of 11 Replies - 1079 Views - Last Post: 17 December 2010 - 01:41 AM
Replies To: highlight the selected text in richtextbox
#2
Re: highlight the selected text in richtextbox
Posted 17 December 2010 - 01:41 AM
Here is a little example how to bold a selected text.
private void Button_Bold(object sender, EventArgs e)
{
if (richTextBox1.SelectionFont != null)
{
Font currentFont = richTextBox1.SelectionFont;
FontStyle newFontStyle;
newFontStyle = FontStyle.Bold;
richTextBox1.SelectionFont = new Font(currentFont.FontFamily, currentFont.Size,newFontStyle);
}
}
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|