Selected text in RichTextBox

2 posts, 0 answers
  1. vikas
    vikas avatar
    11 posts
    Member since:
    May 2011

    Posted 30 Jul 2014 Link to this post

    Hi Team,
    I want to get the selected text and change the font of it in rich text box. How can i achieve this.

    Please advise
    Thanks,
  2. Petya
    Admin
    Petya avatar
    975 posts

    Posted 04 Aug 2014 Link to this post

    Hi vikas,

    RadRichTextBox exposes a set of methods that can be used in the manner editing in the control works. Basically, they operate over the selected part of the document and if there is no selection - over the paragraph where the caret is positioned. To change the font settings of the current selection you can utilize these methods, for example:
    this.radRichTextBox.ChangeFontSize(20);
    this.radRichTextBox.ChangeFontFamily(new FontFamily("Arial"));

    I hope this helps.

    Regards,
    Petya
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top