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

Вниз

Замена смайликов на картинки в TRxRichEdit.   Найти похожие ветки 

 
Dimaz-z ©   (2004-01-09 20:17) [0]

Замена смайликов на картинки в TRxRichEdit. Помогите, плз. Вот код для добавления TBitmap в TRxRichEdit:
// Messages - это TRxRichEdit

procedure AddBitmap(Bitmap: TBitmap);
var
SS: TStringStream;
begin
SS := TStringStream.Create(BitmapToRTF(Bitmap));

frm_main.Messages.Lines.LoadFromStream(SS);

SS.Free;
end;

function 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;

Как я не пробовал, у меня не получилось сделать такую вещь, чтобы можно было все смайлики (:), :(, :D, и.т.д.) заменить их на картинки. Помогите пожалуйста!!!


 
Dimaz-z ©   (2004-01-09 20:18) [1]

Там ещё Messages.StreamMode := [smSelection];


 
Dimaz-z ©   (2004-01-09 20:19) [2]

Получалось добавлять либо картинки, либо текст! А всё в перемешку никак! Приведите example кода, плз.



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

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

Наверх




Память: 0.47 MB
Время: 0.029 c
14-63332
npAKTuk
2003-12-29 21:09
2004.01.20
Конкурс на самый оригинальный способ проведения НГ


1-63158
Rimd
2004-01-06 16:51
2004.01.20
Rave Report


3-63011
Zloimu
2003-12-23 08:47
2004.01.20
Совместимость


14-63373
asdqwer
2003-12-28 19:40
2004.01.20
Алгоритм


14-63371
xman
2003-12-29 15:34
2004.01.20
ГЛЮК