This is a migrated thread and some comments may be shown as answers.

Question about page margins

3 Answers 74 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Aaron
Top achievements
Rank 1
Aaron asked on 09 May 2013, 10:38 PM
Hi, I'm a demo user..

Two questions...

#1: Can the red area in my picture (which I'm attaching) be adjusted / removed? It's wasted margin space and I can't figure out how to reduce it or get any access to it at all for that matter.

#2: Can the zoom be centered on where the user is actually looking, instead of always moving south when you zoom out, and always moving north when you zoom in?

See attached pic, thanks!

3 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 10 May 2013, 12:39 PM
Hello Aaron,

Thank you for contacting us!

Regarding your comment that you'd like to put a RadPdfViewer next to the RadRichTextBox in your project and integrate them, I suggest you take a look at this demo (if you haven't seen it already) that shows the exact approach in which this can be achieved.

As for your questions - unfortunately, the margins you painted red in the attached picture cannot be easily removed. Regarding the small space on top and on the left of the ruler, you can try changing that space by modifying the template of the DocumentRuler. As for the space between the ruler and the page, unfortunately it is not possible to modify it.

To shed some light on this, the space is actually dynamically changed which you can verify by resizing the browser window in which you've placed RadRichTextBox. Generally, the only option in this regard would be to change the layout mode of the editor, for example to Flow and no margins will be visible.

As for your concerns about zooming - it is not possible to change the place to which the zoom in/out centers. I logged this for further revision and we might reconsider the current behavior in the future, so that zoom in/out will follow the caret position or the last viewport. However, the task is with low priority and I cannot tell if and when such change might be implemented.

I am sorry for any inconvenience these issues might be causing you! Let us know if you have other comments or questions.

Regards,
Petya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Aaron
Top achievements
Rank 1
answered on 10 May 2013, 02:09 PM
Thank you for the reply. Is it possible to adjust the scroll position of the view via code? And is there a zoom event I can work with? I might be able to rig it with my own zoom-centering code if I am able to move / scroll the view by code and capture the zoom event. Let me know, thanks!
0
Petya
Telerik team
answered on 13 May 2013, 03:55 PM
Hello Aaron,

When zooming in/out the ScaleFactorChanged event of RadRichTextBox occurs. You can scroll to a particular offset using the ScrollToVerticalOffset() method of RadRichTextBox, for example this is how you scroll to the caret location when the scale factor is 1:
double position = this.editor.Document.CaretPosition.Location.Y;
this.editor.ScrollToVerticalOffset(position);
 
Note that the ScaleFactor property if RadRichTextBox is of type Size, i.e. in order to zoom in to 300% from code, you'd have to do the following:
this.editor.ScaleFactor = new Size(3, 3);

I hope this helps! Let us know if you have other questions.

All the best,
Petya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Aaron
Top achievements
Rank 1
Answers by
Petya
Telerik team
Aaron
Top achievements
Rank 1
Share this question
or