Replace(Shape: IWxShape; ToWxFigureType: WxFigureType): IWxShape;
Replace(Shape: Prognoz.Platform.Interop.Andy.IWxShape; ToWxFigureType: Prognoz.Platform.Interop.Andy.WxFigureType): Prognoz.Platform.Interop.Andy.IWxShape;
Shape. The shape, which type must be replaced.
ToWxFigureType. The required shape type.
The Replace method changes type of the shape on the workspace to the specified one.
To get collection of workspace shapes, use the IWxWorkspace.Shapes property.
Executing the example requires that the repository contains a workspace with the WSP identifier that contains several shapes.
Add links to the Andy, Metabase system assemblies.
Sub Userproc;
Var
mb: IMetabase;
Wsp: IWxWorkspace;
Shape: IWxShape;
Begin
// Get workspace
mb := MetabaseClass.Active;
wsp := mb.ItemById("WSP").Edit As IWxWorkspace;
// Get the first shape on workspace
Shape := Wsp.Shapes.Item(0);
// Change shape type
Wsp.Replace(Shape, WxFigureType.Ellipse);
// Save changes
(Wsp As IMetabaseObject).Save;
End Sub Userproc;
Imports Prognoz.Platform.Interop.Andy;
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Wsp: IWxWorkspace;
Shape: IWxShape;
Begin
// Get workspace
mb := Params.Metabase;
wsp := mb.ItemById["WSP"].Edit() As IWxWorkspace;
// Get the first shape on workspace
Shape := Wsp.Shapes.Item[0];
// Change shape type
Wsp.Replace(Shape, WxFigureType.wftEllipse);
// Save changes
(Wsp As IMetabaseObject).Save();
End Sub;
After executing the example the first workspace shape type is changed.
See also: