Back to Devexpress

TcxCustomImageProperties.GraphicClass Property

vcl-cximage-dot-tcxcustomimageproperties-8e9ab9e4.md

latest2.9 KB
Original Source

TcxCustomImageProperties.GraphicClass Property

Specifies the active image container class.

Declaration

delphi
property GraphicClass: TGraphicClass read; write;

Property Value

TypeDescription
TGraphicClass

The reference to the active image container class.

|

Remarks

Assign a reference to a TGraphic class descendant to the GraphicClass property to use an instance of the corresponding class as the image container accessible through the image editor’s Picture property.

Tip

We recommend that you set the GraphicClass property to TdxSmartImage to ensure that the image editor supports the same image formats as all other DevExpress components.

Code Example: Bind TcxDBImage to Data

The following code example creates a BLOB field in a TdxMemData component and binds a TcxDBImage editor to the field:

delphi
uses
  dxGDIPlusClasses; // Declares the TdxSmartImage class
// ...
var
  AFieldDef: TFieldDef;
begin
  if dxMemData1.Active then
    dxMemData1.Close;
  AFieldDef := dxMemData1.FieldDefs.AddFieldDef;
  AFieldDef.Name := 'MyImageField';
  AFieldDef.DataType := ftBlob;
  AFieldDef.CreateField(dxMemData1);
  DataSource1.DataSet := dxMemData1;
  DataSource1.Enabled := True;
  cxDBImage1.DataBinding.DataSource := DataSource1;
  cxDBImage1.DataBinding.DataField := 'MyImageField';
  cxDBImage1.Properties.GraphicClass := TdxSmartImage; // Selects the universal container
  dxMemData1.Open;
end;
cpp
#include "dxGDIPlusClasses.hpp" // Declares the TdxSmartImage class
// ...
  TFieldDef *AFieldDef;
  // ...
  if(dxMemData1->Active) { dxMemData1->Close(); }
  AFieldDef = dxMemData1->FieldDefs->AddFieldDef();
  AFieldDef->Name = "MyImageField";
  AFieldDef->DataType = ftBlob;
  AFieldDef->CreateField(dxMemData1);
  DataSource1->DataSet = dxMemData1;
  DataSource1->Enabled = true;
  cxDBImage1->DataBinding->DataSource = DataSource1;
  cxDBImage1->DataBinding->DataField = "MyImageField";
  cxDBImage1->Properties->GraphicClass = __classid(TdxSmartImage); // Selects the universal container
  dxMemData1->Open();

See Also

RegisterGraphicClass Procedure

UnRegisterGraphicClass Procedure

TcxCustomImageProperties.GraphicClassName Property

TcxCustomImageProperties Class

TcxCustomImageProperties Members

cxImage Unit