Class PictureObject
Represents a Picture object that can display pictures.
Implements
Inherited Members
Namespace: FastReport
Assembly: FastReport.dll
Syntax
public class PictureObject : PictureObjectBase, IDisposable, IFRSerializable
Remarks
The Picture object can display the following kind of pictures:
- picture that is embedded in the report file. Use the Image property to do this;
- picture that is stored in the database BLOb field. Use the
property to specify the name of data column you want to show; - picture that is stored in the local disk file. Use the
property to specify the name of the file; - picture that is stored in the Web. Use the
property to specify the picture's URL.
Use the
The TransparentColor property can be used to display an image with transparent background. Use the Transparency property if you want to display semi-transparent image.
Constructors
PictureObject()
Initializes a new instance of the PictureObject class with default settings.
Declaration
public PictureObject()
Properties
Grayscale
Gets or sets a value indicating that the image should be displayed in grayscale mode.
Declaration
public override bool Grayscale { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Overrides
GrayscaleHash
Gets or sets a hash of grayscale svg image
Declaration
[Browsable(false)]
public int GrayscaleHash { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Image
Gets or sets the image.
Declaration
public virtual Image Image { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Drawing.Image |
Remarks
By default, image that you assign to this property is never disposed - you should take care about it. If you want to dispose the image when this PictureObject is disposed, set the ShouldDisposeImage property to true right after you assign an image:
myPictureObject.Image = new Bitmap("file.bmp");
myPictureObject.ShouldDisposeImage = true;
ImageFormat
Gets or sets the extension of image.
Declaration
public virtual ImageFormat ImageFormat { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Drawing.Imaging.ImageFormat |
ImageHeight
Return base size of image, internal use only
Declaration
[Browsable(false)]
protected override float ImageHeight { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Overrides
ImageWidth
Return base size of image, internal use only
Declaration
[Browsable(false)]
protected override float ImageWidth { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Overrides
ShouldDisposeImage
Gets or sets a value indicating that the image stored in the Image property should be disposed when this object is disposed.
Declaration
[Browsable(false)]
public bool ShouldDisposeImage { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
By default, image assigned to the Image property is never disposed - you should take care about it. If you want to dispose the image when this PictureObject is disposed, set this property to true right after you assign an image to the Image property.
Tile
Gets or sets a value indicating that the image should be tiled.
Declaration
public bool Tile { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Transparency
Gets or sets the transparency of the PictureObject.
Declaration
public float Transparency { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Remarks
Valid range of values is 0..1. Default value is 0.
TransparentColor
Gets or sets the color of the image that will be treated as transparent.
Declaration
public Color TransparentColor { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Drawing.Color |
TransparentImage
Gets or sets a bitmap transparent image
Declaration
[Browsable(false)]
public Bitmap TransparentImage { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Drawing.Bitmap |
Methods
Assign(Base)
Copies the contents of another, similar object.
Declaration
public override void Assign(Base source)
Parameters
| Type | Name | Description |
|---|---|---|
| Base | source | Source object to copy the contents from. |
Overrides
Remarks
Call Assign to copy the properties from another object of the same type. The standard form of a call to Assign is
destination.Assign(source);
which tells the destination object to copy the contents of the source object to itself. In this method, all child objects are ignored. If you want to copy child objects, use the AssignAll method.
See Also
Deserialize(FRReader)
Declaration
public override void Deserialize(FRReader reader)
Parameters
| Type | Name | Description |
|---|---|---|
| FRReader | reader |
Overrides
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
Overrides
DisposeImage()
Disposes image
Declaration
public void DisposeImage()
DrawImage(FRPaintEventArgs)
Draws the image.
Declaration
public override void DrawImage(FRPaintEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| FRPaintEventArgs | e | Paint event args. |
Overrides
DrawImageInternal2(IGraphics, PointF, PointF, PointF)
Declaration
protected override void DrawImageInternal2(IGraphics graphics, PointF upperLeft, PointF upperRight, PointF lowerLeft)
Parameters
| Type | Name | Description |
|---|---|---|
| FastReport.IGraphics | graphics | |
| System.Drawing.PointF | upperLeft | |
| System.Drawing.PointF | upperRight | |
| System.Drawing.PointF | lowerLeft |
Overrides
EstablishImageForm(GraphicsPath, Single, Single, Single, Single)
The shape of the image is set using GraphicsPath
Declaration
public void EstablishImageForm(GraphicsPath path, float drawLeft, float drawTop, float drawWidth, float drawHeight)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Drawing2D.GraphicsPath | path | |
| System.Single | drawLeft | |
| System.Single | drawTop | |
| System.Single | drawWidth | |
| System.Single | drawHeight |
FinalizeComponent()
Performs a finalization after the report is finished.
Declaration
public override void FinalizeComponent()
Overrides
Remarks
This method is used by the report engine, do not call it directly.
ForceLoadImage()
Forces loading the image from a data column.
Declaration
public void ForceLoadImage()
Remarks
Call this method in the AfterData event handler to force loading an image into the Image property. Normally, the image is stored internally as byte[] array and never loaded into the Image property, to save the time. The side effect is that you can't analyze the image properties such as width and height. If you need this, call this method before you access the Image property. Note that this will significantly slow down the report.
GetData()
Gets the data from a datasource that the object is connected to.
Declaration
public override void GetData()
Overrides
Remarks
This method is called by the report engine before processing the object.
Do not call it directly. You may override it if you are developing a new FastReport component. In this method you should get the data from a datasource that the object is connected to.
GetDataAsync(CancellationToken)
Declaration
public override async Task GetDataAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
Overrides
InitializeComponent()
Initializes the object before running a report.
Declaration
public override void InitializeComponent()
Overrides
Remarks
This method is used by the report engine, do not call it directly.
LoadImage()
Loads image
Declaration
public override void LoadImage()
Overrides
LoadImageAsync(CancellationToken)
Declaration
public override async Task LoadImageAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task |
Overrides
ResetImageIndex()
Declaration
protected override void ResetImageIndex()
Overrides
Serialize(FRWriter)
Declaration
public override void Serialize(FRWriter writer)
Parameters
| Type | Name | Description |
|---|---|---|
| FRWriter | writer |
Overrides
SetImageData(Byte[])
Sets image data to FImageData
Declaration
public void SetImageData(byte[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | data |