Hi all,

First the question:
Is there a way to be notified when the WorkingArea of the Screen
changes? (for example, the taskbar is moved from bottom to left of
desktop)

Here are the details of the problem if you are interested.

I have a form where I set the Region property. Everything works fine
until you move the TaskBar to the left or top of the desktop. This
then skews my Region's location and it appears incorrectly.

The problem is caused when I translate my Region to the screen
coordinates (using PointToScreen and Region.Translate). If the taskbar
is on the left or top, the region gets "pushed" to the right or bottom.
However, this position is incorrect. I solved the issue by offsetting
the region location using Screen.WorkingArea's x and y values.

Then I ran into a performance problem. I have to recalculate the
region quite a bit and it caused a performance issue. I was using
Screen.FromControl() everytime I was recalculating the region (My
application must support multiple monitors) and I believe this was the
culprit.

I have worked around the issue by caching the working area myself and
testing if my Form moves from one monitor to the other via the
LocationChanged event.

The only problem is I need to know when the WorkingArea changes so I
can update my cached workingArea and also re-translate my region.

TIA
Cole

Re: Screen.WorkingArea Changed Event? by Armin

Armin
Wed May 18 12:47:10 CDT 2005

"scolemann" <scolemann@yahoo.com> schrieb
>
> First the question:
> Is there a way to be notified when the WorkingArea of the Screen
> changes? (for example, the taskbar is moved from bottom to left of
> desktop)

Handle the event Microsoft.Win32.SystemEvents.UserPreferenceChanged.
e.Category will be Microsoft.Win32.UserPreferenceCategory.Desktop


Armin

Re: Screen.WorkingArea Changed Event? by scolemann

scolemann
Wed May 18 13:07:30 CDT 2005

Armin,

Thank You! That worked perfectly.