Page 1 of 1
Prevent Image Resizing On Insert
Posted: Tue Sep 09, 2008 11:21 pm
by fchintc
When I insert a picture (JPG or PNG) from file, the image container resizes to match the picture size.
Is it possible to force the image container to remain at a certain size and not resize?
Frederick
Posted: Wed Sep 10, 2008 6:11 am
by Sergey Tkachenko
Inserting picture with resizing it to 100x100:
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);
rve.SetCurrentItemExtraIntProperty(rvepResizable, 0, True);
end;
rve.TopLevelEditor.SetUndoGroupMode(False);
Instead of forbidding resizing for the given picture (using rvepResizable), you can forbid resizing for all pictures, by including rvoNoImageResize in rve.EditorOptions.
Posted: Wed Sep 10, 2008 3:01 pm
by fchintc
Thank you for the code.
Is it possible to set the inserted picture to be of a certain width and height but still allow the user to resize it themselves? The idea is that if the user imports a large image accidentally, the image will not be out of range for them to resize.
Frederick
Posted: Thu Sep 11, 2008 10:50 am
by Sergey Tkachenko
Remove the line
Code: Select all
rve.SetCurrentItemExtraIntProperty(rvepResizable, 0, True);
and the user will be able to resize this picture (if rvoNoImageResize is not in rve.EditorOptions)
Posted: Thu Sep 11, 2008 2:28 pm
by fchintc
Thanks for the code and help.
Frederick