views:

228

answers:

2

Hi all,

I've created an application that display a topmost window on each monitor, to cover all available place.

Then, I would like to allow to draw a rectangle on the windows. So, I create a rectangle that I add to the window when mouse move and mouse click ... This is working except when I'm drawing a rectangle that starts on a window and finish on another one. Of course, because it's not the same window ...

How can I do to allow drawing on both window at the same time ?

Thanks for your help,

A: 

You can create a window that stretchs across both screens.

Use the Screens collection in System.Windows.Forms (or wherever it is in WPF) and the WorkingArea property to calculate the correct extents of the window.

Be careful with multi monitor setups where primary screens are the other side from secondary screens or if the screens are stacked on top of each other.

We do this successfully in our application.

Matt Breckon
With that, I would maybe cover unused space, for example if a screen is bigger than the other
Tim
that is a potential pitfall with this approach. We have some control over the environment in which our app is deployed so this is less of a problem.
Matt Breckon
A: 

Another (and probably better) approach to this would be to have the data about the rectangles stored in a model class (using a MVVM approach). Then each view looks at a separate part of a virtual canvas. This way they both listen to updates of the data from the model and draw their section of the display accordingly.

Matt Breckon