Now I use the following code to generate RTF-encoded DIB from bitmap (like it is described in Rich Text Format reference from Microsoft):
unit URTF;
{
Source: http://www.delphi3000.com/
}
interface
uses
SysUtils,
Classes,
Graphics;
function BitmapToRTF(pict: TBitmap): String;
implementation
function BitmapToRTF;
var
bi,bb,rtf: string;
bis,bbs: Cardinal;
achar: ShortString;
hexpict: string;
I: Integer;
begin
GetDIBSizes(pict.Handle,bi
SetLength(bi,bis);
SetLength(bb,bbs);
GetDIB(pict.Handle,pict.Pa
rtf := '{\rtf1 {\pict\dibitmap0 ';
SetLength(hexpict,(Length(
I := 2;
for bis := 1 to Length(bi) do
begin
achar := IntToHex(Integer(bi[bis]),
hexpict[I-1] := achar[1];
hexpict[I] := achar[2];
Inc(I,2);
end;
for bbs := 1 to Length(bb) do
begin
achar := IntToHex(Integer(bb[bbs]),
hexpict[I-1] := achar[1];
hexpict[I] := achar[2];
Inc(I,2);
end;
rtf := rtf + hexpict + ' }}';
Result := rtf;
end;
end.
Then I use TStringStream and TRichEdit.LoadFromStream to replace the selection with emoticon.
Previously I tried to use RTF's encoded by WordPad with inline object (MS Paint). When I use DIB instead of inline object, there is no opportunity to edit image with Paint but the user still can drag the picture's bounds resizing it.
Main Topics
Browse All Topics





by: Imthiyaz_phPosted on 2004-11-15 at 05:04:47ID: 12583359
could plz explain how u r inserting the emoticons?