using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Runtime.CompilerServices;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
|
namespace HotelPms.Share.Windows.Component
|
{
|
/// <summary>
|
/// コントロールのプロパティの拡張
|
/// GC.Collect();の直後、ConditionalWeakTableより自動で消える
|
/// </summary>
|
public class ControlPropertyEx
|
{
|
public static ConditionalWeakTable<Control, ControlPropertyEx> Data { get; set; } = new ConditionalWeakTable<Control, ControlPropertyEx>();
|
|
/// <summary>
|
/// 追加プロパティ
|
/// </summary>
|
public Dictionary<string, object> Addition { get; set; } = new Dictionary<string, object>();
|
|
public override string ToString()
|
{
|
StringBuilder text = new StringBuilder();
|
foreach(KeyValuePair<string, object> item in Addition)
|
{
|
text.Append($"{item.Key}={item.Value};");
|
}
|
return text.ToString();
|
}
|
}
|
}
|