Créer un NetLogic pour modifier l’image
Conditions préalables
Définissez l’éditeur de code externe par défaut. Consultez la rubrique Définir l'éditeur de code par défaut.
- Pour créer le NetLogic pour masquer l’image
- DansVue de projet, cliquez avec le bouton droit de la souris surMainWindow (type)et sélectionnez .
- Double-cliquez sur NetLogic.L'éditeur de code externe s'ouvre.
- Modifiez le NetLogic en le remplaçant par le code suivant. Consultez la rubrique Modifier un 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); } }
- Enregistrez le code.
Fournir une réponse