コード例 #1
0
        public static BitmapSource RenderSnapshot(System.Windows.Forms.Control control)
        {
            var bounds = control.Bounds;
            var bitmap = new System.Drawing.Bitmap(bounds.Width, bounds.Height);

            control.DrawToBitmap(bitmap, bounds);
            return(ConvertBitmap(bitmap));
        }
コード例 #2
0
        private static BitmapSource GetBitmapSourceForWinFormsContent(FabTabItem fabTab)
        {
            System.Windows.Forms.Control control = ((WindowsFormsHost)fabTab.Content).Child;
            System.Drawing.Bitmap        bit     = new System.Drawing.Bitmap(control.Width, control.Height);
            control.DrawToBitmap(bit, new System.Drawing.Rectangle(0, 0, control.Width, control.Height));
            BitmapSource source = loadBitmap(bit);

            return(source);
        }