文字スタイルを変更する

Focusだけで、Activeにならない場合、Selectを実行してみる

Button1.Focus();

Button1.Select();

// Meiryo UI の 12 ポイントに設定する
this.RichTextBox1.Font = new Font(“Meiryo UI”, 12);

// 同時に、太字のスタイルを設定する
this.RichTextBox1.Font = new Font(“Meiryo UI”, 12, FontStyle.Bold);

// 更に、斜体のスタイルを設定する
this.RichTextBox1.Font = new Font(“Meiryo UI”, 12, FontStyle.Bold | FontStyle.Italic);

// 以下の方法もあります。

  Font fnt = new Font(“Meiryo UI”,12, FontStyle.Bold);
this.RichTextBox1
.SelectionFont = fnt;

C#, 全般 / by

投稿者: jj