Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxGPBrush.Texture Property

Specifies an image used as texture to fill the brush.

#Declaration

Delphi
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.

See Also