tags:

views:

160

answers:

3

I have a weird situation where I open a form from my application, hide it, and when I try to show it a second time, the Visible property says true, TopMost true also, location is correct, yet I can't see it.

Any ideas where and what to look at to work out what the problem is?

(Note: there may be issues with event handlers/delegate, but I'm not too sure where to start)

UPDATE - I set ShowInTaskbar to true - and I see it in the taskbar, but no way to bring it to front, and right click on the taskbar button does nothing. Alt-Tab neither. Doesn't show up in TaskManager.

Tried Crack.NET, but can't find any properties which let me get 'into' the object instance. .Net Memory Profiler doesn't help for this, I believe, and Winspector I'm not sure what to do with.

UPDATE2 - I lied, it's not directly a WinForm, I was inheriting from a custom class which in turn inherits from WinForm. I tried inheriting directly from Form and it works. So now I've got to go and look in the code of the custom class. I'll keep you posted...

A: 

Is the parent Window visible?

Windows has rules about children of non-visible windows being non-visible whatever their own visibility.

Richard
+1  A: 

Could it be out of the screen boundaries? (that is, moved out).

Use Spy++ or Winspector and try to find this missing window and see exactly where/why it's hiding.

Assaf Lavie
I don't think so - not if the location can be trusted anyway.
Benjol
+1  A: 

OK, nailed it.

The Custom form class has a 'cool' function - it fades in and out.

But only once, apparently.

So the reason I couldn't see the form is because the Opacity was 0!

Benjol
Haha, glad you found the issue :)
leppie
Ugh, the code belongs on DailyWTF - fade in with a Timer, out with a while+Thread.Sleep. Only fade in if ShowDialog, but fade out on Close and Hide. (So second open with Show obviously doesn't un-fadeout...)
Benjol