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

解决方案 »

  1.   

    this.toolTip1.SetToolTip(this.checkBox1 ,"显示的提示");
      

  2.   

    用的是tooltip控件,不是属性,给分吧
      

  3.   

    不知道楼主的个数不定是怎么样的,试试下面代码在页面上加一人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);
            }
        }
    }
      

  4.   

    还是不明白,是一个动态的复选按钮组,CheckBoxList
    还有,我怎么找不到toolTip控件
      

  5.   

    ds=c_wx.get_wx_word(w_x,sex);
    for(int i=0;i<ds.Tables[0].Rows.Count;i++)
    {
    string str1=ds.Tables[0].Rows[i]["w_p_sense"].ToString().Trim();
    string str2=ds.Tables[0].Rows[i]["w_p_word"].ToString().Trim();
    CheckBoxList1.Items.Add("<a onmouseover=showMsg('"+str1+"','"+str2+"') onmouseout=hideMsg()>"+str2+"</a>");
    CheckBoxList1.Items[i].Value=str2;
    }
    这是我的代码,str2为复选按钮的内容,str1为提示内容,每个提示内容不一样
      

  6.   

    用foreach给每个项加上一个属性
     foreach ( ListItem i in CheckBoxList1.Items)
    {
      i.Attributes["title"] ="提示";
    }
      

  7.   

    请问一下,这个 i.Attributes["title"] ="提示";中的["title"]是哪个属性?
      

  8.   

    你是webform还是winform
    我说的是webform里面的.
    title就是提示的属性.
      

  9.   

    webform   
    不明白,我试了下,不行,还是没有提示出现
      

  10.   

    我用的是webform
    ds=c_wx.get_wx_word(w_x,sex);
    for(int i=0;i<ds.Tables[0].Rows.Count;i++)
    {
    string str1=ds.Tables[0].Rows[i]["w_p_sense"].ToString().Trim();
    string str2=ds.Tables[0].Rows[i]["w_p_word"].ToString().Trim();
    CheckBoxList1.Items.Add("<a onmouseover=showMsg('"+str1+"','"+str2+"') onmouseout=hideMsg()>"+str2+"</a>");
    CheckBoxList1.Items[i].Value=str2;
     foreach ( ListItem l in CheckBoxList1.Items)
    {
      l.Attributes["title"] =str1;
    }
    }
    这样写还是不行