vcl-cximage-dot-tcxcustomimageproperties-8e9ab9e4.md
Specifies the active image container class.
property GraphicClass: TGraphicClass read; write;
| Type | Description |
|---|---|
| TGraphicClass |
The reference to the active image container class.
|
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.
The following code example creates a BLOB field in a TdxMemData component and binds a TcxDBImage editor to the field:
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;
#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