InsertPicture help

General TRichView support forum. Please post your questions here
Post Reply
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

InsertPicture help

Post 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:
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you insert pictures in a table cell?
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post by Ceprotec »

Inglês -
no, I'm inserting in direct richview

português -
não, estou inserindo direto no richview
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post 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);
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post 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!
Post Reply