Why does BitmapSource.Create throw an ArgumentException?
问题 I'm trying to get an bitmap created from raw data to show in WPF, by using an Image and a BitmapSource: Int32[] data = new Int32[RenderHeight * RenderWidth]; for (Int32 i = 0; i < RenderHeight; i++) { for (Int32 j = 0; j < RenderWidth; j++) { Int32 index = j + (i * RenderHeight); if (i + j % 2 == 0) data[index] = 0xFF0000; else data[index] = 0x00FF00; } } BitmapSource source = BitmapSource.Create(RenderWidth, RenderHeight, 96.0, 96.0, PixelFormats.Bgr32, null, data, 0); RenderImage.Source =