Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.03.13;
Скачать: CL | DM;

Вниз

RichEdit   Найти похожие ветки 

 
dm37   (2005-02-28 10:35) [0]

Подскажите, как в RichEdit добавлять текст с атрибутами (color,font_name,style), например:
RichEdit.Lines.Add("asdf"); // красный цвет символов
RichEdit.Lines.Add("ghjk"); // зеленый цвет символов
и т.д.
Нужно самому ставить теги или есть свойства объекта?


 
КаПиБаРа ©   (2005-02-28 10:39) [1]

F1 - TRichEdit.SelAttributes


 
Erik1 ©   (2005-02-28 12:30) [2]

А также:
procedure TAsp.AddText(const Text: WideString; Attrib: Attributs;
 tSize: Byte; const FontName: WideString);
Var MyStyle: TFontStyles; MyFont: String;
MySize: Byte;
MyAlignment: TParaAlignment;
begin
if Invisable = nil Then exit;

//  MyAlignment := MyAlignment - MyAlignment;
 if Attrib <> 0 Then begin
   if (stNormal and Attrib) = stNormal then
   begin
    MyStyle  := MyStyle - MyStyle;
MyFont := "Times New Roman"; MySize := 10;
       MyAlignment := paLeftJustify;
   end
   else begin
    With Invisable.RichEdit.DefAttributes do        begin
      MyStyle := Style;
      MyFont := Name;
      MySize := Size;
    end;
    MyAlignment := Invisable.RichEdit.Paragraph.Alignment;
   end;

  if (stBold and Attrib) = stBold Then MyStyle := MyStyle + [fsBold];
   if (stItalic and Attrib) = stItalic Then MyStyle := MyStyle + [fsItalic];
   if (stUnderline and Attrib) = stUnderline Then MyStyle := MyStyle + [fsUnderline];
   if tSize <> 0 Then MySize := tSize;
   if FontName <> "" Then MyFont := FontName;

 With Invisable.RichEdit  do begin
    WordAttributes.Style := MyStyle;
     WordAttributes.Name := MyFont;
  WordAttributes.Size := MySize;
     WordAttributes.Charset := 186; //BALTIC_CHARSET  Replase Cyrilic
    DefAttributes.Style := MyStyle;
     DefAttributes.Name := MyFont;
  DefAttributes.Size := MySize;
     DefAttributes.Charset := 186; //BALTIC_CHARSET  Replase Cyrilic
   end;

end;

 With Invisable.RichEdit.Paragraph do begin
  Case ((agCenter or agLeft or agRight) and Attrib) of
  agLeft: MyAlignment := {$IFDEF RxLib}paLeftJustify;{$ELSE}taLeftJustify;{$ENDIF}
     agCenter: MyAlignment := {$IFDEF RxLib}paCenter;{$ELSE}taCenter;{$ENDIF}
     agRight: MyAlignment := {$IFDEF RxLib}paRightJustify;{$ELSE}taRightJustify;{$ENDIF}
   end;
 Alignment := MyAlignment;
   if (pgBullet and Attrib) = pgBullet Then Numbering := nsBullet else Numbering := nsNone;
 end;

Invisable.RichEdit.Lines.Add(Text);
end;


 
dm37   (2005-02-28 13:40) [3]

Спасибо, все заработало



Страницы: 1 вся ветка

Текущий архив: 2005.03.13;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.043 c
9-1102850191
DeadMeat
2004-12-12 14:16
2005.03.13
Цена моделей


4-1107237777
sergeiA
2005-02-01 09:02
2005.03.13
CreateThread-очередной глупый вопрос


4-1107264874
stud
2005-02-01 16:34
2005.03.13
проблема с протоколом MODBUS


14-1108717649
kai
2005-02-18 12:07
2005.03.13
beeline+gprs+icq+вечером=не коннектится


3-1107872776
Korefey
2005-02-08 17:26
2005.03.13
SQL запрос через ODBC