日期:2014-05-18  浏览次数:20898 次

listbox換行
listbox是顯示copy了哪個文件與日期等,有此文件名太長了,而我的listbox長度不夠,這樣就會有些信息顯示不出來
所以如何在Items超過長度時就將超過長度的信息換行顯示啊?

------解决方案--------------------
用Tooltip行吗?

增加个tooltip控件,然后再ListBox的鼠标Hover时间里写下下面的代码


string strTip = "";

//Get the item
int nIdx = listBox1.IndexFromPoint(e.Location);
if ((nIdx >= 0) && (nIdx < listBox1.Items.Count))
strTip = listBox1.Items[nIdx].ToString();

toolTip1.SetToolTip(listBox1, strTip);

这里有实例
http://download.csdn.net/source/1614