Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. Tooltip for Combobox

Tooltip for Combobox

Scheduled Pinned Locked Moved Windows Forms
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vikram
    wrote on last edited by
    #1

    Hi all There is a very peculiar requirement on a screen on one of the application i am working on. I need to show tool tip on every member of dropdownlist (when the list is open) Is there any way we can do that... If you have some hints please share. Thanks in advance

    Vikram I Code...

    J 1 Reply Last reply
    0
    • V Vikram

      Hi all There is a very peculiar requirement on a screen on one of the application i am working on. I need to show tool tip on every member of dropdownlist (when the list is open) Is there any way we can do that... If you have some hints please share. Thanks in advance

      Vikram I Code...

      J Offline
      J Offline
      Juan1R
      wrote on last edited by
      #2

      Hope this helps: - Change the DrawMode property of your combo box to OwnerDrawFixed. - Implement the event DrawItem of the combo box and write there something like this:

          ToolTip tt = new ToolTip();
          private void comboBox1\_DrawItem(object sender, DrawItemEventArgs e) {
              e.DrawBackground();
      
              e.Graphics.DrawString(comboBox1.Items\[e.Index\].ToString(),
                  e.Font, e.State == DrawItemState.Selected ? Brushes.White : Brushes.Black, e.Bounds, StringFormat.GenericDefault);
              e.DrawFocusRectangle();
              tt.Show(comboBox1.Items\[e.Index\].ToString(), comboBox1, 1000);
          }
      

      This event is now called whenever an item is displayed. Now you have to insert the text that draws the combo items and, by the way, you update the tool tip with the information you want to show about the item.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups