110,536
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Drawing.Design;
using System.Windows.Forms;
namespace ExtenderApp
{
[ProvideProperty("TT", typeof(Control))]
class testTT : Component, IExtenderProvider
{
private Dictionary<Control, string> m_valueList;
public testTT()
{
m_valueList = new Dictionary<Control, string>();
}
public bool CanExtend(object target)
{
return ((target is Control) && !(target is testTT));
}
[DefaultValue(""), Localizable(true), Editor("System.ComponentModel.Design.MultilineStringEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
public string GetTT(Control control)
{
if (control == null)
{
return string.Empty;
}
if (this.m_valueList.ContainsKey(control))
{
return this.m_valueList[control];
}
return "";
}
public void SetTT(Control control, string caption)
{
this.m_valueList.Add(control, caption);
}
}
}