zoukankan      html  css  js  c++  java
  • 关于从剪贴板获得截图

    在我参照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截取的绘图程序界面)

  • 相关阅读:
    数据结构学习8——二叉树的销毁
    单链表的反向
    LNK4098: 默认库“MSVCRT”与其他库的使用冲突
    动态链接库(VC_Win32)
    注册表操作(VC_Win32)
    消息钩子与定时器(VC_Win32)
    套接字编程(VC_Win32)
    线程概述,优先级,睡眠,创建及终止(VC_Win32)
    进程通信(VC_Win32)
    进程概述及创建,终止(VC_Win32)
  • 原文地址:https://www.cnblogs.com/wpwen/p/399924.html
Copyright © 2011-2022 走看看