Create a NetLogic to modify the image
Prerequisites
Set the default external code editor. See Set the default code editor.
- To create the NetLogic to hide the image
- InProject view, right-clickMainWindow (type)and select .
- Double-click the NetLogic.The external code editor opens.
- Edit the NetLogic by replacing it with the following code. See Edit a NetLogic.#region Using directives using System; using UAManagedCore; using OpcUa = UAManagedCore.OpcUa; using FTOptix.HMIProject; using FTOptix.Retentivity; using FTOptix.UI; using FTOptix.NativeUI; using FTOptix.CoreBase; using FTOptix.Core; using FTOptix.NetLogic; #endregion public class RuntimeNetLogic1 : BaseNetLogic { public override void Start() { // Insert code to be executed when the user-defined logic starts } public override void Stop() { // Insert code to be executed when the user-defined logic is stopped } [ExportMethod] public void replaceSVG() { // LogicObject.Owner is the button, so LogicObject.Owner is the MainWindow AdvancedSVGImage svgImage = LogicObject.Owner.Get<AdvancedSVGImage>("AdvancedSVGImage1"); string myXML = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\r\n<svg version=\"1.1\" id=\"Overall\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xml:space=\"preserve\" viewBox=\"0 0 300 300\">\r\n <g id=\"Box1\">\r\n <polygon style=\"fill:#CB8252;\" points=\"25,270 75,270 75,220 25,220\" transform=\"rotate(0, 20, 20)\"/>\r\n </g>\r\n</svg>\r\n"; //Update the SVG svgImage.SetImageContent(myXML); } }
- Save the code.
Provide Feedback