1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
var
CurrentObjOLE : TReObject;
tmpRTF: String;
begin
// Si le RichEdit ne contient pas des objets
if ( CurrentRichEdit.RichEditOle.GetObjectCount = 0 ) then exit;
// on récupère l''image (OLE)
FillChar(CurrentObjOLE, SizeOf(CurrentObjOLE), 0);
CurrentObjOLE.cbStruct:= SizeOf(CurrentObjOLE);
CurrentRichEdit.RichEditOle.GetObject( IndexImg, CurrentObjOLE, REO_GETOBJ_POLEOBJ Or REO_GETOBJ_POLESITE );
// Si l''index n''est pas valide
if ( CurrentObjOLE.oleobj = nil) then exit;
// On sélectionne l''image
CurrentRichEdit.SelStart:= CurrentObjOLE.cp;
CurrentRichEdit.SelLength:= 1;
// On récupère le texte RTF de l''image
tmpRTF:= CurrentRichEdit.RTFSelText;
// On ajoute les attributs et la valeur de zoom
tmpRTF:= AnsiReplaceStr( tmpRTF, '\picw', '\picscalex' + IntToStr(valueZoom) + '\picscaley' + IntToStr(valueZoom) + '\picw' );
// On actualise le texte RTF de l''image
CurrentRichEdit.RTFSelText:= tmpRTF;
end; |
Partager