Drawing on multi screen with WPF
I've created an application that display a topmost window on each monitor, to cover all available place.
Then, I would like to 开发者_如何学Goallow 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,
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.
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.
精彩评论