How to set tooltip on Combobox Items in Windows Application.

How to set tooltip on Combobox Items in Windows Application.

Below code block is set tool tip on combobox items. First you need to drop Tooltip UI Control on windows Form. Default name of tooltip control is toolTip1. Now we need to create different events to show tooltip on Combobox each items. Add Below code in form load events.

private void Form1_Load(object sender, EventArgs e)
            cmbProperty.DrawMode = DrawMode.OwnerDrawFixed;
            cmbProperty.DrawItem += new DrawItemEventHandler(cmbProperty_DrawItem);
            cmbProperty.DropDownClosed += new EventHandler(cmbProperty_DropDownClosed);
            cmbProperty.Leave += new EventHandler(cmbProperty_Leave);


In Above cmbProperty is Combobox name. Now add below event handler in form1.cs

void cmbProperty_Leave(object sender, EventArgs e)

        void cmbProperty_DropDownClosed(object sender, EventArgs e)

        void cmbProperty_DrawItem(object sender, DrawItemEventArgs e)
            if (e.Index < 0) { return; } 
            string text = cmbProperty.GetItemText(cmbProperty.Items[e.Index]);
            using (SolidBrush br = new SolidBrush(e.ForeColor))
            { e.Graphics.DrawString(text, e.Font, br, e.Bounds); }
            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            { toolTip1.Show(text, cmbProperty, e.Bounds.Right, e.Bounds.Bottom); }

Now run the application and Enjoy!!! Let me know if you are facing any problem.

Posted in |


  1. Anonymous Says:

    It's Cool

  2. r.I.E.n Says:

    perfect, thanks a bunch :)

  3. Anonymous Says:

    it very good.. thanks

Post a Comment