Back to Devexpress

TdxCustomFlowChart.CreateObject(Integer,Integer,Integer,Integer,TdxFlowChartObjectAdvancedShape) Method

vcl-dxflchrt-dot-tdxcustomflowchart-dot-createobject-x28-system-dot-integer-system-dot-integer-system-dot-integer-system-dot-integer-dxflowchartshapes-dot-tdxflowchartobjectadvancedshape-x29.md

latest4.7 KB
Original Source

TdxCustomFlowChart.CreateObject(Integer,Integer,Integer,Integer,TdxFlowChartObjectAdvancedShape) Method

Creates an advanced chart symbol in the control.

Declaration

delphi
function CreateObject(L: Integer; T: Integer; W: Integer; H: Integer; AAdvancedShape: TdxFlowChartObjectAdvancedShape): TdxFcObject; overload;

Parameters

NameTypeDescription
LInteger

A distance between the client area’s left border and the created chart symbol’s bounding rectangle, in pixels.

| | T | Integer |

A distance between the client area’s top border and the created chart symbol’s bounding rectangle, in pixels.

| | W | Integer |

The width (in pixels) of the created chart symbol.

| | H | Integer |

The height (in pixels) of the created chart symbol.

| | AAdvancedShape | TdxFlowChartObjectAdvancedShape |

An advanced shape from the control’s repository.

|

Returns

TypeDescription
TdxFcObject

A chart symbol.

|

Remarks

Call this function to place an advanced chart symbol at the specified point within the control’s area.

The code example below shows how to create and customize an advanced shape:

delphi
uses
// Contains the TdxFlowChartObjectAdvancedShape class declaration
  ..., dxFlowChartShapes;
var
  AObj: TdxFcObject;
  // Declared at the dxFlowChartShapes unit;
  AAdvancedShape: TdxFlowChartObjectAdvancedShape
begin
  // Assigns the "Off Page Reference" shape from the advanced shape repository to the AAdvancedShape variable
  AAdvancedShape := dxFlowChart1.Repository.BasicFlowchartShapes.OffPageReference;
  // Adds the advanced shape with predefined dimensions to the specified position
  AObj := dxFlowChart1.CreateObject(10, 10, 200, 100, AAdvancedShape);
  // Fills the shape's background with the silver color
  AObj.BkColor := clSilver;
  // Fills the shape's background with the gray color
  AObj.ShapeColor := clGray;
  // Sets text to display within the shape
  AObj.Text := 'Document';
  // Centers text horizontally within the shape
  AObj.HorzTextPos := fchpCenter;
  // Centers text vertically within the shape
  AObj.VertTextPos := fcvpCenter;
  // Rotates the shape clockwise by 45 degrees
  AObj.Angle := 45; 
end;
cpp
// Contains the TdxFlowChartObjectAdvancedShape class declaration
#pragma link "dxFlowChartShapes"
{
  // Assigns the "Off Page Reference" shape from the advanced shape repository to the AAdvancedShape variable
  TdxFlowChartObjectAdvancedShape *AAdvancedShape = dxFlowChart1->Repository->BasicFlowchartShapes->OffPageReference;
  // Adds the advanced shape with predefined dimensions to the specified position
  TdxFcObject *AObj = dxFlowChart1->CreateObject(10, 10, 200, 100, AAdvancedShape);
  // Fills the shape's background with the silver color
  AObj->BkColor = clSilver;
  // Fills the shape's background with the gray color
  AObj->ShapeColor = clGray;
  // Sets text to display within the shape
  AObj->Text = "Document";
  // Centers text horizontally within the shape
  AObj->HorzTextPos = fchpCenter;
  // Centers text vertically within the shape
  AObj->VertTextPos = fcvpCenter;
  // Rotates the shape clockwise by 45 degrees
  AObj->Angle = 45;
}

You can call the CreateObject(Integer,Integer,Integer,Integer,TdxFcShapeType) function to create a shape from a predefined set. Note that this set has a limited number of shapes compared to the repository.

See Also

CreateConnection

TdxFcObject.Create

Code Example: Create Chart Symbols and Connections at Runtime

TdxCustomFlowChart Class

TdxCustomFlowChart Members

dxflchrt Unit