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

Resize images to fit into page

Blogged by Björn Meyer on May 08, 2008 and tagged with .NET, Samples, Images.

I just got the requirement that pasted screenshots should be resized to fit into the current page. The best and easiest way to realize that is to trap the ImageCreated event. This event returns the image that just has been created.

All we need to do, is to calculate the ratio to resize the image. Therefore, the page width of the current section excluding the page margins must be devided by the width of the image. This factor can be used to scale the image afterwards. The following code shows this ImageCreated event:

private void textControl1_ImageCreated(object sender, TXTextControl.ImageEventArgs e)
{
	// get screen resolution to convert twips to pixel
	int iTwipsPerPixel = (int)(1440 / textControl1.CreateGraphics().DpiX);

	if (((float)(e.Image.Size.Width / iTwipsPerPixel)) >= (textControl1.Sections.GetItem().Format.PageSize.Width - textControl1.Sections.GetItem().Format.PageMargins.Left - textControl1.Sections.GetItem().Format.PageMargins.Right))
	{
		// resize the image
		float fScaleFactor = ((textControl1.Sections.GetItem().Format.PageSize.Width - textControl1.Sections.GetItem().Format.PageMargins.Left - textControl1.Sections.GetItem().Format.PageMargins.Right) / ((float)(e.Image.Size.Width / iTwipsPerPixel))) * 100;
		e.Image.VerticalScaling = Convert.ToInt32(fScaleFactor);
		e.Image.HorizontalScaling = Convert.ToInt32(fScaleFactor);
	}
}

In the following screen-video you can see the sample in action. Feel free to contact me, if you have any questions about this solution.

The TX Text Control video content presented here requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

BrowserTextControl: Using post-build events in Visual Studio

Blogged by Björn Meyer on May 07, 2008 and tagged with Visual Studio, Samples, BrowserTextControl.

When developing with TX Text Control .NET Server and it's BrowserTextControl class, you might have learned that you need to clear the .NET download cache (dl3) everytime you create a new version of the wrapping user control. Otherwise, Internet Explorer won't download the user control again due to the fact that the codebase has been modified.

This only happens on the development machine. In production, if the server provides a new version of the user control, Internet Explorer downloads this new version in order to install it in the .NET download cache.

To avoid cleaning the download cache manually using the Visual Studio command line, you can add this command to the post-build events of Visual Studio.

  1. Open your website's properties using the main menu Project entry.
  2. On the third tab, add the following command to the Post-build event comment line:

  3. "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /cdl

TX Text Control Blog is now integrated into the main web site

Blogged by Jonathan Maron on April 29, 2008 and tagged with Web Site, Blog.

The content from the TX Text Control Blog has been migrated to the main TX Text Control web site.

In the past eleven years, the TX Text Control Blog has become the central information organ in the TX Text Control community, dissipating technical information about TX Text Control, detailed sample applications, as well as the latest tips and tricks with TX Text Control.

Previously, the TX Text Control Blog had a number of categories. These categories have been replaced by tags, an overview of which can be seen in the tagcloud and below.

All the links from the old blog are still valid, as they are automatically redirected to the new integrated blog.

Please do not hesitate to contact us, about the new blog and/or for any matter relating to TX Text Control.

New video tutorial: Building an ASP.NET word processor

Blogged by Björn Meyer on April 22, 2008 and tagged with Video Tutorial, Documentation, BrowserTextControl.

This video tutorial shows in very easy steps how to build an ASP.NET web site project using TX Text Control .NET Server.

Such solutions consist of an ASP.NET web site project and the client-side user control that encapsulates the BrowserTextControl class. I plan to show you a lot of other tricks and applications using this video approach in the future. Feel free to share your thoughts on this idea.

The TX Text Control video content presented here requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

Refurbished documentation comes with SP1

Blogged by Björn Meyer on April 17, 2008 and tagged with Service Pack, Documentation.

Yesterday, we released SP1 for TX Text Control .NET 14.0. If you have not already downloaded a copy of the latest version, please do so here:

http://www.textcontrol.com/downloads/sps/

Aside from fixes for the known issues, TX Text Control .NET 14.0 SP1 comes with an improved version of the documentation. We have updated the most chapters in order to improve the general structure of the documentation.

The main improvement was done in the class library reference of the documentation. The syntax of each property, method and event is now available in both supported languages C# and VB.NET. Additionally, we have added sample code to the commonly used classes of TX Text Control .NET. See yourself by browsing the documentation online on our website:

Class Library Reference

We have created a new overview of the complete classes hierarchy:

Class Hierarchy

The graphical overview of all classes is improved as well to give you a quick overview of the powerful TX Text Control .NET functionality:

Graphical Overview

Feel free to contact me, if you have additional suggestions or questions about our documentation, the service pack or TX Text Control at total.

Archive

top

Top 10 Bestselling Product Award 2007Top 25 Publisher Product Award 2007Top 10 Bestselling Product Award 2007 in JapanTop 25 Bestselling Product Award 2006Top 25 Bestselling Publisher Award 2006Reader's Choice Award, dot.net magazin, 3rd place