protected virtual void OnClipboardDataChanged(ClipboardItem item) { }
protected void ClipboardUpdated() { ClipboardItem ci = new ClipboardItem(); if (Clipboard.ContainsText()) { ci.DataType = ClipboardDataType.Text; ci.Name = Clipboard.GetText(); ci.AddtionalInfo = "System.String"; ci.Format = Clipboard.GetDataObject().GetFormats()[0]; ci.Data = Clipboard.GetText(); } else if (Clipboard.ContainsImage()) { ci.DataType = ClipboardDataType.Image; ci.AddtionalInfo = "System.Drawing.Image"; ci.Data = Clipboard.GetImage(); ci.Format = Clipboard.GetDataObject().GetFormats()[0]; ci.Name = string.Format("Image ({0} bytes)", System.Runtime.InteropServices.Marshal.SizeOf(ci.Data)); } else if (Clipboard.ContainsFileDropList()) { ci.DataType = ClipboardDataType.Files; ci.AddtionalInfo = "File(s) List"; ci.Format = Clipboard.GetDataObject().GetFormats()[0]; ci.Data = Clipboard.GetFileDropList(); } else return; ClipboardDataChanged(ci); }
private void clipboardListener_ClipboardDataChanged(ClipboardItem item) { clipsListBox1.Items.Add(item); }