Problème affichage avec le InsertControl du RichEdit
Bonjour tout le monde,
j'utilise un TJvRichEdit (JEDI VCL), dans lequel j'arrive à insérer un TJvGIFAnimator qui me permet d'afficher un petit gif dans ma TJvRichEdit.
Le soucis est que, si j'ajoute du texte, celui-ci ne s'affiche plus. Je vois bien que le texte est sélectionnable avec mon souris donc il est bien ajouté. La seule solution que j'ai trouvée est de supprimer le TJvGIFAnimator (Free) est ainsi le texte s'affiche.
Code:
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 29 30 31 32 33 34 35 36 37 38 39 40
|
//add texte
RichEdit.Lines.Add( Str );
//save select start
itemp := RichEdit.SelStart;
RichEdit.SelStart := RichEdit.Perform(Messages.EM_LINEINDEX, WPARAM(RichEdit.Lines.Count -1), 0);
RichEdit.SelLength := itemp - RichEdit.SelStart; //RichEdit1.Perform(Messages.EM_LINELENGTH, WPARAM(RichEdit1.Lines.Count -1), 0);
RichEdit.SelAttributes.Color := color;
RichEdit.SelAttributes.Style := style;
//With RichEdit do
//SelStart := Perform(EM_LINEINDEX, RichEdit.Lines.count - 1, 0);
RichEdit.SelStart := MaxInt;
SendMessage(RichEdit.handle, EM_SCROLLCARET,0,0);
if (ModeLoad = true) then
begin
try
JvGIFAnimator1 := TJvGIFAnimator.Create(RichEdit);
JvGIFAnimator1.AutoSize := false;
JvGIFAnimator1.Stretch := true;
JvGIFAnimator1.Width := 13;
JvGIFAnimator1.Height := 13;
JvGIFAnimator1.Image.LoadFromFile('loading.gif');
JvGIFAnimator1.Animate := true;
RichEdit.InsertControl(JvGIFAnimator1);
finally
end;
end
else
begin
if (RichEdit.ContainsControl(JvGIFAnimator1) = true) then
begin
//JvGIFAnimator1.Free;
end;
RichEdit.Refresh;
end;
//RichEdit.setCaretPos |
Si vous avez des astuces je veux bien les prendre ! Merci beaucoup :)