Insert Picture in SRichViewEdit

General TRichView support forum. Please post your questions here
Post Reply
Thr33D
Posts: 9
Joined: Mon Apr 11, 2011 10:44 am

Insert Picture in SRichViewEdit

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

Post by Sergey Tkachenko »

To change width and height in code?
Thr33D
Posts: 9
Joined: Mon Apr 11, 2011 10:44 am

Post by Thr33D »

Yes, I would like to insert an image and in the same procedure I would change the size of the image.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

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