예제 #1
0
        public void Paste()
        {
            IDataObject data = Clipboard.GetDataObject();

            string[] formats = data.GetFormats();
            if (formats.Length == 0)
            {
                return;
            }

            this.UpdateHistoryBefore(true);
            this.image.Dispose();

            if (data.GetDataPresent(DataFormats.Dib))
            {
                MemoryStream dat = (MemoryStream)data.GetData(DataFormats.Dib);
                this.image = BitmapLoader.BitmapFromDIB(dat);
            }
            else if (data.GetDataPresent(DataFormats.Bitmap))
            {
                this.image = (Bitmap)data.GetData(DataFormats.Bitmap);
            }

            this.edit_layer.Dispose();
            this.edit_layer = new Bitmap(this.image);
            this.UpdateHistoryAfter(true);
            this.SetSize(image.Width, image.Height);
            this.SetZoom(this.Zoom);
        }