セクションレポートのRichTextBoxコントロールのフォントを動的に変更する方法は?

文書番号 : 33965     文書種別 : 使用方法     登録日 : 2013/09/27     最終更新日 : 2013/09/27
文書を印刷する
対象製品
ActiveReports for .NET 7.0J
詳細
セクションレポートのRichTextBoxコントロールについて、フォントを動的に設定するには、SelectionStartおよびSelectionLengthプロパティで文字を選択した上で、SelectionFontプロパティにFontオブジェクトのインスタンスをセットします。

◆サンプルコード(VB.NET)
Private Sub Detail_Format(...) Handles Detail.Format
  ' すべてのフォントを選択します。
  Me.RichTextBox1.SelectionStart = 0
  Me.RichTextBox1.SelectionLength = Me.RichTextBox1.Text.Length

  ' 選択した文字のフォントを設定します。
  Me.RichTextBox1.SelectionFont _
    = New System.Drawing.Font("MS 明朝", _
     24.0F, System.Drawing.FontStyle.Regular, _
     System.Drawing.GraphicsUnit.Point, 128)
End Sub

◆サンプルコード(C#)
private void Detail_Format(object sender, System.EventArgs eArgs)
{
  // すべての文字を選択します。
  this.RichTextBox1.SelectionStart = 0;
  this.RichTextBox1.SelectionLength = this.RichTextBox1.Text.Length;

  // 選択した文字のフォントを設定します。
  this.RichTextBox1.SelectionFont
    = new System.Drawing.Font("MS 明朝", 24.0f,
     System.Drawing.FontStyle.Regular,
     System.Drawing.GraphicsUnit.Point, 128);
}
関連情報
キーワード
HowTo デザイン・レイアウト