给Grid添加背景图片

13年前
    Bitmap bitmap = Properties.Resources.bg_001;//将图片bg_001加载到资源Resources.resx
            ImageBrush ib = new System.Windows.Media.ImageBrush();
            IntPtr ip = bitmap.GetHbitmap();
            ib.ImageSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(ip, IntPtr.Zero, Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());
            grid.Background = ib;