views:

22

answers:

1

Hello

Is it possible to embed an icon on StatusBar control on .NET CF 3.5?

Regards Dominik

+1  A: 

The Compact Framework StatusBar control is very, very basic and limited in functionality. It doesn't support adding images or even multiple panels. This is partly due to laziness of the CF team (IMO) and partly due to OS limitations.

The OS status bar common control supports up to 255 panels. The CF team didn't allow for more than one. This is pure laziness, but at least you could work around it by subclassing it and sending it a SB_SETPARTS message. It would require a fair amount of P/Invoking to get it all working, so unless you really need that, I'd avoid it.

Images, however, are not even supported in the native control. It possible that you could subclass it and then handle WM_PAINT yourself and draw in your icon. I've not tried, but it seems like a reasonable approach. This is going to require a fair bit of ugly native calls for all of the GDI stuff too. This has potential for memory leaks or access violations, so unless you really need it and are comfortable with good old Win32 painting, you might try to come up with an alternate solution before deciding on this route.

ctacke