原本的效果应该是这样的
可是保存了位图之后就变成这样子了请问,这是什么情况造成的。哪里出现了问题?
 private void btnSaveAndPrint_Click(object sender, RoutedEventArgs e)
        {
            if (IfNull() == false) { return; }
            
            PrintDialog dialog = new PrintDialog();
            if (dialog.ShowDialog() == true)
            {
                dialog.PrintVisual(canvas1, "Print png");
                
            }            SaveFileDialog saveFile = new SaveFileDialog();//创建保存对话框
            saveFile.Filter = "PNG|*.png|JPEG|*.jpeg;*.jpg|位图文件|*.bmp|所有文件|*.*";//设置保存的图片格式  
            saveFile.FileName = lbBillNo.Content.ToString();
            string path = "";            Canvas cvs = PageController.GetPrintTemplate(this);            RenderTargetBitmap bmp = new RenderTargetBitmap((int)cvs.Width, (int)cvs.Height, 96, 96, PixelFormats.Pbgra32);
            bmp.Render(this.canvas1);            if (saveFile.ShowDialog() == true)
            {
                path = saveFile.FileName;
                BitmapEncoder encoder = new PngBitmapEncoder();
                encoder.Frames.Add(BitmapFrame.Create(bmp));
                using (Stream stm = File.Create(saveFile.FileName))
                {
                    encoder.Save(stm);
                }
                Process.Start(Path.GetDirectoryName(path));
            }
        }