Public Shared Sub Main(Params: StartParams); Var MB: IMetabase; ws: IWxWorkspace; Rect: IWxRectangle; Ellipse: IWxEllipse; Style: IWxStyle; Link: IWxLink; vGxColor: GxColorClass_2 = New GxColorClass_2(); GxColorCls: GxColorClass = New GxColorClassClass(); OutPoint: GxPointF = New GxPointFClass(); Begin Mb := Params.Metabase; ws := Mb.ItemById["WSP"].Edit() As IWxWorkspace; ws.BeginUpdate(); // Create a rectangle Rect := ws.CreateRectangle(); OutPoint.Create(20, 10); Rect.PinPosition := OutPoint; Rect.Text := "Rectangle"; Style := ws.CreateStyle(); Style.Id := "MyStyle"; vGxColor.CreateRGB(153, 204, 255); Style.BackgroundBrushForeColor := vGxColor; Style.BackgroundBrushForeTransparent := 10; Style.ShadowBrushForeColor := GxColorCls.FromName("White"); vGxColor.CreateRGB(204, 153, 255); Style.ShadowBrushBackColor := vGxColor; Style.ShadowBrushPattern := GxBrushPattern.wbpGradient; Style.TextFontSize := 9; Style.TextFontBrushColor := GxColorCls.FromName("Blue"); Rect.Style := Style; // Create an ellipse Ellipse := ws.CreateEllipse(); OutPoint.Create(80, 60); Ellipse.PinPosition := OutPoint; Ellipse.Text := "Ellipse"; Ellipse.Style := ws.Styles.FindById("MyStyle"); // Create a link between objects Link := ws.CreateLink(); Link.Text := "Link"; Link.TextVertOffset := -10; Style := ws.CreateStyle(); Style.LinePenBeginWxCap := WxLineCap.wlcArrowRoundedFilled; vGxColor.CreateRGB(128, 0, 255); Style.LinePenColor := vGxColor; Style.LinePenWidth := 0.5; Link.Style := Style; ws.GlueConnectionPoints(Rect, 3, Link, 0); ws.GlueConnectionPoints(Ellipse, 0, Link, 1); ws.EndUpdate(); (ws As IMetabaseObject).Save(); End Sub;
After executing the example a rectangle, an ellipse and a link between them are created in a workspace, and the specified style is applied for each of these objects: