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

Вниз

Графика в TRichEdit   Найти похожие ветки 

 
ivane   (2005-01-29 12:18) [0]

Есть RichEdit. Нужно в середине текста поместить картинку. Как или с помощью чего это сделать?


 
fess ©   (2005-01-30 16:04) [1]

Используй библиотеку RxLib и компонент RxRichEdit.
Функция для рисунка копирования рисунка в формат rtf:

function TMainFormInput.BitmapToRTF(pict: TBitmap): string;
var
  bi, bb, rtf: string;
  bis, bbs: Cardinal;
  achar: ShortString;
  hexpict: string;
  I: Integer;
begin
  GetDIBSizes(pict.Handle, bis, bbs);
  SetLength(bi, bis);
  SetLength(bb, bbs);
  GetDIB(pict.Handle, pict.Palette, PChar(bi)^, PChar(bb)^);
  rtf := "{\rtf1 {\pict\dibitmap ";
  SetLength(hexpict, (Length(bb) + Length(bi)) * 2);
  I := 2;
  for bis := 1 to Length(bi) do
     begin
        achar := Format("%x", [Integer(bi[bis])]);
        if Length(achar) = 1 then
           achar := "0" + achar;
        hexpict[I - 1] := achar[1];
        hexpict[I] := achar[2];
        Inc(I, 2);
     end;
  for bbs := 1 to Length(bb) do
     begin
        achar := Format("%x", [Integer(bb[bbs])]);
        if Length(achar) = 1 then
           achar := "0" + achar;
        hexpict[I - 1] := achar[1];
        hexpict[I] := achar[2];
        Inc(I, 2);
     end;
  rtf := rtf + hexpict + " }}";
  Result := rtf;
end;

Пример использования

...
SS: TStringStream;
  BMP: TBitMap;
begin
...
BMP := TBitMap.Create;
BMP.LoadFromFile("C:\temp\tests\data\" + dm.q2.FieldByName("Id_Question").AsString + ".bmp");
SS := TStringStream.Create(BitmapToRTF(BMP));
RichEdit1.PlainText := False;
RichEdit1.StreamMode := [smSelection];
RichEdit1.Lines.LoadFromStream(SS);
RichEdit1.StreamMode := [];
SS.Free;
BMP.Free;
end;


 
Eraser ©   (2005-01-31 16:13) [2]

fess ©
Весь интернет заполнин этим примером, но что самое удивительное- он не работает ;-)))

ivane
http://sourceforge.net/projects/jvcl/



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

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

Наверх




Память: 0.47 MB
Время: 0.063 c
1-1107202771
foont
2005-01-31 23:19
2005.02.13
из *.pdf в *.doc


1-1107097872
rolex
2005-01-30 18:11
2005.02.13
Как убрать иконку в заголовке окна?


14-1106675558
Ломброзо
2005-01-25 20:52
2005.02.13
Электрические библиотеки


14-1106436167
Franzy
2005-01-23 02:22
2005.02.13
Странный глюк Win98SE


1-1106988127
Zuborob
2005-01-29 11:42
2005.02.13
Корни N-ной степени и возведение в N-степень