D
D
Daniel2021-01-14 22:31:59
WPF
Daniel, 2021-01-14 22:31:59

WPF window hangs?

Why the program hangs, and in general the window does not move to the second screen, any change in the size of the window, and freezes, as if the image element is redrawn there a trillion times

foreach(var edge in edges) // 10 000+
            {
                c.DrawLine(pen, new Point(edge.Start.X,edge.Start.Y),new Point(edge.End.X,edge.End.Y));
            }
            c.Close();

            var i = new Image();
            
            d.Drawing.Freeze();/// ? вообще не врубаюсь что этот метод делает
// но pen.Freeze()  повышает скорость программы в 100000000000000000 раз как минимум
            i.Source = new DrawingImage(d.Drawing);
            i.Source.Freeze();
            Canvas.Children.Add(i);


So there is no hangup, if the image itself is displayed in a separate bitmap =new RenderTargetBitmap(); And then work with him, but I don’t know if it’s right

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question