Image Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WPF. SDK
- Assembly
TXTextControl.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WPF. SDK TXTextControl.from the setup.dll
- Inherits
- Frame
Base - Image
- Frame
Description
An instance of the Image class represents an image in a Text Control document. The TextControl class has several events that inform about different occurrences.
Syntax
public class Image : FrameBasePublic Class Image
Inherits FrameBaseExamples
The following example inserts a new image into the document, which will be treated as a character. The image's size will be reduced to 75% and it will not be sizeable:
TXTextControl.Image myImage = new TXTextControl.Image();
myImage.Sizeable = false;
myImage.HorizontalScaling = 75;
myImage.VerticalScaling = 75;
textControl1.Images.Add(myImage, -1);Dim MyImage As New TXTextControl.Image()
MyImage.Sizeable = False
MyImage.HorizontalScaling = 75
MyImage.VerticalScaling = 75
TextControl1.Images.Add(MyImage, -1)The following example inserts and configures a named, accessible company logo.
TXTextControl.Image image = new() { FileName = @"Images\company-logo.png", Name = "CompanyLogo" };
textControl.Images.Add(image, -1);
textControl.Save("report-with-logo.docx", StreamType.WordprocessingML);Dim image As New TXTextControl.Image() With { .FileName = "Images\company-logo.png", .Name = "CompanyLogo" }
textControl.Images.Add(image, -1)
textControl.Save("report-with-logo.docx", StreamType.WordprocessingML)Members
Constructors
| Constructor | Description |
|---|---|
| Image | Initializes a new instance of the Image class. |
Properties
| Property | Description |
|---|---|
| Alignment | Gets or sets the frame's horizontal alignment when it is anchored to a paragraph. (Inherited from FrameBase.) |
| Bounds | Gets the frame's bounding rectangle relative to the upper left corner of the document. (Inherited from FrameBase.) |
| DescriptiveText | Gets or sets a descriptive text for the frame. An empty string indicates that the frame has no such text. An empty string can also be used to delete a previously set text. (Inherited from FrameBase.) |
| ExportCompressionQuality | Sets a value between 1 and 100, which is the quality of a lossy data compression used if this image is saved. It is only used if the image data is compressed with a lossy compression algorithm. A value of 100 indicates the maximum quality, a value of 1 indicates the minimum quality. If this property is set to zero, which is the default value, Text Control uses the quality value set with the SaveSettings.ImageCompressionQuality property or a compression specific default value. |
| ExportFileName | Gets or sets the file name of an image used, if a Text Control document is saved. An empty string indicates that no export filename has currently be specified for the image. In this case either the original or a constructed filename is used. A filename is constructed in the following form: <document_filename>_<number>.<extension> |
| ExportFilterIndex | Gets or sets the format used if an image is saved. This is the number of the filter in the string returned through the ImageCollection.ExportFilters property, beginning with number one. If the ImageCollection.ExportFilters property is used to initialize the FileDialog.Filter property of a Framework dialog, the FileDialog.FilterIndex property can be used as value for this property. A value of zero indicates that no export format has currently be specified for the image. In this case the original format is used that can be obtained with the Image.FilterIndex property. The technical article Loading and Saving Images describes how images can be loaded and saved. |
| ExportMaxResolution | Gets or sets the maximum resolution in dots per inch used if this image is saved. If the image's resolution is larger than this property's value, it is reduced; otherwise, it is not changed. If this property's value is zero, which is the default value, Text Control uses the maximum resolution set with the SaveSettings.ImageMaxResolution property or the image's default resolution. |
| FileName | Gets or sets the corresponding file name and path from which an inserted image is loaded. |
| FilterIndex | Gets or sets the format used, if an image is inserted. This is the number of the filter in the string returned through the ImageCollection.ImportFilters property, beginning with number one. If the ImageCollection.ImportFilters property is used to initialize the FileDialog.Filter property of a Framework dialog, the FileDialog.FilterIndex property can be used as value for this property. The technical article Loading and Saving Images describes how images can be loaded and saved. |
| HorizontalScaling | Gets or sets an images's horizontal scaling factor in percent. |
| ID | Gets or sets an identifier for the frame. It must be a one-based value. A value of zero indicates that the image, text frame, chart, barcode or drawing has no identifier. Zero can also be used to delete a previously set identifier. (Inherited from FrameBase.) |
| InsertionMode | Gets or sets a value determining whether the frame is treated as a single character or the document's text either flows around or overwrites the frame. If the document's text flows around or overwrites the frame, this property also determines whether the image, text frame, chart, barcode or drawing is moved with the text or fixed positioned on a page. (Inherited from FrameBase.) |
| InsertionMode | (Only for compatibility) Gets or sets a value determining whether an image is treated as a single character or the document's text either flows around or overwrites the image. If the document's text flows around or overwrites the image, this property also determines whether the image is moved with the text or is fixed positioned on a page. |
| Location | Gets or sets, in twips, the frame's current location. If the image, text frame, chart, barcode or drawing is anchored to a paragraph, the location is relative to the paragraph. Otherwise, it is relative to the document. If the frame has a horizontal alignment or if it is inserted inline, this property returns zero. This property cannot be set for images, text frames, charts, barcodes or drawings which are inserted inline. (Inherited from FrameBase.) |
| Moveable | Determines whether a frame can be moved in the document at run time with the built-in mouse interface. (Inherited from FrameBase.) |
| Name | Gets or sets a name for the frame. An empty string indicates that the frame has no name. An empty string can also be used to delete a previously set name. (Inherited from FrameBase.) |
| SaveMode | Determines whether the image is stored through its data or through its file reference. By default an image is stored through a file reference if a file reference exists. Otherwise, if the image has been pasted from the clipboard, it is stored with its complete binary data. |
| Size | Gets or sets the frame's size in twips. For images this property is read only. (Inherited from FrameBase.) |
| Sizeable | Determines whether the frame can be resized at run time with the built-in mouse interface. (Inherited from FrameBase.) |
| TextDistances | Gets or sets the distances, in twips, between the frame and the document's text. The property's value is an array of four variables specifying the distances in the following order: left, top, right and bottom. If a value is set to -1, it is not changed. (Inherited from FrameBase.) |
| TextPosition | Read only. Gets the frame's character position in the document's text (one-based). (Inherited from FrameBase.) |
| VerticalScaling | Gets or sets an images's vertical scaling factor in percent. |
Methods
| Method | Description |
|---|---|
| ChangeZOrder | Changes the frame's z-order. (Inherited from FrameBase.) |