日期:2014-05-17 浏览次数:20947 次
readonly Dictionary<Label, string> _myDic = new Dictionary<Label, string>();
private new void Events()
{
var url = "www.8kmm.com";
_myDic.Add(lblBaiduSL, string.Format("http://www.baidu.com/s?wd=site%3A{0}", url));//百度收录
_myDic.Add(lblSougouSL, string.Format("http://www.sogou.com/web?query=site%3A{0}", url));//搜狗
_myDic.Add(lblBingSL, string.Format("http://cn.bing.com/search?q=site%3A{0}", url));//Bing收录
_myDic.Add(lblSoSoSL, string.Format("http://www.soso.com/q?w=site%3A{0}", url));//soso
_myDic.Add(lblYouDaoSL, string.Format("http://www.youdao.com/search?q=site%3A{0}", url));//有道
_myDic.Add(lblYaHooSL, string.Format("http://tool.cnzz.com/yahoo/search.php?q=http://{0}", url));//雅虎
_myDic.Add(lblGoogleSL, string.Format("http://www.google.com.hk/search?hl=zh-CN&q=site%3A{0}", url));//谷歌
foreach (var item in _myDic)
{
item.Key.Tag = item.Value;
((Label)item.Key).Click += delegate { ButtonCLick(item.Key.Tag); };
}
}
void ButtonCLick(object a)
{
Process.Start(a.ToString());
}
foreach (var item in _myDic)
{
var c= item;
item.Key.Tag = item.Value;
((Label)item.Key).Click += delegate { ButtonCLick(c.Key.Tag); };
}