Показать сообщение отдельно
  #8  
Старый 12.09.2010, 09:58
Аватар для Страдалецъ
Страдалецъ Страдалецъ вне форума
Гуру
 
Регистрация: 09.03.2009
Адрес: На курорте, из окна вижу теплое Баренцево море. Бррр.
Сообщения: 4,723
Репутация: 52347
По умолчанию

Мемо для выделения слов не подходит. Используйте RichEdit. Вот пример работы с этим компоненттом:
Код:
procedure TForm1.AddBookLine( Author, Title, Publisher, Year : string);
var
Indent : integer;
begin
with RichEdit1 do begin
Lines.Add(''); // add blank line
SelStart := SelStart - 2; // before final CRLF
{add Author}
SelAttributes.Style := []; // Style is a set so enclose all styles in
square brackets
SelText := Author + '. '; // SetStart is now positioned after inserted
text
{add Title}
SelAttributes.Style := [fsItalic];
SelText := Title + '. ';
{add Publisher}
SelAttributes.Style := [fsBold];
SelText := Publisher + '. ';
{add Year}
SelAttributes.Style := [];
SelText := Year + '.';
{set Paragraph indents}
Indent := (Parent as TForm).Canvas.TextWidth(' '); // pixel
width of 10 spaces
Paragraph.LeftIndent := Indent;
Paragraph.FirstIndent := -Indent;
end; {with RichEdit1}
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
AddBookLine('Alan Lloyd', 'RichEdit Revealed',
'Delphi Document Press', '2000');
end;
__________________
Жизнь такова какова она есть и больше никакова.
Помогаю за спасибо.
Ответить с цитированием