Sunday, March 27, 2011

tooltip appearing behind the form/window! (C# / VS 2008)

For some strange reason, my toopltip in the VS 2008 C# winforms application shows up behind the form! It's very frustrating and I can't figure out what I should do. Anyone face this before? Ideas?

(PS - I'm doing a toolstip.show programmatically within the form)

From stackoverflow
  • Try bringing your page element to the front. (Right click on element, bring to front). Is this happening on all tool tips you have configured? And no, I have not seen this before

    Bevan : Are you talking about the page element on an ASP.NET form? 'cause this question is about a WinForms problem ...
  • There are a few things you might want to check:

    1. Make sure the tooltip knows what its parent window is.
    2. Make sure the window the tooltip belongs to is in the foreground (no, this isn't a requirement for displaying tooltips, it just helps debug.)
    3. Try giving focus to the owner of the tooltip. If that fixes the problem, then there's probably an ownership problem with your tooltip.
  • There is a similar (and known) problem with tooltips appearing behind the Windows task bar. The problem is sporadic and I have never seen a solution. If you're also seeing this behavior sporadically (and I suggest that you try this on different machines), then it may be related. Otherwise, if the problem is consistent across multiple machines, let's see your code, because you're probably doing something wrong.

  • I have a similar issue. I have a user control written as C++ WTL, being used in a C# .NET2 app. If the control is just on the form then the controls tooltips work fine, however if the user control is on a panel or in a group then the tooltip is behind. I've tried changing the WTL code to force the tip to the front, this works but causes issues with lost focus/selection in other controls.

  • This problem is almost always caused by the window being TopMost. Try using SetWindowPos to set your tooltip to HWND_TOPMOST. I haven't tried this though...

  • I've seen this issue happen in both Windows.Forms and Delphi (native windows) based applications, caused by the interaction of "stay on top" with the Windows API.

    Essentially, marking a form as TopMost makes it stay on top of some windows, but not others - Window management has more than two distinct levels.

    What I found is this: my applications would behave themselves when run normally, with tooltips showing on top. Problems would occur when switching to- and from- other applications - somehow the "TopMost" of the windoww would become "very-ultra-top-most" (non-technical term ;-) ) with the tooltips appearing behind the window.

    Having described the problem, I'd like to offer you a solution - but I never did find a good one. Sigh.

    Hope that the additional information will be enough for you to find the solution you need.

  • I have seen this happen on Windows XP, particularly on the taskbar.

    Are you sure it's an issue with your application, rather than the OS?

0 comments:

Post a Comment