On XP, how can I get the tooltip above the transparent form?
I have a form with Opacity
less than 1.0. I have a hint related to a label on a form. When I hover over the label, the tooltip is displayed below the form instead of the form. If you leave the default Opacity at 1.0, the tooltip appears correctly above the shape. However, my form is obviously no longer translucent .; -)
I tried to manually adjust the position of the ToolTip with SetWindowPos()
and create the tooltip "manually" with CreateWindowEx()
, but the problem persists. This leads me to suspect its a problem with the Win32 API, not a problem with a Windows Forms implementation that runs on top of Win32.
Why does the tooltip appear below the form and more importantly, how can I display it on the form where it should be?
Edit : This is an XP only problem. Vista and Windows 7 are working correctly. I would still like to find a workaround to get a tooltip above a form on XP.
Below is a minimal program to demonstrate the problem:
using System;
using System.Windows.Forms;
public class Form1 : Form
{
private ToolTip toolTip1;
private Label label1;
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
public Form1()
{
toolTip1 = new ToolTip();
label1 = new Label();
label1.Location = new System.Drawing.Point(105, 127);
label1.Text = "Hover over me";
label1.AutoSize = true;
toolTip1.SetToolTip(label1, "This is a moderately long string, "
+ "designed to be very long so that it will also be quite long.");
ClientSize = new System.Drawing.Size(292, 268);
Controls.Add(label1);
Opacity = 0.8;
}
}
a source to share
