Вверх ↑
Ответов: 5446
Рейтинг: 323
#1: 2011-12-12 17:22:45 ЛС | профиль | цитата
nesco, угу.
#pas
procedure THIRichEdit._work_doFormat;
var Text:string;
p:byte;
oldColor, oldStart, oldEnd: integer;
oldBold,oldItalic,oldUnderline:Boolean;

begin
if (Control.SelLength <> 0) then {no valid selection -> quit}
begin
Control.RE_CharFmtArea := raSelection; {apply attribute(s) only to selection}

oldColor := Control.RE_FmtFontColor;
oldBold := Control.RE_FmtBold;
oldItalic := Control.RE_FmtItalic;
oldUnderline := Control.RE_FmtUnderline
oldStart := Control.SelStart;
oldEnd := Control.SelEnd;

Control.RE_FmtFontColor := ReadInteger(_Data,_data_Color,0);

p := ReadInteger(_Data,_data_Style,0);
Control.RE_FmtBold := p and 1 > 0;
Control.RE_FmtItalic := p and 2 > 0;
Control.RE_FmtUnderline := p and 4 > 0;

Control.SelStart := -1;
Control.SelEnd := 0;

Control.RE_FmtFontColor := oldColor;
Control.RE_FmtBold := oldBold;
Control.RE_FmtItalic := oldItalic;
Control.RE_FmtUnderline := oldUnderline;

Control.SelStart := oldStart;
Control.SelEnd := oldEnd;
end;
end;

карма: 1

0