开发者

Windows Tooltips are not getting displayed

I have a code which sets the tooltip for a Winforms Controls in the standard way like this :-

Tooltip tooltip = new tooltip();

toolTip.SetToolTip(control, text);

In the same application, there is a Window which is rendering a movie of some Images at 5 Frame per second using Direct3D SDK. Now, when the Movie is being rendered i.e. when it is in PLAY mode, the tooltips never appear. As soon as I pause the Movie, the tooltips start appearing.

  • CASE 1:

As a workaround I did the following change to the code -

Tooltip tooltip = new tooltip();

toolTip.InitialDelay = 50;

toolTip.SetToolTip(control, text);

Now, as soons as I introduce an INITIAL DELAY the tooltips are rendered irrespective of the Movie is playing or not ?

  • CASE 2:

If I do not put the Initial Delay and instead subscri开发者_开发百科be to OnMouseHover event of the control and then put the above two lines of code explicitly in the even handler, then also tooltips are not lost. They appear normally. But, this not a standard practice of showing tooltips.

Can anybody correct me in what is going wrong here in Tooltips rendering ? I am using .Net 2.0 & C#.


D3D video and Tooltips both use overlays (the number of screen capture programmes I've used that don't capture tooltips because of this!); so I believe that you're seeing some interference from the D3D overlay.

Could be that the video is over-drawing the tooltip because it's being rendered during playback - so the tooltip is there, you just can't see it.

I'm mystified, however, why setting an initial delay would suddenly make it work! That said, InitialDelay controls the delay that applies to the tooltip the very first time it shows, so it could be something to do with a change to how the tooltip grabs the overlay surface on which to display.

Certainly, I'd use that as the workaround rather than repeatedly constructing and assigning the tooltip as, like the other answer says, it could murder resources.

I'd find the smallest possible InitialDelay that works and go with that.

Finally - what version of Windows and DX are we talking about here? There's a couple of other threads, starting here and in a link to GameDev inside it, about issues with tooltips and DirectX; and point to the fact that there might be more going on here than just a bit of .Net weirdness!


See ToolTip Component (Windows Forms) at http://msdn.microsoft.com/en-us/library/he23h308(VS.85).aspx. Specifically, check out How to: Set ToolTips for Controls on a Windows Form at Design Time at http://msdn.microsoft.com/en-us/library/s894w4aa(VS.80).aspx.

You are not using the ToolTip properly. The example you linked to only shows how to create a ToolTip, not how to use it.


Modify this for you case. Should work. You should set all of these properties.

            // Create the ToolTip and associate with the Form container.
            ToolTip toolTip = new ToolTip();

            // Set up the delays for the ToolTip.
            toolTip.AutoPopDelay = 15000;
            toolTip.InitialDelay = 300;
            toolTip.ReshowDelay = 300;
            // Force the ToolTip text to be displayed whether or not the form is active.
            toolTip.ShowAlways = true;

            // Set up the ToolTip text for the Buttons
            toolTip.SetToolTip(this.button2, "TooltipText1");
            toolTip.SetToolTip(this.button3, "TooltipText2");
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜