掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
MemoやRichEditで文字単位で背景色の設定 (ID:19466)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
すみません。すぐ理解していただけそうに思って書き出しませんでした。 ////////////////////////// unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls, richedit; type TForm1 = class(TForm) RichEdit1: TRichEdit; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private 宣言 } public { Public 宣言 } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); var Format: CHARFORMAT2; begin FillChar(Format, SizeOf(Format), 0); with Format do begin cbSize := SizeOf(Format); dwMask := CFM_BACKCOLOR + CFM_COLOR; crTextColor := clRed; crBackColor := ciYellow; RichEdit1.Perform(EM_SETCHARFORMAT, SCF_SELECTION, Longint(@Format)); end; end; end. ///////////////////// 未定義・・・ CHARFORMAT2 cbSize dwMask crTextColor crBackColor ciYellow
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.