Главная страница
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.024 c
4-1107204385
rks
2005-01-31 23:46
2005.03.13
Программирование USB


1-1109546756
KyRo
2005-02-28 02:25
2005.03.13
Директория программы


1-1109502653
eX
2005-02-27 14:10
2005.03.13
Проблема с Tchart


14-1109155428
Knight
2005-02-23 13:43
2005.03.13
Аська у кого сегодня работает?


14-1108735753
Cobalt
2005-02-18 17:09
2005.03.13
Есьт ли у вас в "команде" уроды?