Вниз
Скачать: 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 вся ветка

Скачать: CL | DM;



Память: 0.44 MB
Время: 0.023 c
3-1108095477
КиТаЯц
2005-02-11 07:17
2005.03.13
FireBird. Селект с днями недели


1-1109585518
RavenD
2005-02-28 13:11
2005.03.13
Версия EXE из DLL?


3-1107974140
Топпер
2005-02-09 21:35
2005.03.13
Paradox ошибка нехватка памяти


3-1108024853
sashag
2005-02-10 11:40
2005.03.13
SET ROLE в Делфи (DOA, Oracle)


14-1108971521
Jeer
2005-02-21 10:38
2005.03.13
"Пить или не пить.."




   Наверх