SelColor(RichTextなど)
SelColorプロパティは選択しているテキストの色を取得, または設定します。Delphiでは 「SelAttributes」プロパティ(TTextAttributes型)の 「Color」プロパティで設定可能です。
■ TRichEditに色を設定する例 procedure TForm1.btnBoldClick(Sender: TObject); begin {カラーダイアログに現在の色を設定} ColorDialog1.Color := RichEdit1.SelAttributes.Color; {カラーダイアログを表示} if (ColorDialog1.Execute) then begin {選ばれた色を適用する} RichEdit1.SelAttributes.Color := ColorDialog1.Color; end; end;