PictureBox with stretched image in .Net 8 is 10 times slower than in .Net Framework
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 1.1k
- Avg merge
- 20h 23m
- Merged PRs (30d)
- 103
Description
### .NET version
8
### Did it work in .NET Framework?
Yes
### Did it work in any of the earlier releases of .NET Core or .NET 5+?
_No response_
### Issue description
Drawing of PictureBox with stretched image in .Net 8 is 10 times slower than in .Net Framework. This slowdown is noticeable when form and PictureBox is resized by dragging border of the form with mouse.
### Steps to reproduce
I have a simple form with a PictureBox that is larger than the image assigned to it and with SizeMode set to PictureBoxSizeMode.StretchImage.
Im using this code to test drawing performance of this form.
Stopwatch sw = new Stopwatch();
long ts = 0;
long ct = 1000;
sw.Restart();
for (int i = 0; i < ct; i++)
{
Refresh();
}
sw.Stop();
ts += sw.ElapsedMilliseconds;
decimal m = 1M * ts / ct;
var msg = $"count:{ct} time(milliseconds):{ts} average:{m:0.000}";
MessageBox.Show(msg);
In .Net it takes 10 times more time to do this than in .Net Framework.
[TestPictureBoxSpeed.zip](https://github.com/user-attachments/files/23265679/TestPictureBoxSpeed.zip)
Contributor guide
Assessment
This issue has not been assessed yet.