Window is not maxinizing/being brought to front after being in tray, why?/help
I wrote an alarm app with some complex code i dont feel like breaking up right now to use as an example. I have a timer checking every 10 or so minutes about a state online and on certain conditions my app alerts me. On form_load i set the timer to 10mins and when it triggers and t开发者_高级运维he condition is true i call a function with this in it.
{
this.WindowState = FormWindowState.Maximized;
this.TopMost = true;
this.Activate();
}
When i start the app i typically minimize it and do whatever. Today i notice it isnt working. On my initial test i call the code after pulling the states and calling the func on form_load which always brought it up but now that i am doing other things and the window has been minimized i notice it did not work. How do i fix this?
Are you hiding the form? In which case try this.Show()
instead.
Additionally, form_load runs once (usually). You want form_activated. The form is in memory (loaded) whether or not it's minimized.
And, including a call to the activate event in your form_load event is redundant.
精彩评论