Page 1 of 1

Insert Picture in SRichViewEdit

Posted: Wed May 18, 2011 9:19 am
by Thr33D
Hello,

I have a problem. I want insert a picture (JPEG) in SRichViewEdit and change the size of the height and width.
Maybe you can give an example code.

Greets

Posted: Wed May 18, 2011 4:18 pm
by Sergey Tkachenko
To change width and height in code?

Posted: Wed May 18, 2011 7:15 pm
by Thr33D
Yes, I would like to insert an image and in the same procedure I would change the size of the image.

Posted: Thu May 19, 2011 6:44 pm
by Sergey Tkachenko

Code: Select all

with SRichViewEdit1.ActiveEditor.TopLevelEditor do begin
  BeginUndoGroup(rvutInsert); 
  SetUndoGroupMode(True); 
  if InsertPicture('', jpg, rvvaBaseline) then begin 
      SetCurrentItemExtraIntProperty(rvepImageHeight, SIZE, True); 
      SetCurrentItemExtraIntProperty(rvepImageWidth, SIZE, True); 
  end; 
  SetUndoGroupMode(False); 
end;
This code inserts jpg and resizes it to SIZE x SIZE (the image itself is not modified, it is only displayed scaled).
By default, SIZE is measured in pixels. However, it may be measured in twips, if SRichViewEdit1.ConvertToTwips was called (like in the ActionTest demos)