Skype:TextControlSupport
Orders:877-462-4772
TX Text Control - word processing components.
What is this?Syndicate this content

Fixed images in TX Text Control .NET

This source code snippet requires TX Text Control .NET
Author:TX Text Control Support Department
Language:Visual Basic .NET
Version:1.0
Released:August 05, 2004
Last modified:January 11, 2008
Requirements:TX Text Control .NET with Visual Studio .NET 2002
Download code:imgcurpos.zip Download [26.01 KB, ZIP]

How to insert a fixed image at the current input position

In this sample, we are going to show you how to insert an image at the current input position. In a previous newsletter, we have shown you how to do this with the ActiveX version of TX Text Control. Now, we are going to show you how to achieve the same with TX Text Control .NET.

Using the .NET version, it is much easier to get the current input position. Consider the following three steps:

First of all, using the InputPosition.Location property, we can get the coordinates of the current cursor position.

Secondly, we have to specify the image properties before finally, we add the image to the specified location.

  1. Dim image As New TXTextControl.Image()
  2. Dim location As System.Drawing.Point
  3.  
  4. location = TXTextControl1.InputPosition.Location
  5.  
  6. image.FileName = "logo.jpg"
  7. image.Sizeable = True
  8. image.Moveable = True
  9. image.HorizontalScaling = 100
  10. image.VerticalScaling = 100
  11. image.SaveMode = TXTextControl.ImageSaveMode.SaveAsData
  12.  
  13. TextControl1.Images.Add(Image, location, TXTextControl.ImageInsertionMode.DisplaceText)

Please note that Visual Studio .NET 2002 or better and TX Text Control .NET are required for this sample application.

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