• 关于从剪贴板获得截图


    在我参照Paint.Net开发的程序中使用了如下的方法
     1        private void AcquireFromClipboard()
     2        {
     3            IDataObject iData = Clipboard.GetDataObject();
     4            if(iData == null)
     5                return;
     6            Image img = null;
     7            if(iData.GetDataPresent(DataFormats.Bitmap) || iData.GetDataPresent(DataFormats.MetafilePict))
     8            {
     9                img = (Image)iData.GetData(DataFormats.Bitmap);
    10                PaintDotNet.WinGUI.Forms.ImageForm imageForm = new PaintDotNet.WinGUI.Forms.ImageForm(this);
    11                PdnLib.Document doc = new PdnLib.Document(img);
    12                doc.IsDirty = true;
    13                imageForm.GetView().GetSurfaceBox().Document = doc;
    14                this.layersDialog.BindLayerList(imageForm.GetView().GetSurfaceBox().Document.Layers);
    15                imageForm.Show();
    16            }

    17        }
    其中iData.GetDataPresent(DataFormats.MetafilePict)可以确保我的程序能够获得Office程序复制的内容
    下面给出一幅截图(程序获得了通过PrintScreen截取的绘图程序界面)

  • 相关阅读:
    file
    shell脚本的执行
    添加源,删除源
    lsattr, chattr
    umask
    od
    init
    sync
    wc
    history
  • 原文地址:https://www.cnblogs.com/wpwen/p/399924.html
Copyright © 2020-2023  润新知