因为窗体大小限制,不能让combobox自动适应大小;
我想让鼠标放在combobox上时,出来提示,显示该条数据的所有内容,就像web的toolip一样,
网上搜 了下,说是combobox有个hint,但是这个是delphi的请问,在c#里面这种情况该怎么办?

解决方案 »

  1.   

    winfow也可以用ToolTipprivate void comboBox1_MouseEnter(object sender, EventArgs e)
    {
        ToolTip ttTip = new ToolTip();
        ttTip.SetToolTip(comboBox1, comboBox1.Text);
        ttTip.ToolTipIcon = ToolTipIcon.Info;
        ttTip.ForeColor = Color.Blue;
        ttTip.BackColor = Color.LightGray;
        ttTip.AutoPopDelay = 5000;
    }
      

  2.   

    function select1_onmousemovetop(This) {
    var x= offsetLeft(This) +20;    
        var oDivUrgent=document.getElementById("DivTooltip");
        var y= offsetTop(This)   +   This.offsetHeight;
        ShowBubbleInchmeal(x, y,oDivUrgent,This.options[This.selectedIndex].text);
    }
    function select1_onmousemove(This) {
    var x= offsetLeft(This) +20;
        var y= offsetTop(This)   +   This.offsetHeight;
        var oDivUrgent=document.getElementById("DivTooltip");
        ShowBubbleInchmeal(x, y,oDivUrgent,This.options[This.selectedIndex].text);
    }this.DropDownList1.Attributes.Add("onmouseover", "select1_onmousemovetop(this);");
    this.DropDownList1.Attributes.Add("onmouseout", "select1_onmouseout();");
      

  3.   

    function ShowBubbleInchmeal(x, y,oTipBubbleDIV,text)
    {    
        oTipBubbleDIV.style.display=""; 
        oTipBubbleDIV.style.zIndex=999; 
        oTipBubbleDIV.style.left =x;
        oTipBubbleDIV.style.top = y;
        if(text!="" && text!=undefined)
            oTipBubbleDIV.innerText=text;
    }