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)
There are a few things you might want to check:
Make sure the tooltip knows what its parent window is.
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.)
Try giving focus to the owner of the tooltip. If that fixes the problem, then there's probably an ownership problem with your tooltip.
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
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?
Related
My Windows forms application creates the user menus at runtime given the user access privileges.
It works fine, but when the app is minimized, then all menus vanish. The space is used, but the names and icons are gone (obviously no sub-menu is shown, due to top level menu items are gone)
It is coded using the class ToolStripMenuItem and previously this code is set:
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Does someone have seen this behaviour?
Regards
Daniel.
Murphy's... Months stuck with this... and the solution was as simple as this:
When creating the MenuStrip objects I set the AutoSize property to false. I commented that line and it worked perfectly.
Thank you Reza Agahei for reading this and being concerned about this problem.
I can't understand fully why this happens... but what is working... musn't be even stared at.
I didn't post any code because the menus where generated through abstract model objects invoked through reflection, but I will follow your advice Reza, if I have another issue.
Thanx.
PS. I love this site, I always have found answers to my problems here, and now I'm happy to be part of it.
I'm having a persistent problem with my VS2010. After working for a while, the display will start to glitch out. The code all shows as black-on-black (I use a dark background because it's easier on the eyes, but even when I switched to the default, it just makes the text white-on-white instead.) All tooltip hovers appear in the upper-left corner of the screen instead of where they're supposed to. If you select text, the code that gets selected is nowhere near where you clicked the mouse. (Not that you can read the text anyhow since it's the same color as the background.) And none of the dockable panels will appear or if they do they're all glitched out as well. The only solution seems to be closing the program and restarting it. I've been using this copy of VS2010 for years without issue, and my other projects don't seem to have any problems. This one is C#, uses a lot of Windows Forms (not WPF), has some customized Controls, but otherwise isn't all that unusual. I have the following extensions:
CodeMaid
CSharpIntellisensePresenter
InheritanceMargin
ProductivityPowerTools
Tunnel Vision Labs Output Window Services
WatermarkTextBox Control
Some of these are recently installed so they may be the culprits. Has anyone had any display problems with any of these extensions? I can live without most of them, but I'm not sure if it'll make a difference. There's no easy way to test it either, as the glitch only shows up every couple of hours or so.
I have a requirement that specifies that a notification tray application that uses WPF must (based on some conditions) pop-up a window that is globally modal. This should prevent the user from doing anything (even outside of the Tray application) until they have satisfied some other conditions at which time it will enable the close button and allow the user to close it.
How does one make such a window? I have the window displaying and it evaluates the conditions and whatnot, but it is only modal to the application (i.e. it only blocks execution and UI for the application it is running under.
I imagine I could create a borderless window and maybe disable the minimize functionality, but they would still be able to access the start menu. Any takers? What I am striving for functionality-wise is similar to the Windows UAC/Admin privilege request window.
This is not a duplicate of the question provided by the duplicate box at the top. That question pertains to Windows Forms and is not applicable to WPF. As it happens I received an answer that worked well for me, and it was not the answer to the question provided above. Not that it matters really, but I would like the duplicate tag taken off. I like to think that I research my questions pretty well before posting, and adding that tag implies that I do not.
EDIT
This question is not a duplicate of the question that was linked int he Duplicate Question box. That question was answered with in a Windows Forms flavor, and I am using WPF, a completely different UI framework.
Use the Window.ShowDialog() method. More info can be found here
See the second comment by sixlettervariables.
One solution could be to make a semi transparent WPF window that covers the entire screen (actually you should say: all screens) and show the modal window using Window.ShowDialog() with the owner being that window. All you need to do then is prevent task switching (which is not an easy task), but maybe doing that is enough?
Something like UAC does - for example like in the answer to this?
I am trying to create a panel which will have a set of "buttons" on it.
These buttons should have the following behaviour:
Appear similar to a tag (with
rounded edges)
Contain a red
cross to remove the filter/tag from
the panel, similar to the way internet
explorer tabs have an embedded cross to close the individual tab.
allow the user to click
on the tag and respond like a normal
button (as long as the click is not
in the red cross)
Number 1 is no problem, this is just appearance, however, regarding numbers 2 and 3, I am not sure if there is already code out there do to something similar...and I dont really want to reinvent the wheel if I can avoid it!
My question is: Does anyone know if there is something out there in infragistics which will do this simply, or will I need to write this myself by subclassing winform buttons?
Thanks in advance!
Is this new development or maintenance of an existing project?
If it is maintenance, you have a somewhat tougher time ahead. You'll implement a UserControl, probably segmented into two buttons. Use docking to get the behavior as correct as possible. The far right button would contain your cross image; the left (which would need to auto-expand as you resize the control) would contain your primary button behavior. Play with the visual styles until you get them right (EG, removing borders, etc).
If this is new development, and you haven't gotten too far into it, you might consider using Windows Presentation Framework (WPF) instead of WinForms. It will be easier to build the control and get it to look exactly how you want it. WPF includes an extremely powerful control compositing system which allows you to layer multiple controls on top of each other and have them work exactly as you'd expect, and it carries the added advantage of allowing full visual control out-of-the-box.
Either way, this is more work than dropping in an external component ... I've used Infragistics for years, and I can't think of anything they have which is comparable. The closest, but only if you're building an MDI application and these controls are for window navigation, is the Tabbed MDI window management tools -- and there, only the tabs (which replace window title bars) have this behavior.
I don't think that infragistics can do something like this. The UltraButton control can't.
Implementing a own control wouldn't be that hard.
your probably going to have to make a costume control for this type of work.
I have a WinForm that uses an ElementHost to display a WPF UserControl. Once every 50 times or so when the form loads the WPF content fails to paint. You can see through the WinForm chrome to whatever is beneath. Resizing the window gets the WPF content to show up.
Is this a known issue? Can anyone suggest a workaround?
We have fought these types of issues before. See this WPF forum post for more info on our particular flavor (I don't know if it is the same issue or not).
The only thing that we found to work was to change the size of the ElementHost.
_elementHost.Width++;
It's a complete hack, ugly, and I'm embarrassed to even post it. But nothing else ever worked for us. So, it is definitely a workaround. (Grin)
We tried Invalidate, Refresh and everything we could think of ... on the ElementHost. We also tried InvalidateMeasure, InvalidateArrange, and InvalidateVisual on the WPF hosted content. No luck.
If you find another way to fix your issue, I would love to hear about it.
Good luck, I know I have lost some hair on this one.
Update 1:
I have submitted another WPF forum post on this. Maybe we can get a response from Microsoft. Sure seems like a bug to me.
Update 2:
After I fixed the refresh issue with the above hack ... I still had another problem to solve that I thought worth mentioning here. That is: there was a definite delay until the screen refreshed. This made it seem like the user was navigating to another screen (it wasn't ... it was just the contents of the double buffering buffer). I ended up having to manually call System.Windows.Forms.Control.Refresh() on the Control that was hosting the ElementHost. In this way, even though the pause was still there ... at least the screen was blank ... and it didn't look like the user was navigating somewhere ...
the following worked for me.
On the Form_Activated event, I added the following
elementHost1.HostContainer.InvalidateVisual();
I know this post is old, but in the later version of .net (i.e 3.5), you can try to use software rendering mode. This seems to fix a lot of problems when you host a WPF control in the ElementHost.
Ref: Software rendering mode - WPF
Maybe call Invalidate on the ElementHost?
Have you tried to use reflection to see the code behind _elementHost.Width++?