Print, copy...

2 posts, 0 answers
  1. Rieni De Rijke
    Rieni De Rijke avatar
    170 posts
    Member since:
    Mar 2010

    Posted 17 Nov 2010 Link to this post

    What is the best way to print the Radmap or to copy a RadMap to the clipboard (so you can paste the image in for inst.paint) ?
  2. Rieni De Rijke
    Rieni De Rijke avatar
    170 posts
    Member since:
    Mar 2010

    Posted 18 Nov 2010 Link to this post

    I found a way to copy the RadMap to the clipboard. 
    So you can paste the image in word, Paint and more.
    Of course you can also use it to copy other controls.

    private void ControlToClipboard(FrameworkElement obj)
    {
        Transform transform = obj.LayoutTransform;
        obj.LayoutTransform = null;
        Thickness margin = obj.Margin;
        obj.Margin = new Thickness(0, 0, margin.Right - margin.Left,
                                         margin.Bottom - margin.Top);
        Size size = new Size(obj.ActualWidth, obj.ActualHeight);
        obj.Measure(size);
        obj.Arrange(new Rect(size));
     
        RenderTargetBitmap bmp = new RenderTargetBitmap((int)obj.ActualWidth,
            (int)obj.ActualHeight, 96, 96, PixelFormats.Pbgra32);
     
        bmp.Render(obj);
        obj.LayoutTransform = transform;
        obj.Margin = margin;
        Clipboard.SetImage(bmp);
    }

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top