I am using .NET 2.0 forms and running on Windows XP SP2. When I have a
tooltip on a combo box, and the combo box is expanded (“dropped down”)
using the arrow, it will no longer display it’s tooltip, no matter how
long I hover. Even if I move off the control and back it will still not
display its tooltip. If I then go to another control that has tootips,
then back to the combobox, it will again display its tooltip, until the
next time it is expanded.
Below is a small sample that has this bug (on my machine anyway.) It is
simply the standard VS8.0 generated code, condensed. Strangely, if I
remove the EnableVisualStyles() line, then the tootips seem to work
correctly.
I could not find any information about this bug. I am curious if anyone
else has come across it, and if there is a solution? Any help appreciated.
======= Buildable Code Sample Below
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace ComboTest
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Form1());
}
}
class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
// comboBox1
this.comboBox1.DropDownStyle =
System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(12, 59);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 21);
this.comboBox1.TabIndex = 0;
this.toolTip1.SetToolTip(this.comboBox1, "Combo Tooltip");
// button1
this.button1.Location = new System.Drawing.Point(12, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.toolTip1.SetToolTip(this.button1, "Button tip.");
this.button1.UseVisualStyleBackColor = true;
// Form1
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.button1);
this.Controls.Add(this.comboBox1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.Button button1;
}
}
====== END Code Sample