FillColor screen element

FillColor screen element

Hi, I made some code:

C# Code:

using Scada.AddIn.Contracts;
using Scada.AddIn.Contracts.ScreenElement;
using Scada.AddIn.Contracts.Screen;
using System;

namespace wizardHighlightSelectedRow
{
///
/// Highlights Selected element on the screen
///
[AddInExtension("wizardHighlightSelectedRow", "Your Project Wizard Extension Description")]
public class wizardHighlightSelectedRow : IProjectWizardExtension
{
#region IProjectWizardExtension implementation

public void Run(IProject context, IBehavior behavior)
{

IScreenCollection screens = context.ScreenCollection;
string selectedScreenName = null;
IScreenElementCollection controlElements = null;

foreach (var item in screens)
{
if(item.Name == "Main")
controlElements = item.ScreenElementCollection;
}

foreach (var item in controlElements)

if (item.Name == "Button_2")
{
item.SetDynamicProperty("FillColor", 0xE74C3C);
item.Update();
item.FillColor = 0x99CA3C;
item.Update();
}
else if (item.Name == "Dynamic text_3") {
item.SetDynamicProperty("FillColor", 0xE74C3C);
item.Update();
item.FillColor = 0x99CA3C;
item.Update();
}
else if (item.Name == "Button_9_1_1_5") {
item.SetDynamicProperty("FillColor", 0xE74C3C);
item.Update();
item.FillColor = 0x99CA3C;
item.Update();
}
else if (item.Name == "Element group_1") {
item.SetDynamicProperty("FillColor", 0xE74C3C);
item.Update();
item.FillColor = 0x99CA3C;
item.Update();
}
else if (item.Name == "Dynamic text_1") {
item.SetDynamicProperty("FillColor", 0xE74C3C);
item.Update();
item.FillColor = 0x99CA3C;
item.Update();
}
}
}
#endregion
}


1. And, what method to initialize collor is more correct? This one item.SetDynamicProperty("FillColor", 0xE74C3C); is not working. I suppose, propertyPath is not correct.
2. Can I hold color filled, till variable will hold value X? Cos, when I navigate to other project, and then return to FillColor screen, then element of that screen wil have default color, not that one what I set. I suppose it will be the same when I will navigate to other screen in same project.
3. How to get the same color as in the pallet at https://htmlcolorcodes.com/ in uint (FillColor type). Cos when I use hex as variable, it fill element by different colour. For example, 0x99CA3C is not the same as I have in default pallet in Zenon Superviser etc.




This is a migrated post! Originally posted on 03.11.2021 by user Oleksandr. Please be aware that information can be outdated.