Beispiel #1
0
        private async void WindowDrop(object sender, DragEventArgs e)
        {
            try
            {
                Win32.GetCursorPos(out _curPosition);
                var imageSources = await ImagePaster.GetImageFromIDataObject(e.Data);

                if (imageSources.Count <= 0)
                {
                    return;
                }
                _controlManager.SelectNone();
                var translate = new Point(_curPosition.X - SystemParameters.VirtualScreenWidth / 2, _curPosition.Y - SystemParameters.VirtualScreenHeight / 2);
                var controls  = new List <ImageControl>(imageSources.Count);
                controls.AddRange(imageSources.Select(imageSource => PackageImageToControl(new AnimatedGif {
                    Source = imageSource, Stretch = Stretch.Fill
                }, translate)));
                _controlManager.AddElements(controls);
            }
            catch (Exception ex)
            {
                App.Log.Error(ex.ToString());
                Extentions.ShowMessageBox("无效的粘贴!");
            }
        }