Buen día, jóvenes de DelphiAccess.
Una duda que me surge a partir de una sugerencia de trabajo de mi jefe. ¿Es posible incluir en un TRichMemo? ¿Y cómo puede hacerse?
Gracias por sus colaboraciones.
TRichMemo y las imágenes.
Comenzado por
TiammatMX
, dic 14 2011 11:20
3 respuestas en este tema
#1
Escrito 14 diciembre 2011 - 11:20
#2
Escrito 14 diciembre 2011 - 11:32
Te referiras aTRichEdit? porque RichMemo es de Lazarus.
#3
Escrito 14 diciembre 2011 - 11:41
Te referiras aTRichEdit? porque RichMemo es de Lazarus.
Sí, TRichEdit..., confusión mental mía...
#4
Escrito 14 diciembre 2011 - 11:48
Bueno de que se puede se puede, tenia esto que consegui de Delphi3000.com, lo pongo aqui para que se vea mejor:
Su uso seria:
Espero te sea Util de alguna manera.
Saludos.
delphi
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;
Su uso seria:
delphi
Stream := TStringStream.Create(BitmapToRTF(BMP)); //BMP es un TBitmap con una imagen RichEdit1.PlainText := False; RichEdit1.StreamMode := [smSelection]; RichEdit1.Lines.LoadFromStream(Stream); Stream.Free;
Espero te sea Util de alguna manera.
Saludos.