开发者

Display tooltip for items in combobox in C# winforms

开发者 https://www.devze.com 2023-01-22 14:32 出处:网络
I am trying to display tooltip for items in combobox. I tried this code in combobox selected index c开发者_Go百科hanged event but it does not work as expected.

I am trying to display tooltip for items in combobox. I tried this code in combobox selected index c开发者_Go百科hanged event but it does not work as expected.

ToolTip toolTip1 = new ToolTip();
toolTip1.AutoPopDelay = 5;
toolTip1.InitialDelay = 0;
toolTip1.ReshowDelay = 0;
toolTip1.ShowAlways = true;
for (int i = 0; i < cbo.Items.Count; i++)
{
  toolTip1.SetToolTip(this.cbo, cboCounty.Items[cbo.SelectedIndex].ToString()); 
}             

As it is not possible to add tooltip to combobox control directly, we may have to create a user control for implementing this functionality. Can anyone guide to create a customized combobox which displays tooltips for items in it?

0

精彩评论

暂无评论...
验证码 换一张
取 消