Page 1 of 1

InsertPicture help

Posted: Thu Jul 23, 2015 8:23 pm
by Ceprotec
Hello Sergey, see the problem I'm having to use the function InsertPicture:

Image

this is the source code:

Code: Select all

procedure TFrmCadEditorRegistro.ListaImagensDblClick(Sender: TObject);
var gr: TGraphic;
var image: TImage;
var ultimalinha: Integer;
begin
    inherited;
    ultimalinha := RetornaLinha;

    image := TImage.Create(Application);
    image.Picture.Assign(TBitmap(ImageList[ListaImagens.ItemIndex]));

    SRichViewEdit1.RichViewEdit.BeginUndoGroup(rvutInsert);
    SRichViewEdit1.RichViewEdit.SetUndoGroupMode(True);
    gr := RV_CreateGraphics(TGraphicClass(image.Picture.Graphic.ClassType));
    gr.Assign(image.Picture.Graphic);
    rvActionAlignJustify1.Execute;
    if SRichViewEdit1.RichViewEdit.InsertPicture('',gr,rvvaBaseline) then
    begin
        SRichViewEdit1.RichViewEdit.SetCurrentItemExtraIntProperty(rvepImageHeight,600,True);
        SRichViewEdit1.RichViewEdit.SetCurrentItemExtraIntProperty(rvepImageWidth,500,True); 
        SRichViewEdit1.RichViewEdit.SetUndoGroupMode(false);
        SRichViewEdit1.RichViewEdit.InsertText('-');
    end;
    FreeAndNil(image);
end;
Thanks!


Português:
Olá Sergey, veja o problema que estou tendo ao usar a função InsertPicture:

--
este é o código fonte:

Posted: Thu Jul 23, 2015 8:56 pm
by Sergey Tkachenko
Do you insert pictures in a table cell?

Posted: Fri Jul 24, 2015 11:20 am
by Ceprotec
Inglês -
no, I'm inserting in direct richview

português -
não, estou inserindo direto no richview

Posted: Fri Jul 24, 2015 11:46 am
by Ceprotec
Inglês -
I managed to solve:

Português -
Consegui resolver

look:

Code: Select all

    
    ultimalinha := RetornaLinha;

    image := TImage.Create(Application);
    image.Picture.Assign(TBitmap(ImageList[ListaImagens.ItemIndex]));

    SRichViewEdit1.RichViewEdit.BeginUndoGroup(rvutInsert);
    SRichViewEdit1.RichViewEdit.SetUndoGroupMode(True);
    gr := RV_CreateGraphics(TGraphicClass(image.Picture.Graphic.ClassType)); 
    gr.Assign(image.Picture.Graphic);

    if SRichViewEdit1.RichViewEdit.InsertPicture('',gr,rvvaBaseline) then
    begin
        SRichViewEdit1.RichViewEdit.SetCurrentItemExtraIntProperty(rvepImageHeight,600,True);
        SRichViewEdit1.RichViewEdit.SetCurrentItemExtraIntProperty(rvepImageWidth,500,True); 
        SRichViewEdit1.RichViewEdit.SetUndoGroupMode(false);

        GoToLine(ultimalinha + 3,SRichViewEdit1.RichViewEdit);
        SRichViewEdit1.RichViewEdit.InsertText('-');
    end;
    FreeAndNil(image);

Posted: Fri Jul 24, 2015 12:25 pm
by Sergey Tkachenko
I do not see the difference between two versions of your code, except for applying justify alignment, which should not affect the result.

Posted: Fri Jul 24, 2015 1:02 pm
by Ceprotec
- Ingês
I used before insert the '-', GoToLine

-Português
eu usei antes de inserir o '-', GoToLine

Code: Select all

        GoToLine(ultimalinha + 3,SRichViewEdit1.RichViewEdit);
        SRichViewEdit1.RichViewEdit.InsertText('-');
- Inglês
then worked!

- Português
aí funcionou!