以下是我将图像绘制为边框对象背景的代码。
void DrawImage()
{
MemoryStream ms = new MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
System.Windows.Media.Imaging.BitmapImage chartBitmapImage = new System.Windows.Media.Imaging.BitmapImage();
chartBitmapImage.BeginInit();
chartBitmapImage.StreamSource = new MemoryStream(ms.ToArray());
chartBitmapImage.EndInit();
imageBrush.ImageSource = chartBitmapImage;
aBorder.Background = imageBrush;
...
}
上面的 DrawImage() 方法每秒钟调用一次。所有操作都运行良好,但速度太慢。
我想提高性能。有什么改进的地方吗?也许,我猜任何 bmp 图像处理方法都比我使用的更好。帮我...