TdxGPBrush.Texture Property
Specifies an image used as texture to fill the brush.
Declaration
property Texture: TdxGPImage read; write;
Property Value
Type |
---|
TdxGPImage |
Remarks
In addition to the solid and gradient fill modes, the brush allows you to fill a surface with a certain texture. The Texture property allows you to set an image as the texture source as well as its properties.
If the source image dimensions exceed the brush area size, the picture is cropped to fit in the brush’s bounds. Otherwise, the brush area is tiled with the source image:
Use the TdxSmartImage format for the texture source image. Refer to the code example below which illustrates how to fill a floating shape with the texture in the ExpressSpreadSheet control:
var
ATexture: TdxSmartImage;
AContainer: TdxSpreadSheetShapeContainer;
OpenDialog1: TOpenDialog;
//...
// Creating the source image object
ATexture := TdxSmartImage.Create;
// Invoking the dialog window to select a source image file
OpenDialog1.Execute(Handle);
// Loading the seleced source image file
ATexture.LoadFromFile(OpenDialog1.FileName);
// Switching the brush painting to the texture fill mode
AContainer.Shape.Brush.Style := gpbsTexture;
// Assigning the loaded file as a source of the texture for filling a shape
AContainer.Shape.Brush.Texture := ATexture;
// Freeing the used source image
ATexture.Free;
To customize the actual appearance of the texture on a surface painted by the brush, use the texture’s methods, such as Texture.Resize and Texture.Scale.
Note
The Texture property is in effect only if the Style property is set to gpbsTexture.