Hi,
Is there a way to insert a picture into a TRichView giving it a specific size, independently of the pixels in the image file itself? - like in HTML, when a width and heigth are specified.
Thanks in advance.
Adding a picture with specific size (like HTML)
-
- Posts: 7
- Joined: Mon Sep 12, 2005 3:41 am
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Document generation:
Inserting picture:
This example is simple, but not very good, because user can update all these 3 operations (inserting, changing height, changing width) in 3 steps, calling Undo 3 times.
The code below solves this problem:
Another example - document generation:
Code: Select all
rv.Clear;
..
rv.AddPictureEx(...);
rv.SetItemExtraIntProperty(rv.ItemCount-1, rvepImageHeight, 100);
rv.SetItemExtraIntProperty(rv.ItemCount-1, rvepImageWidth, 100);
...
rv.Format;
Code: Select all
if rve.InsertPicture(...) then begin
rve.SetCurrentItemExtraIntProperty(rvepImageHeight, 100, True);
rve.SetCurrentItemExtraIntProperty(rvepImageWidth, 100, True);
end;
The code below solves this problem:
Code: Select all
rve.TopLevelEditor.BeginUndoGroup(rvutInsert);
rve.TopLevelEditor.SetUndoGroupMode(True);
if rve.InsertPicture(...) then begin
rve.SetCurrentItemExtraIntProperty(rvepImageHeight, 100, True);
rve.SetCurrentItemExtraIntProperty(rvepImageWidth, 100, True);
end;
rve.TopLevelEditor.SetUndoGroupMode(False);
Another example - document generation: