Пример #1
0
        /// <summary>
        /// 把数据复制到剪贴板中。
        /// </summary>
        /// <param name="ctls"></param>
        public static void CopyToClipBoard(IList ctls)
        {
            IDataObject    ido   = new DataObject();
            MyClipbordData cData = new MyClipbordData(ctls);

            ido.SetData(MyClipbordData.Format.Name, true, cData);
            Clipboard.SetDataObject(ido, false);
        }
Пример #2
0
        /// <summary>
        /// 从剪贴板中获取
        /// </summary>
        /// <returns></returns>
        public static IList GetFromClipBoard()
        {
            IDataObject ido = Clipboard.GetDataObject();

            if (ido.GetDataPresent(MyClipbordData.Format.Name))
            {
                object         obj    = ido.GetData(MyClipbordData.Format.Name, true);
                MyClipbordData cbCtrl = obj as MyClipbordData;

                return(cbCtrl.DataToIList());
            }
            return(null);
        }