StickyShapes: Boolean;
StickyShapes: boolean;
The StickyShapes property determines whether objects can be connected by connecting points.
The property is developed to be used in regular report. The property value is not saved.
Available values:
True. Objects are connected with lines by connecting points. It enables moving shapes without lost of connection with connecting lines.
False. Objects are not connected with lines by connecting points.
Executing the example requires that repository contains regular report with the REPORT_STICKYSHAPES identifier containing only two shapes ion the active sheet.
Add links to the Andy, Drawing, Metabase, Report, Tab system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Report: IPrxReport;
Tab: ITabSheet;
Objects: ITabObjects;
Shape1, Shape2, Link: IWxShape;
WSP: IWxWorkspace;
PrxShape: IPrxShape;
Placement: IGxRectF;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get regular report
Report := mb.ItemById("REPORT_STICKYSHAPES").Edit As IPrxReport;
// Get report active sheet
Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
// Get collection of report objects
Objects := Tab.Objects;
// Get the first object
Shape1 := (Objects.Item(0) As IPrxShape) As IWxShape;
// Get workspace to which the object is belonging
WSP := Shape1.Workspace;
// Enable object fixation by connecting points
WSP.StickyShapes := True;
// Get the second object
Shape2 := (Objects.Item(1) As IPrxShape) As IWxShape;
// Create line
Placement := New GxRectF.Create(20, 20, 50, 50);
PrxShape := Objects.Add("PrxShape", Placement) As IPrxShape;
PrxShape.Type := PrxShapeType.StraightLink;
Link := PrxShape As IWxShape;
// Connect two objects using the line
WSP.GlueConnectionPoints(Shape1, 1, Link, 0);
WSP.GlueConnectionPoints(Shape2, 0, Link, 1);
// Save report
(Report As IMetabaseObject).Save;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Andy;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Report: IPrxReport;
Tab: ITabSheet;
Objects: ITabObjects;
Shape1, Shape2, Link: IWxShape;
WSP: IWxWorkspace;
PrxShape: IPrxShape;
Placement: GxRectFClass = New GxRectFClass.Create();
Begin
// Get current repository
mb := Params.Metabase;
// Get regular report
Report := mb.ItemById["REPORT_STICKYSHAPES"].Edit() As IPrxReport;
// Get report active sheet
Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
// Get collection of report objects
Objects := Tab.Objects;
// Get the first object
Shape1 := (Objects.Item[0] As IPrxShape) As IWxShape;
// Get workspace to which the object is belonging
WSP := Shape1.Workspace;
// Enable object fixation by connecting points
WSP.StickyShapes := True;
// Get the second object
Shape2 := (Objects.Item[1] As IPrxShape) As IWxShape;
// Create line
Placement.Create(20, 20, 50, 50);
PrxShape := Objects.Add("PrxShape", Placement) As IPrxShape;
PrxShape.Type := PrxShapeType.pstStraightLink;
Link := PrxShape As IWxShape;
// Connect two objects using the line
WSP.GlueConnectionPoints(Shape1, 1, Link, 0);
WSP.GlueConnectionPoints(Shape2, 0, Link, 1);
// Save report
(Report As IMetabaseObject).Save();
End Sub;
After executing the example two shapes are connected with connecting line by connecting points in regular report.
See also: