A
A
Alexander Zaitsev2016-12-28 20:05:39
.NET
Alexander Zaitsev, 2016-12-28 20:05:39

How to make rectangle resize on MouseMove without performance loss in WPF?

I'm writing a screenshot app. There should be a function: select part of the screen. Tried various implementations - when moving the mouse, the selection starts to change in size in jerks (larger selection size - more jerks). Especially noticeable on multiple monitors.
Can you advise how to get rid of jerks?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sumor, 2016-12-29
@Sumor

On top of the elements you create a Canvas, on it is a Rectangle that will display the selection.
By pressing the mouse button, you make the Rectangle visible and fix one point. By MouseMove you set the second one. Redrawing is handled by WPF itself, no new elements appear on MouseMove and there are no jerks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question