Esempio n. 1
0
        // Edit Menu - Copy
        private void _miEditCopy_Click(object sender, EventArgs e)
        {
            CapturedImageForm capturedImageForm = ActiveCapturedImageForm;

            try
            {
                using (WaitCursor wait = new WaitCursor())
                {
                    RasterClipboard.Copy(
                        this.Handle,
                        capturedImageForm.Viewer.Image,
                        RasterClipboardCopyFlags.Empty |
                        RasterClipboardCopyFlags.Dib |
                        RasterClipboardCopyFlags.Palette |
                        RasterClipboardCopyFlags.Region);
                }
            }
            catch (Exception ex)
            {
                Messager.ShowError(this, ex);
            }
            finally
            {
                UpdateMyControls();
            }
        }
Esempio n. 2
0
 private void _menuItemEditPaste_Click(object sender, EventArgs e)
 {
     try
     {
         using (WaitCursor wait = new WaitCursor())
         {
             RasterImage image = RasterClipboard.Paste(this.Handle);
             if (image != null)
             {
                 ViewerForm activeForm = ActiveViewerForm;
                 NewImage(new ImageInformation(image));
             }
         }
     }
     catch (Exception ex)
     {
         Messager.ShowError(this, ex);
     }
     finally
     {
         UpdateControls();
     }
 }
Esempio n. 3
0
 private void _miEditCopy_Click(object sender, System.EventArgs e)
 {
     try
     {
         using (WaitCursor wait = new WaitCursor())
         {
             RasterClipboard.Copy(
                 this.Handle,
                 ImageToRun,
                 RasterClipboardCopyFlags.Empty |
                 RasterClipboardCopyFlags.Dib |
                 RasterClipboardCopyFlags.Palette |
                 RasterClipboardCopyFlags.Region);
         }
     }
     catch (Exception ex)
     {
         Messager.ShowError(this, ex);
     }
     finally
     {
         UpdateControls();
     }
 }
Esempio n. 4
0
        private void _miEditPaste_Click(object sender, EventArgs e)
        {
            try
            {
                using (WaitCursor wait = new WaitCursor())
                {
                    RasterImage image = RasterClipboard.Paste(this.Handle);
                    if (image != null)
                    {
                        ViewerForm activeForm = ActiveViewerForm;

                        if (image.HasRegion && activeForm == null)
                        {
                            image.MakeRegionEmpty();
                        }

                        if (image.HasRegion)
                        {
                            // make sure the images have the same BitsPerPixel and Palette
                            if (activeForm.Viewer.Image.BitsPerPixel > 8)
                            {
                                if (image.BitsPerPixel != activeForm.Viewer.Image.BitsPerPixel)
                                {
                                    try
                                    {
                                        ColorResolutionCommand colorRes = new ColorResolutionCommand();
                                        colorRes.BitsPerPixel = activeForm.Viewer.Image.BitsPerPixel;
                                        colorRes.Order        = activeForm.Viewer.Image.Order;
                                        colorRes.Mode         = Leadtools.ImageProcessing.ColorResolutionCommandMode.InPlace;
                                        colorRes.Run(image);
                                    }
                                    catch (Exception ex)
                                    {
                                        Messager.ShowError(this, ex);
                                    }
                                }
                            }
                            else
                            {
                                try
                                {
                                    ColorResolutionCommand colorRes = new ColorResolutionCommand();
                                    colorRes.BitsPerPixel = activeForm.Viewer.Image.BitsPerPixel;
                                    colorRes.SetPalette(activeForm.Viewer.Image.GetPalette());
                                    colorRes.PaletteFlags = Leadtools.ImageProcessing.ColorResolutionCommandPaletteFlags.UsePalette;
                                    colorRes.Mode         = Leadtools.ImageProcessing.ColorResolutionCommandMode.InPlace;
                                    colorRes.Run(image);
                                }
                                catch (Exception ex)
                                {
                                    Messager.ShowError(this, ex);
                                }
                            }
                        }
                        else
                        {
                            NewImage(new ImageInformation(image));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Messager.ShowError(this, ex);
            }
            finally
            {
                UpdateControls();
            }
        }