是否有可能获得第二个标签(或我可以分配用户定义的 int/string/float 的其他标签)?
原因是,我已经使用了 ButtonX.Tag,拥有第二个标签或其他东西比将第二个 int 放入数组或其他东西要容易得多...
提前致谢。
请您参考如下方法:
最好创建自己的类并将其对象附加到按钮标签。
class ButtonProperty
{
public int ID { get; set; }
public string MyProperty { get; set; }
}
然后你可以像这样使用它:
ButtonProperty buttonPropertyObj = new ButtonProperty () { ID = 1, MyProperty ="Some property"};
btn1.Tag = buttonPropertyObj;
