Skype:TextControlSupport
Orders:877-462-4772
TX Text Control - word processing components.
« »

Implementing a zoom-to-page view mode in .NET

Blogged by Björn Meyer on May 09, 2007 and tagged with Samples, .NET.

This week, I saw an interesting support request in the support department:

How to adjust the zoom factor of TX Text Control so that the page fits completely to the form?

It is very easy, if you know how to calculate the proper values:

private void resizeTX()
{
int bottomGap = 400;
int widthZoom = 100 * (this.Width) / (textControl1.PageSize.Width - textControl1.PageMargins.Left - textControl1.PageMargins.Right);
int heightZoom = 100 * (this.Height) / (textControl1.PageSize.Height - textControl1.PageMargins.Bottom - textControl1.PageMargins.Top + bottomGap);

if (widthZoom > 400) widthZoom = 400;
if (heightZoom > 400) heightZoom = 400;
if (widthZoom < 10) widthZoom = 10;
if (heightZoom < 10) heightZoom = 10;

if (widthZoom < heightZoom)
textControl1.ZoomFactor = widthZoom;
else
textControl1.ZoomFactor = heightZoom;
}

There are minimum and maximum values for TX Text Control's ZoomFactor property. Therefore, we have to check the calculated values for validity.

Our support engineers are awaiting your questions as well. We provide such code snippets tailored to your specific questions and problems. So, feel free to contact our support department to get help with TX Text Control.

« Prev:Show image anchor positions using GDI+
» Next:True WYSIWYG editing in the browser

Comments

If you would like to comment on this blog entry, please post a comment.

External verification page for ISO 9000:2000 certificate
ISO 9001:2000
certified