[Mono-winforms-list] Find out if the application window is focused/active
Stifu
stifu at free.fr
Sun Feb 8 06:34:23 EST 2009
Hi guys,
Long story short, I have the exact same problem as the one described here:
http://bytes.com/groups/net-c/760728-application-focus
I want to know if my application window is currently focused/active, but
doing this.Focused doesn't return true if one the child controls of the
application is focused.
I've been searching for a solution for weeks, and couldn't find any other
than P/Invokes, which I want to avoid for obvious reasons. The only solution
I can think of right now is making my own function that'd check every child
control of the application, and return true if one of them is focused... but
that sounds dirty (and possibly slow).
For what it's worth, the reason I'm looking into this is that I implemented
clipping (partial repainting) in my app, and want to find out when to make a
full repaint rather than a partial one. Right now, if you put a window in
front of my app, then refocus my app, the previously overlapping window will
still be visible inside my Panel. Due to the way my app works, I can't rely
on whether the concerned Panel is focused or not, because hovering it makes
it gain focus (which I need for stuff like mousewheel scrolling)... Anyway,
I can upload the sources of my app, if anyone thinks there is a better
solution than finding out whether the program window is active.
Help? Thanks!
--
View this message in context: http://www.nabble.com/Find-out-if-the-application-window-is-focused-active-tp21897934p21897934.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.
More information about the Mono-winforms-list
mailing list