Note that there are some explanatory texts on larger screens.

plurals
  1. POPerformance of a semi transparent Window over multiple screens when moving a rectangle in realtime
    text
    copied!<p>I've a small app which show a semi transparent window over the whole desktop. The window isn't shown in the taskbar and has not titlebar</p> <p>On this window the user can drag a rectangle with the mouse. When the mouse button is released, a screenshot of the given area is taken. (Something like the snipping tool in windows 7)</p> <p>In order to achieve this, the window contains a RectangleGeometry.</p> <p>Now in the CompositionTarget.Rendering event the rectangle where set to the location where the mouse was when the mouse down occured, also it is sized to cover the area to the current mouse position.</p> <p>This works really fine as long as only one monitor is connected. When a second monitor with a higher resolution is connected the performance decreases dramatically.</p> <p>The resolution of the laptop display is 1600x1200</p> <p>The display which is connected has 1900x1200</p> <p>Also when connecting the display it changed the primary screen to the new one</p> <p>Heres the window definition</p> <pre><code>&lt;Window x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" AllowsTransparency="True" Background="Transparent" WindowStyle="None" &gt; the geometry definition &lt;Path Fill="Black" Opacity="0.4" Stroke="Red" StrokeThickness="3"&gt; &lt;Path.Data&gt; &lt;RectangleGeometry x:Name="Inner" Rect="105,5,90,90"/&gt; &lt;/Path.Data&gt; &lt;/Path&gt; </code></pre> <p>Here a portion of the code which moves the rectangle</p> <pre><code>System.Windows.Rect location = new System.Windows.Rect(this.DragStart.X, this.DragStart.Y, width, height); </code></pre> <p>this.Inner.Rect = rect;</p> <p>Does anyone have an idea on how to improve the performance ? Is it "normal" that the performance decreases so much on higher resolutions with multiple displays ?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload