How can I get background color at cursor(or any) postion?
Example:
//select some text and press:
procedure TForm1.Button1Click(Sender: TObject);
var
fp: TFontParams;
begin
RichMemo1.GetTextAttributes(RichMemo1.SelStart, fp);
fp.BkColor := clYellow;
fp.Color := clRed;
fp.Style := [fsBold];
RichMemo1.SetTextAttributes(RichMemo1.SelStart, RichMemo1.SelLength, fp);
end;
//then select some text in yellow back color and press:
procedure TForm1.Button2Click(Sender: TObject);
var
fp: TFontParams;
cl: TColor;
begin
RichMemo1.GetTextAttributes(RichMemo1.SelStart, fp);
//fp.BkColor := clYellow; // I want USE OLD! but... =empty!
cl := fp.BkColor; //empty!
fp.Color := clBlue;
fp.Style := [fsBold];
RichMemo1.SetTextAttributes(RichMemo1.SelStart, RichMemo1.SelLength, fp);
end;