02]增加四种自定义图形
03]导出为jpg格式
04]导出为PNG格式,并轻度 汉化
通过百度网盘分享的文件:SimpleGragh-EditorV5.rar
链接:https://pan.baidu.com/s/1yBxJVwZx-pCXWAVdj7TanA
提取码:13f3
01]下载和安装
02]双击, 更改形状的 文本, 边框色,填充色
03]线里添加 转折点
04]双击 线 也可以在线上 添加文本
05]添加图片
06]可以改变图形的形状类型
07]可以导出为矢量图,或者 位图BMP
08]仅添加文本,可以当注释
09]添加自定义图形,倒三角,平行四边形,梯形
通过网盘分享的文件:simple-graph-tulater.rar
链接: https://pan.baidu.com/s/1YbAqcdJ-qJiQYtpVICWBNQ 提取码: auix
安装
将C:\Users\Administrator\Downloads\simple-graph-master\simple-graph-master\Source
加入到
第一步:点击“ File”-“ New ”菜单中的“ Package – Delphi for Win32”,新建一个控件包。 第二步:选中右边“ Project Manager ”中“ Contains ”文件夹,点击鼠标右键,在弹出的菜单中选择“ Add”。 第三步:在 Add 对话框中,点击“ Browse ”按钮,选择要安装的 PAS文件,然后点击“ OK ”按钮。 第四步:鼠标右击“ Project Manager ”中的“ Package1.bpl”,在弹出的菜单中选择“ Install”,这时就完在了控件的安装。
可以打开附带的Examples,看是否安装成功
C:\Users\Administrator\Downloads\simple-graph-master\simple-graph-master\Examples\ElasticNodes
1]先选中 该 线
2]右键,点击Add Point
3]同时,也可以 右键 删除该 转折点
01]添加一个图形
2]双击该图形
双击该图形,
拖一个矩形框,双击它
如果是直线多边形,只要在SimpleGraph.pas源代码里
从 TRhomboidalNode = class(TPolygonalNode)TPolygonalNode
类继承,再实现 自定义 结点DefineVertices
和 文本框的QueryMaxTextRect
四个结点 两个过程即可
参考
{ TRhomboidalNode 菱形 } TRhomboidalNode = class(TPolygonalNode) protected procedure QueryMaxTextRect(out Rect: TRect); override; procedure DefineVertices(const ARect: TRect; var Points: TPoints); override; end; { TRhomboidalNode } procedure TRhomboidalNode.QueryMaxTextRect(out Rect: TRect); { 菱形 } var R: TRect; begin with Rect do begin Left := (Vertices[0].X + Vertices[3].X) div 2; Top := (Vertices[0].Y + Vertices[3].Y) div 2; Right := (Vertices[1].X + Vertices[2].X) div 2; Bottom := (Vertices[1].Y + Vertices[2].Y) div 2; end; inherited QueryMaxTextRect(R); IntersectRect(Rect, R); end; procedure TRhomboidalNode.DefineVertices(const ARect: TRect; var Points: TPoints); begin SetLength(Points, 4); with ARect do begin with Points[0] do begin X := (Left + Right) div 2; Y := Top; end; with Points[1] do begin X := Right; Y := (Top + Bottom) div 2; end; with Points[2] do begin X := (Left + Right) div 2; Y := Bottom; end; with Points[3] do begin X := Left; Y := (Top + Bottom) div 2; end; end; end;
我的 自定义
{Parallelogram 平行四边形 涂磊} TParallelogram = class(TPolygonalNode) protected procedure QueryMaxTextRect(out Rect: TRect); override; procedure DefineVertices(const ARect: TRect; var Points: TPoints); override; end; { TParallelogram 平行四边形 涂磊} procedure TParallelogram.DefineVertices(const ARect: TRect; var Points: TPoints); //定义顶点 begin SetLength(Points, 4); with ARect do begin with Points[0] do //A begin X := left+ ( Right- left) div 4 ; Y := Top; end; with Points[1] do //B begin X := Right; Y := Top ; end; with Points[2] do //C begin X :=left+ ( Right- left)*3 div 4; Y := Bottom; end; with Points[3] do //D begin X := Left; Y := Bottom; end; end; end; { TParallelogram 平行四边形 涂磊} procedure TParallelogram.QueryMaxTextRect(out Rect: TRect); //定义文本 框 顶点 var R: TRect; begin with Rect do begin Left := Vertices[0].X ; Top := Vertices[0].Y ; Right := Vertices[2].X ; Bottom := Vertices[2].Y; end; inherited QueryMaxTextRect(R); IntersectRect(Rect, R); end;
procedure TMainForm.ToolButton43Click(Sender: TObject); begin SimpleGraph.DefaultNodeClass := TParallelogram; {Parallelogram 平行四边形 涂磊} SimpleGraph.CommandMode := cmInsertNode; end;
{ TDownTriNode 倒三角 涂磊 }
procedure TMainForm.ToolButton50Click(Sender: TObject); //倒三角 begin SimpleGraph.DefaultNodeClass := TDownTriNode; SimpleGraph.CommandMode := cmInsertNode; end; //========================================== {倒三角,涂磊加} TDownTriNode = class(TPolygonalNode) protected procedure QueryMaxTextRect(out Rect: TRect); override; procedure DefineVertices(const ARect: TRect; var Points: TPoints); override; end; //========================================== { TDownTriNode 倒三角 涂磊 } procedure TDownTriNode.DefineVertices(const ARect: TRect; var Points: TPoints); begin SetLength(Points, 3); with ARect do begin with Points[0] do begin X := left; Y := Top; end; with Points[1] do begin X := Right; Y := top; end; with Points[2] do begin X := (Left+right) div 2; Y := Bottom; end; end; end; procedure TDownTriNode.QueryMaxTextRect(out Rect: TRect);//文本框的 四个顶点的位置 var R: TRect; begin with Rect do begin Left := (Vertices[0].X + Vertices[2].X) div 2; Top := Vertices[0].Y; Right := (Vertices[1].X + Vertices[2].X) div 2; Bottom := (Vertices[0].Y + Vertices[2].Y) div 2; end; inherited QueryMaxTextRect(R); IntersectRect(Rect, R); end;
在 SimpleGraph.PAS底添加注册
TSimpleGraph.Register(TDownTriNode); {倒三角,涂磊加} TSimpleGraph.Register(TParallelogram); {Parallelogram 平行四边形 涂磊} finalization TSimpleGraph.Unregister(TDownTriNode); TSimpleGraph.Unregister(TParallelogram);
{Trapezoid 梯形 涂磊} TTrapezoid = class(TPolygonalNode) protected procedure QueryMaxTextRect(out Rect: TRect); override; procedure DefineVertices(const ARect: TRect; var Points: TPoints); override; end; //================================================ { TTrapezoid 梯形 涂磊} procedure TTrapezoid.DefineVertices(const ARect: TRect; var Points: TPoints); //定义顶点 begin SetLength(Points, 4); with ARect do begin with Points[0] do //A begin X := left+ ( Right- left) div 4 ; Y := Top; end; with Points[1] do //B begin X := left+ ( Right- left)*3 div 4 ; Y := Top ; end; with Points[2] do //C begin X := Right ; Y := Bottom; end; with Points[3] do //D begin X := Left; Y := Bottom; end; end; end; procedure TTrapezoid.QueryMaxTextRect(out Rect: TRect); //梯形 定义文本 框 顶点 var R: TRect; begin with Rect do begin Left := Vertices[0].X ; Top := Vertices[0].Y ; Right := Vertices[1].X ; Bottom := Vertices[2].Y; end; inherited QueryMaxTextRect(R); IntersectRect(Rect, R); end;