12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using System;
- using System.Drawing;
- namespace InABox.Core
- {
- public class DFLayoutLabel : DFLayoutControl
- {
- [EditorSequence(0)]
- [MemoEditor]
- public string Caption { get; set; }
- [EditorSequence("Style", 0)]
- public DFLayoutTextStyle Style { get; set; }
- protected override void Init()
- {
- base.Init();
- Caption = "";
- Style = new DFLayoutTextStyle();
- }
- protected override string GetDescription()
- {
- return Caption;
- }
- protected override void LoadProperties()
- {
- base.LoadProperties();
- Caption = GetProperty("Caption", "");
- Style = Serialization.Deserialize<DFLayoutTextStyle>(GetProperty<string?>("Style", null)) ?? new DFLayoutTextStyle();
- }
- protected override void SaveProperties()
- {
- base.SaveProperties();
- SetProperty("Caption", Caption);
- SetProperty("Style", Serialization.Serialize(Style));
- }
- public T GetStyleProperty<T>(string name, T defaultValue)
- {
- return GetProperty($"Style.{name}", defaultValue);
- }
- public void SetStyleProperty(string name, object? value)
- {
- SetProperty($"Style.{name}", value);
- }
- }
- }
|