CSharp examples for System.Windows.Forms:Clipboard
Copy To Clipboard
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using Microsoft.Data.Entity.Design.Model.Entity; using Microsoft.Data.Entity.Design.Model.Designer; using System.Windows.Forms; using System.Diagnostics; using System.Collections.Generic; public class Main{ private static void CopyToClipboard<T>(T obj) {/*from ww w . j ava 2 s . co m*/ Debug.Assert(obj != null, "Cannot copy null to clipboard"); if (obj != null) { var copyDataObject = new DataObject(); var t = typeof(T); copyDataObject.SetData(DataFormats.GetFormat(t.FullName).Name, obj); Clipboard.SetDataObject(copyDataObject); } } internal static void CopyToClipboard(EnumType enumType) { CopyToClipboard(new EnumTypeClipboardFormat(enumType)); } internal static void CopyToClipboard(ComplexType complexType) { CopyToClipboard(new ComplexTypeClipboardFormat(complexType)); } internal static void CopyToClipboard(ICollection<Property> properties) { CopyToClipboard(new PropertiesClipboardFormat(properties)); } internal static void CopyToClipboard( ICollection<EntityType> entities, ICollection<Association> associations, IDictionary<EntityType, EntityType> inheritances) { CopyToClipboard(new EntitiesClipboardFormat(entities, associations, inheritances)); } internal static void CopyToClipboard(ICollection<EntityTypeShape> entityTypeShapes) { CopyToClipboard(new EntitiesClipboardFormat(entityTypeShapes)); } }