日期:2014-05-19  浏览次数:20882 次

C#,怎样在一个复选按钮上显示提示
一个复选按钮组,怎么在每个复选按钮组上显示不同的提示,按钮个数是不定的!  
就是鼠标指在复选按钮上,就出现提示的那种!谢谢!

------解决方案--------------------
ToolTip
------解决方案--------------------
使用ToolTip控件
------解决方案--------------------
this.toolTip1.SetToolTip(this.checkBox1 , "显示的提示 ");
------解决方案--------------------
同意zihai2001_2004()~~~
------解决方案--------------------
不知道楼主的个数不定是怎么样的,试试下面代码

在页面上加一人ToolTip1,在CheckBox的_MouseMove事件里加入:

System.Collections.IEnumerator ea = this.Controls.GetEnumerator();
while (ea.MoveNext())
{
if (ea.Current.GetType().Name == "CheckBox ")
{
CheckBox cb = (CheckBox)ea.Current;
if (cb.Checked == true)
{
this.toolTip1.SetToolTip(cb, cb.Name);
}
}
}
------解决方案--------------------
用foreach给每个项加上一个属性
foreach ( ListItem i in CheckBoxList1.Items)
{
i.Attributes[ "title "] = "提示 ";
}
------解决方案--------------------
你是webform还是winform
我说的是webform里面的.
title就是提示的属性.