CefSharp WpfControl and rendering to image

后端 未结 1 1647
遇见更好的自我
遇见更好的自我 2021-01-16 05:16

We want to show a webpage in a chromium based browser within a wpf application. The website that is displayed within the browser should also be shown on another screen but w

1条回答
  •  孤独总比滥情好
    2021-01-16 05:34

    Thank you amatiland, it indeed works with the OnPaint Method or Event.

        public MainWindow()
        {
            InitializeComponent();
    
            Browser.Paint += Browser_Paint;
        }
    
        void Browser_Paint(object sender, CefSharp.Wpf.PaintEventArgs e)
        {
            Bitmap newBitmap = new Bitmap(e.Width, e.Height, 4 * e.Width, System.Drawing.Imaging.PixelFormat.Format32bppRgb, e.Buffer);
    
            var aPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "TestImageCefSharpQuant.png");
            newBitmap.Save(aPath);
        }
    

    XAML

        
    

    0 讨论(0)
提交回复
热议问题