My Example of C++Builder6 Here:
I hope Helpful to others.
// Object Declare
IBoxItemPtr box1, box2;
IArrowItemPtr arr1, arr2;
box1=FCX->CreateBox(100, 100, 10, 10);
box2=FCX->CreateBox(200, 200, 10, 10);
arr1=FCX->CreateArrow(box1, box2);
// GDI Plus
FCX->Graphics->StartUp(geGdiPlus);
// Initialize
FCX->BoxFrameColor=clBlack;
FCX->ArrowColor=clBlack;
FCX->MeasureUnit=uPixel;
// Box Decoration
box1->Style=1; // ellipse
box1->set_PenWidth(2);
box1->set_FillColor(clYellow);
box1->set_FrameColor(clBlue);
// Arrow Decoration & Event Handlig
void __fastcall TForm1::FCXArrowSelected(TObject *Sender, IArrowItem *arrow)
{
arrow->Color=clRed;
arrow->PenWidth=1;
arrow->PenStyle=3;
arrow->ArrowHead=ahTriangle;
arrow->ArrowBase=ahTriangle;
}
// Text Attach to Box
void __fastcall TForm1::FormCreate(TObject *Sender)
{
IBoxItemPtr aa, bb;
WideString ss;
aa=FCX->CreateBox(200,200, 10, 10);
aa->Tag=365;
ss=IntToStr(aa->Tag);
bb=FCX->CreateBox(aa->left, aa->top, 60, 30);
bb->set_Text(ss);
bb->Transparent=true;
bb->Locked=true;
bb->IgnoreLayout=true;
FCX->CreateGroup(aa)->AttachToCorner(bb, 0);
}
// Multiple Box
IBoxesPtr boxes;
boxes = FCX->SelectedBoxes;
for(int i=0;i<boxes->get_count();i++)
{
box1 = boxes->get_Item(i);
box1->set_PenWidth(3);
box1->set_FillColor(0xFF00FF);
box1->set_FrameColor(0xFF0000);
}
C++Builder has the same VCL architecture of delphi.
So, FCX Usage of C++Builder is almost same as delphi's one !