lundi 20 avril 2015

c# Winform richtextbox font discrepancy

The font property of richtextbox doesn't seem to be working.

        // 
        // textBox_rawdata
        // 
        this.textBox_rawdata.DetectUrls = false;
        this.textBox_rawdata.Font = new System.Drawing.Font("NSimSun", 9F);
        this.textBox_rawdata.HideSelection = false;
        this.textBox_rawdata.Location = new System.Drawing.Point(22, 43);
        this.textBox_rawdata.Name = "textBox_rawdata";
        this.textBox_rawdata.Size = new System.Drawing.Size(368, 68);
        this.textBox_rawdata.TabIndex = 2;
        this.textBox_rawdata.Text = "AAAAAA";

I want the font of the richtextbox to be NSimSun, 9pt. As you can see in the picture, enter image description hereThe first few A's are preset and the last 3 A's are typed in by me. The issues is, the preset characters and any characters generated by the program are correctly displayed as NSimSun, 9pt. But as soon as I start typing in there, the font changes. (Like the last 3 A's)

How can I make the font NSimSun, 9pt for all text?

Aucun commentaire:

Enregistrer un commentaire