Esempio n. 1
0
        private void clipboardImageBtn_Click(object sender, EventArgs e)
        {
            IDataObject iData = Clipboard.GetDataObject();

            if (iData.GetDataPresent(DataFormats.Bitmap))
            {
                draggableImage image = new draggableImage();
                image.Image    = (Bitmap)iData.GetData(DataFormats.Bitmap);
                image.Location = new Point(10, 10);
                image.SizeMode = PictureBoxSizeMode.AutoSize;
                this.Controls.Add(image);
                imageList.Add(image);
            }
        }
Esempio n. 2
0
        private void dragDropMW(object sender, DragEventArgs e)
        {
            Array  file     = (System.Array)e.Data.GetData(DataFormats.FileDrop);
            string fileText = null;
            Point  point    = this.PointToClient(MousePosition);

            foreach (object I in file)
            {
                fileText = I.ToString();
                if (fileText.EndsWith(".jpg") || fileText.EndsWith(".jpeg") ||
                    fileText.EndsWith(".bmp") || fileText.EndsWith(".png") ||
                    fileText.EndsWith(".gif"))
                {
                    draggableImage picture = new draggableImage();
                    picture.Load(fileText);
                    picture.Location = point;
                    point.X         += 5;
                    point.Y         += 5;
                    picture.SizeMode = PictureBoxSizeMode.AutoSize;
                    this.Controls.Add(picture);
                    imageList.Add(picture);
                }
            }
        }