c# tooltip控件
橘子灬水果 2013-02-25 09:22:27 使用tooltip控件,当鼠标移动到按钮上,判断按钮的颜色是否为红色,是红色显示一条信息,不是则返回。当信息显示一次后,按钮颜色不是红色了,为什么还显示信息....代码如下:
private void F_人物_MouseEnter(object sender, EventArgs e)
{
Control x = (Control)sender;
if (x.Name == "pictur1"||x.BackColor == Color.Gray)
{
return;
}
else
{
ToolTip ttTip=new ToolTip();
ttTip.AutoPopDelay = 5000;
ttTip.InitialDelay = 1000;
ttTip.ReshowDelay = 500;
ttTip.ForeColor = Color.Blue;
ttTip.BackColor = Color.LightGray;
ttTip.IsBalloon = true;
ItemData xItemData = new ItemData();
BaseConfig.m_ItemConfig.DictData.TryGetValue(m_dict_euip[Convert.ToInt32(x.Name.Substring(6, 1)) - 1].ItemBase.iIndex, out xItemData);
ttTip.SetToolTip(x, xItemData.Name + "\n" + xItemData.Price + "\n" + xItemData.Describe);
}
}