| Skype: | TextControlSupport | |
| Orders: | 877-462-4772 |

| 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 |
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.
Dim image As New TXTextControl.Image() Dim location As System.Drawing.Point location = TXTextControl1.InputPosition.Location image.FileName = "logo.jpg" image.Sizeable = True image.Moveable = True image.HorizontalScaling = 100 image.VerticalScaling = 100 image.SaveMode = TXTextControl.ImageSaveMode.SaveAsData 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.