Here are the examples of the csharp api class System.Windows.Forms.Clipboard.ContainsImage() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
20 Examples
0
1. Example
View licenseprivate void clipboardToolStripMenuItem_Click(object sender, EventArgs e) { if (!Clipboard.ContainsImage() && !Common.ImageFileInClipboard && !Common.ImageUrlInClipboard) return; _otherformopen = true; Hide(); CaptureControl.GetFromClipboard(); }
0
2. Example
View licenseprivate void frmCapture_MouseUp(object sender, MouseEventArgs e) { if (e.Button /n ..... /n //View Source file for more details /n }
0
3. Example
View licenseprivate void Initialize() { // Adds handler to view events view.OnExiting += OnExiting; view.LoadContent += LoadContent; view.SaveContent += SaveContent; view.ShowSettings += ShowSettings; view.InstallSHLs += InstallSHLs; view.URLCalled += URLCalled; view.textGridCheckURLAndSetStatus += textGridCheckURLAndSetStatus; view.EditTextContent += EditTextContent; view.CopySelectedTextToClipboard += CopySelectedTextToClipboard; // Adds first content from clipboard if (Clipboard.ContainsText()) { LastClipboardText = Clipboard.GetText(); view.AddNewTextRow(getTextContentFromClipboard()); } else if (Clipboard.ContainsImage()) { view.AddNewImageRow(getImageContentFromClipboard()); Clipboard.GetText(); } view.ProgressVisibility = false; // Adds handler for clipboardContentChanged Event clipboardMonitor = new ClipboardMonitor(); clipboardMonitor.ClipboardChanged += ClipboardMonitor_ClipboardChanged; }
0
4. Example
View licenseprivate void ClipboardMonitor_ClipboardChanged(object sender, ClipboardChangedEventArgs e) { if (Clipboard.ContainsText() && Clipboard.GetText() != LastClipboardText) { view.AddNewTextRow(getTextContentFromClipboard()); } else if (Clipboard.ContainsImage()) { view.AddNewImageRow(getImageContentFromClipboard()); } }
0
5. Example
View licenseprivate void PasteButton_Click(System.Object sender, System.EventArgs e) { try { if (Clipboard.ContainsImage()) { this.unpackers.Clear(); this.DragAndDropLabel.Visible = false; this.ControlsHelpLabel.Visible = false; this.CreateUnpacker(new Bitmap(Clipboard.GetImage()), "clipboard"); this.StartUnpackers(); } else { MessageBox.Show("No image found in Clipboard"); } } catch (Exception ex) { ForkandBeard.Logic.ExceptionHandler.HandleException(ex, "[email protected]"); } }
0
6. Example
View licensepublic static void AnnotateImage(TaskSettings taskSettings = null) { if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings(); if (Clipboard.ContainsImage() && MessageBox.Show(Resources.TaskHelpers_OpenImageEditor_Your_clipboard_contains_image, Resources.TaskHelpers_OpenImageEditor_Image_editor___How_to_load_image_, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { using (Image img = ClipboardHelpers.GetImage()) { if (img != null) { if (taskSettings.AdvancedSettings.UseShareXForAnnotation) { AnnotateImageUsingShareX(img, null, taskSettings); } else { AnnotateImageUsingGreenshot(img, null); } return; } } } string filePath = ImageHelpers.OpenImageFileDialog(); if (!string.IsNullOrEmpty(filePath)) { AnnotateImage(filePath, taskSettings); } }
0
7. Example
View licensepublic static void OpenImageEditor(string filePath = null) { if (string.IsNullOrEmpty(filePath)) { if (Clipboard.ContainsImage() && MessageBox.Show(Resources.TaskHelpers_OpenImageEditor_Your_clipboard_contains_image, Resources.TaskHelpers_OpenImageEditor_Image_editor___How_to_load_image_, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { using (Image img = Clipboard.GetImage()) { if (img != null) { AnnotateImage(img, null); return; } } } filePath = ImageHelpers.OpenImageFileDialog(); } if (!string.IsNullOrEmpty(filePath)) { AnnotateImage(filePath); } }
0
8. Example
View licenseprivate static IList<object> LoadClipboardPicture() { try { Logger.Log("Load clipboard begins."); var result = new List<object>(); if (Clipboard.ContainsImage()) { result.Add(Clipboard.GetImage()); } if (Clipboard.ContainsFileDropList()) { result.Add(Clipboard.GetFileDropList()); } if (Clipboard.ContainsText()) { result.Add(Clipboard.GetText()); } Logger.Log("Load clipboard done."); return result; } catch (Exception e) { // sometimes Clipboard may fail Logger.LogException(e, "LoadClipboardPicture"); return new List<object>(); } }
0
9. Example
View licenseBitmap GetBitmap() { switch (CaptureMethod) { case ECapture.Clipboard: { while (!Clipboard.ContainsImage()) Thread.Sleep(50); Bitmap ret = (Bitmap)Clipboard.GetImage(); Clipboard.Clear(); return ret; } case ECapture.ScreenShoot: { Rectangle bounds = Screen.GetBounds(Point.Empty); Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height); using (Graphics g = Graphics.FromImage(bitmap)) { g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size); } return bitmap; } } return null; }
0
10. Example
View licenseprivate void PasteFromClipboard() { if (Clipboard.ContainsImage()) { Image img = ClipboardHelpers.GetImage(); if (img != null) { CurrentTool = ShapeType.DrawingImage; ImageDrawingShape shape = (ImageDrawingShape)CreateShape(ShapeType.DrawingImage); Point pos = InputManager.ClientMousePosition; shape.Rectangle = new Rectangle(pos.X, pos.Y, 1, 1); shape.SetImage(img, true); AddShape(shape); SelectCurrentShape(); } } else if (Clipboard.ContainsText()) { string text = Clipboard.GetText(); if (!string.IsNullOrEmpty(text)) { CurrentTool = ShapeType.DrawingTextBackground; TextDrawingShape shape = (TextDrawingShape)CreateShape(ShapeType.DrawingTextBackground); Point pos = InputManager.ClientMousePosition; shape.Rectangle = new Rectangle(pos.X, pos.Y, 1, 1); shape.Text = text.Trim(); shape.AutoSize(true); AddShape(shape); SelectCurrentShape(); } } }
0
11. Example
View licenseprivate void ClipboardContentViewer_Load(object sender, EventArgs e) { pbClipboa/n ..... /n //View Source file for more details /n }
0
12. Example
View licensepublic static void GetFromClipboard() { Image image = null; // Load the image from a copied image if (Clipboard.ContainsImage()) { Log.Write(l.Info, "Clipboard mode, copied image"); image = Clipboard.GetImage(); } // Load the image from a copied image file else if (Clipboard.ContainsFileDropList()) { Log.Write(l.Info, "Clipboard mode, file list"); foreach (var localFile in Clipboard.GetFileDropList()) { SaveImage(localFile); } // raise CaptureComplete to start uploading CaptureComplete(null, EventArgs.Empty); } // Load the image from a copied image url else if (Common.ImageUrlInClipboard) { var url = Clipboard.GetText(); Log.Write(l.Info, $"Clipboard mode, url: {url}"); image = GetFromUrl(url); } // Prevent null reference exception if (image == null) return; Common.OtherFormOpen = true; SaveImage(image); }
0
13. Example
View licenseprivate bool CheckClipboardContents() { pbClipboard.Visible = txtClipboard.Visib/n ..... /n //View Source file for more details /n }
0
14. Example
View licenseprivate void ClipboardContentViewer_Load(object sender, EventArgs e) { pbClipboa/n ..... /n //View Source file for more details /n }
0
15. Example
View licenseprivate void mnuMainOpenImageData_Click(object sender, EventArgs e) { //Is there/n ..... /n //View Source file for more details /n }
0
16. Example
View licensepublic static Image GetImageFromClipboard() { var dataObject = Clipboard.GetDataObject(); if (dataObject == null) return null; if (dataObject.GetDataPresent(DataFormats.Dib)) { var dib = ((MemoryStream) Clipboard.GetData(DataFormats.Dib)).ToArray(); var width = BitConverter.ToInt32(dib, 4); var height = BitConverter.ToInt32(dib, 8); var bpp = BitConverter.ToInt16(dib, 14); if (bpp == 32) { var gch = GCHandle.Alloc(dib, GCHandleType.Pinned); Bitmap bmp = null; try { var ptr = new IntPtr((long) gch.AddrOfPinnedObject() + 40); bmp = new Bitmap(width, height, width*4, PixelFormat.Format32bppArgb, ptr); var newBmp = new Bitmap(bmp); newBmp.RotateFlip(RotateFlipType.Rotate180FlipX); return newBmp; } finally { gch.Free(); bmp?.Dispose(); } } } return Clipboard.ContainsImage() ? Clipboard.GetImage() : null; }
0
17. Example
View licensevoid GetClipboardContents() { if (_image) { if (WinF/n ..... /n //View Source file for more details /n }
0
18. Example
View licensepublic static byte[] ComputeHash() { try // This works always or never { bool bOpened = /n ..... /n //View Source file for more details /n }
0
19. Example
View licensepublic static void ClipboardUpload(TaskSettings taskSettings = null) { if (taskS/n ..... /n //View Source file for more details /n }
0
20. Example
View licensepublic static void ClipboardUpload(TaskSettings taskSettings = null) { if (taskS/n ..... /n //View Source file for more details /n }