大概思路是需要你自己生成一个对象(比如继承自TCustomControl),解析信息,并将图形化到自己的Canvas上边,这就是一个元件组了.而里边具体的Node Line CIRCLES 就是基本的图元了。具体的概念不是很好说清楚,参考DevExpress里边的FlowControl(? 51delphi有下载好像是这个名字吧).简单的架构如下
TCustomShape = Class(TCustomControl)
private
procedure OnParaChange;
protected
procedure paint;
Function OnSelTest(Pos: TPoint): Integer;
//在进行选择时对每个附近的元件都需要进行判断,比较取出并选定最合适应该选择的元件
published
property Para: TStrings read GetPara write SetPara;
end;
procedure TCustomShape.OnParaChange
begin
ReParseSymbol; //解析基本元件 点,线,圆
ReCalcSize; //计算和设置Self的大小和Border
Inherited; //重画
end;
procedure Paint;
var
aInt: Integert;
begin
for aint:=0 to Length(SymArr)-1 do
begin
case SymArr[aInt].Type of
SymNode: DrawBigNode( SymArr[aInt]);
SymLine: Drawline(SymArr[aInt]);
..
end;
end;