views:

67

answers:

3

Hi,

I'm developing a email client and I want the screen to flash briefly when I receive a mail. I searched anywhere I could in .NET documentation, but the only way I found to achieve it was to use DirectX functions which is of course impossible : I don't want my users to install DirectX only for a mail client :)

Is there a way to do this only with GDI ?

Thanks

A: 

I'm not sure exactly what kind of flash effect you're looking for, but you could achive this by briefly showing a full-screen semi-transparent form -- see the Opacity property.

Tim Robinson
Thank you, I'll look at that too :)
Harkonnen
+5  A: 

Fortunately, there is no way for an application to do this sort of annoying thing. Your program should use the notification area for notifying users of events and/or status changes.

Check out the WPF Notification Area example to see how you can use this in a WPF application...

VoidPointer
Equally the application could use the show alert ability of Windows to flash its task bar icon (avoid split focus). Use P/Invoke to call FlashWindowEx: http://msdn.microsoft.com/en-us/library/ms679347(VS.85).aspx
Richard
I agree with you VoidPointer, this is a really annoying thing. But it's my customer's wish... And customer is.. customer ;)Thanks for your answers, I'll try your solution and Richard's too.
Harkonnen
+2  A: 

There's a good reason functionality like this isn't built into Windows. Displaying large flashing rectangles is prone to induce seizures in people that suffer from photosensitive epilepsy.

Don't do this.

Hans Passant
I totally agree with you... But as I said above, that's what my customer want. I told him about photosensitive epilepsy and he doesn't care... No comment.
Harkonnen