Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8612715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:41:46+00:00 2026-06-12T04:41:46+00:00

In the code below if I set Font before Rtf the font does not

  • 0

In the code below if I set Font before Rtf the font does not change. Font must be set after Rtf. Is this some quirk of RichTextBox?

        [TestMethod]
        public void FontProblemTest()
        {
            Form f = new Form();
            RichTextBox brtb = new RichTextBox();
            brtb.Width = 800;
            brtb.Height = 500;
            brtb.Font = new System.Drawing.Font(new System.Drawing.FontFamily("Courier New"), 8.25F, System.Drawing.FontStyle.Regular);//font set here has no effect
            brtb.Rtf = @"{\rtf1\ansi\deff0{\fonttbl{\f0\fnil Arial;}{\f1\fnil\fcharset0 Courier New;}}" +
@"{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\trowd\trgaph10\trleft-10\trpaddl10\trpaddr10\trpaddfl3\trpaddfr3" +
@"\cellx1140\cellx3740\cellx7340\pard\intbl\lang1033\f0\fs20\cell Whole Chart, Low to High\cell Most Recent (7/14/2002 10:17 AM)\cell\row" +
@"}";
            //brtb.Font = new System.Drawing.Font(new System.Drawing.FontFamily("Courier New"), 8.25F, System.Drawing.FontStyle.Regular);//font must be set after rtf.
            f.Controls.Add(brtb);
            f.Width = 1000;
            f.Height = 800;
            f.ShowDialog();
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:41:47+00:00Added an answer on June 12, 2026 at 4:41 am

    I think that the Rtf is what is responsible for Font/Colors/Spacing etc… The font is already changed when you insert

    brtb.Font = new System.Drawing.Font(new System.Drawing.FontFamily("Courier New"), 8.25F, System.Drawing.FontStyle.Regular);//font set here has no effect
    

    but because you insert

    brtb.Rtf = @"{\rtf1\ansi\deff0{\fonttbl{\f0\fnil Arial;}{\f1\fnil\fcharset0 Courier New;}}" +
    @"{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\trowd\trgaph10\trleft-10\trpaddl10\trpaddr10\trpaddfl3\trpaddfr3" +
    @"\cellx1140\cellx3740\cellx7340\pard\intbl\lang1033\f0\fs20\cell Whole Chart, Low to High\cell Most Recent (7/14/2002 10:17 AM)\cell\row" +
    @"}";
    

    it will simply overwrite the font you set before.

    REMARK Saving the brtb.Rtf value to a new .rtf document will allow you to view the rows you created in brtb.Rtf

    Thanks,

    I hope this helps 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to set up a Backbone application. This code below gives to following
I've got the code below, and I'm trying to set the from field to
I'm trying to set the port on a cookie in ASP.NET (code below), but
my code like below public class User { public int ID { get; set;
I have a set of code as per below. The point is to have
Below is a code snippet from a book. Why can serialNumber still be set
Below is my code from my activity. I call setKey() to set the key,
The code below simply didn't work. document.getElementById('files').addEventListener('change', handleFileSelect, false); reported by firebug that this
I have some code that does custom drawing. Basically it is form fill program
.I have the following code. I am wondering why does my echo '<font color=#FF0000>'.$update_date2.'</font><br><br>'.$status.'<br>';

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.