TX Text Control .NET for Windows Forms Documentation

ImageCollection.Add Method

Inserts a new image in a Text Control document. The first and second implementation inserts an image inline, which means that it is treated in the text like a single character. The third and fourth implementation inserts an image which is anchored to the specified text position. It has either an horizontal alignment or a location relative to the paragraph it is anchored to. These images are moved with the text. The fifth and sixth implementation inserts an image that has a fixed geometrical position in the document. This position is either specified through a page number and a location on this page or through a location relative to the complete document. The first implementation opens a file open dialog box to get the image's file name and filter. All other implementations open a file open dialog box only, if the Image.FileName and/or Image.FilterIndex property of the specified image are not initialized.

Syntax

[C#] public bool Add(); public bool Add(Image image, int textPosition); public bool Add(Image image, HorizontalAlignment alignment, int textPosition, ImageInsertionMode insertionMode); public bool Add(Image image, Point location, int textPosition, ImageInsertionMode insertionMode); public bool Add(Image image, int page, Point location, ImageInsertionMode insertionMode); public bool Add(Image image, Point location, ImageInsertionMode insertionMode);
[Visual Basic] Public Function Add() As Boolean Public Function Add(ByVal image As Image, ByVal textPosition As Integer) As Boolean Public Function Add(ByVal image As Image, ByVal alignment As HorizontalAlignment, ByVal textPosition As Integer, _ ByVal insertionMode As ImageInsertionMode) As Boolean Public Function Add(ByVal image As Image, ByVal location As Point, ByVal textPosition As Integer, _ ByVal insertionMode As ImageInsertionMode) As Boolean Public Function Add(ByVal image As Image, ByVal page As Integer, ByVal location As Point, _ ByVal insertionMode As ImageInsertionMode) As Boolean Public Function Add(ByVal image As Image, ByVal location As Point, _ ByVal insertionMode As ImageInsertionMode) As Boolean
ParameterDescription
image

Specifies the image to add.

textPosition

Specifies the text position at which the image is to be inserted. If -1 is specified, the image is inserted at the current input position.

alignment

Specifies the image's horizontal alignment. It can be one of the following values:


ValueMeaning
LeftThe image is left aligned, relative to the paragraph to which it is anchored.
RightThe image is right aligned, relative to the paragraph to which it is anchored.
CenteredThe image is centered, relative to the paragraph to which it is anchored.
JustifyThis value is not supported for images.
location

Specifies the location, in twips, at which the image is to be inserted. This is a location relative to the top left corner either of a page or of a paragraph.

insertionMode

Specifies how text flows around the newly inserted image. It can be one of the following values:


ValueMeaning
DisplaceCompleteLinesThe text stops at the top and continues at the bottom of the image.
DisplaceTextThe text flows around the image and empty areas at the left and right side are filled.
Other VauesAll other values cannot be used with the ImageCollection.Add method.
page

Specifies the number of a page beginning with 1 where the image is located.

Return Value

The return value is true, if the image could be added. Otherwise, it is false.

See Also

 
 
 

Products

Support

Downloads

Corporate

Buy Now